Skip to content

Commit 72ff312

Browse files
committed
lint
1 parent 8eb3ebe commit 72ff312

File tree

1 file changed

+1
-31
lines changed

1 file changed

+1
-31
lines changed

integration/integration_test.go

+1-31
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ import (
1414
"time"
1515

1616
"github.com/coder/coder/v2/codersdk"
17-
"github.com/docker/docker/api/types"
1817
"github.com/docker/docker/api/types/container"
1918
"github.com/docker/docker/client"
20-
"github.com/docker/docker/pkg/stdcopy"
2119
"github.com/docker/go-connections/nat"
2220
"github.com/stretchr/testify/assert"
2321
"github.com/stretchr/testify/require"
@@ -27,7 +25,7 @@ import (
2725
// For each directory containing a `main.tf` under `/integration`, performs the following:
2826
// - Creates a temporary Coder instance running in Docker
2927
// - Runs the `main.tf` specified in the given test directory against the Coder deployment
30-
// - Asserts the state of the deployment via `codersdk`
28+
// - Asserts the state of the deployment via `codersdk`.
3129
func TestIntegration(t *testing.T) {
3230
if os.Getenv("TF_ACC") == "1" {
3331
t.Skip("Skipping integration tests during tf acceptance tests")
@@ -190,34 +188,6 @@ func startCoder(ctx context.Context, t *testing.T, name string) *codersdk.Client
190188
return client
191189
}
192190

193-
// execContainer executes the given command in the given container and returns
194-
// the output and the exit code of the command.
195-
func execContainer(ctx context.Context, t testing.TB, containerID, command string) (string, int) {
196-
t.Helper()
197-
t.Logf("exec container cmd: %q", command)
198-
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
199-
require.NoError(t, err, "connect to docker")
200-
defer cli.Close()
201-
execConfig := types.ExecConfig{
202-
AttachStdout: true,
203-
AttachStderr: true,
204-
Cmd: []string{"/bin/sh", "-c", command},
205-
}
206-
ex, err := cli.ContainerExecCreate(ctx, containerID, execConfig)
207-
require.NoError(t, err, "create container exec")
208-
resp, err := cli.ContainerExecAttach(ctx, ex.ID, types.ExecStartCheck{})
209-
require.NoError(t, err, "attach to container exec")
210-
defer resp.Close()
211-
var buf bytes.Buffer
212-
_, err = stdcopy.StdCopy(&buf, &buf, resp.Reader)
213-
require.NoError(t, err, "read stdout")
214-
out := buf.String()
215-
t.Log("exec container output:\n" + out)
216-
execResp, err := cli.ContainerExecInspect(ctx, ex.ID)
217-
require.NoError(t, err, "get exec exit code")
218-
return out, execResp.ExitCode
219-
}
220-
221191
// randomPort is a helper function to find a free random port.
222192
// Note that the OS may reallocate the port very quickly, so
223193
// this is not _guaranteed_.

0 commit comments

Comments
 (0)