Skip to content

Commit b8e1c2f

Browse files
fix: increase timeout for watch workspace agent devcontainers test
Fixes coder/internal#907 When running in a CI environment, the process of setting up the agent + coderd + creating the websocket connection can sometimes take up to 10 seconds, by which time we timeout. To resolve this we up the timeout from `WaitShort` to `WaitLong`.
1 parent 2ea807f commit b8e1c2f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

coderd/workspaceagents_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1579,8 +1579,10 @@ func TestWatchWorkspaceAgentDevcontainers(t *testing.T) {
15791579
t.Parallel()
15801580

15811581
var (
1582-
ctx = testutil.Context(t, testutil.WaitShort)
1582+
ctx = testutil.Context(t, testutil.WaitLong)
15831583
logger = slogtest.Make(t, &slogtest.Options{IgnoreErrors: true}).Leveled(slog.LevelDebug)
1584+
mClock = quartz.NewMock(t)
1585+
updaterTickerTrap = mClock.Trap().TickerFunc("updaterLoop")
15841586
mCtrl = gomock.NewController(t)
15851587
mCCLI = acmock.NewMockContainerCLI(mCtrl)
15861588

@@ -1621,6 +1623,7 @@ func TestWatchWorkspaceAgentDevcontainers(t *testing.T) {
16211623
o.Logger = logger.Named("agent")
16221624
o.Devcontainers = true
16231625
o.DevcontainerAPIOptions = []agentcontainers.Option{
1626+
agentcontainers.WithClock(mClock),
16241627
agentcontainers.WithContainerCLI(mCCLI),
16251628
agentcontainers.WithWatcher(watcher.NewNoop()),
16261629
}
@@ -1631,6 +1634,9 @@ func TestWatchWorkspaceAgentDevcontainers(t *testing.T) {
16311634
require.Len(t, resources[0].Agents, 1, "expected one agent")
16321635
agentID := resources[0].Agents[0].ID
16331636

1637+
updaterTickerTrap.MustWait(ctx).MustRelease(ctx)
1638+
defer updaterTickerTrap.Close()
1639+
16341640
containers, closer, err := client.WatchWorkspaceAgentContainers(ctx, agentID)
16351641
require.NoError(t, err)
16361642
defer func() {

0 commit comments

Comments
 (0)