Skip to content

Commit e12ccc7

Browse files
chore: appease linter and remove duplicated test
1 parent 3b44a89 commit e12ccc7

File tree

2 files changed

+4
-38
lines changed

2 files changed

+4
-38
lines changed

agent/agentcontainers/devcontainercli_test.go

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -400,39 +400,6 @@ func TestDevcontainerCLI_WithOutput(t *testing.T) {
400400
assert.NotEmpty(t, outBuf.String(), "stdout buffer should not be empty for exec with log file")
401401
assert.Empty(t, errBuf.String(), "stderr buffer should be empty")
402402
})
403-
404-
t.Run("ReadConfig", func(t *testing.T) {
405-
t.Parallel()
406-
407-
// Buffers to capture stdout and stderr.
408-
outBuf := &bytes.Buffer{}
409-
errBuf := &bytes.Buffer{}
410-
411-
// Simulate CLI execution with a read-config-success.log file.
412-
wantArgs := "read-configuration --workspace-folder /test/workspace --config /test/config.json"
413-
testExecer := &testDevcontainerExecer{
414-
testExePath: testExePath,
415-
wantArgs: wantArgs,
416-
wantError: false,
417-
logFile: filepath.Join("testdata", "devcontainercli", "readconfig", "read-config-success.log"),
418-
}
419-
logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true}).Leveled(slog.LevelDebug)
420-
dccli := agentcontainers.NewDevcontainerCLI(logger, testExecer)
421-
422-
// Call ReadConfig with WithReadConfigOutput to capture CLI logs.
423-
ctx := testutil.Context(t, testutil.WaitMedium)
424-
config, err := dccli.ReadConfig(ctx, "/test/workspace", "/test/config.json", agentcontainers.WithReadConfigOutput(outBuf, errBuf))
425-
require.NoError(t, err, "ReadConfig should succeed")
426-
require.NotEmpty(t, config.Configuration.Customizations, "expected non-empty customizations")
427-
428-
// Read expected log content.
429-
expLog, err := os.ReadFile(filepath.Join("testdata", "devcontainercli", "readconfig", "read-config-success.log"))
430-
require.NoError(t, err, "reading expected log file")
431-
432-
// Verify stdout buffer contains the CLI logs and stderr is empty.
433-
assert.Equal(t, string(expLog), outBuf.String(), "stdout buffer should match CLI logs")
434-
assert.Empty(t, errBuf.String(), "stderr buffer should be empty on success")
435-
})
436403
}
437404

438405
// testDevcontainerExecer implements the agentexec.Execer interface for testing.

agent/agentcontainers/subagent_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ package agentcontainers_test
33
import (
44
"testing"
55

6+
"github.com/google/uuid"
7+
"github.com/stretchr/testify/require"
8+
69
"github.com/coder/coder/v2/agent/agentcontainers"
710
"github.com/coder/coder/v2/agent/agenttest"
8-
"github.com/coder/coder/v2/agent/proto"
911
agentproto "github.com/coder/coder/v2/agent/proto"
1012
"github.com/coder/coder/v2/codersdk"
1113
"github.com/coder/coder/v2/codersdk/agentsdk"
1214
"github.com/coder/coder/v2/tailnet"
1315
"github.com/coder/coder/v2/testutil"
14-
"github.com/google/uuid"
15-
"github.com/stretchr/testify/require"
1616
)
1717

1818
func TestSubAgentClient_CreateWithDisplayApps(t *testing.T) {
@@ -75,7 +75,7 @@ func TestSubAgentClient_CreateWithDisplayApps(t *testing.T) {
7575

7676
ctx := testutil.Context(t, testutil.WaitShort)
7777
logger := testutil.Logger(t)
78-
statsCh := make(chan *proto.Stats)
78+
statsCh := make(chan *agentproto.Stats)
7979

8080
agentAPI := agenttest.NewClient(t, logger, uuid.New(), agentsdk.Manifest{}, statsCh, tailnet.NewCoordinator(logger))
8181

@@ -102,5 +102,4 @@ func TestSubAgentClient_CreateWithDisplayApps(t *testing.T) {
102102
})
103103
}
104104
})
105-
106105
}

0 commit comments

Comments
 (0)