Skip to content

Commit efa69a8

Browse files
committed
fix: iterate through all workspace updates on logs overflow
This was causing some flakes!
1 parent 6378294 commit efa69a8

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

coderd/workspaceagents_test.go

+13-7
Original file line numberDiff line numberDiff line change
@@ -282,14 +282,20 @@ func TestWorkspaceAgentStartupLogs(t *testing.T) {
282282
require.ErrorAs(t, err, &apiError)
283283
require.Equal(t, http.StatusRequestEntityTooLarge, apiError.StatusCode())
284284

285-
var update codersdk.Workspace
286-
select {
287-
case <-ctx.Done():
288-
t.FailNow()
289-
case update = <-updates:
285+
// It's possible we have multiple updates queued, but that's alright, we just
286+
// wait for the one where it overflows.
287+
for {
288+
var update codersdk.Workspace
289+
select {
290+
case <-ctx.Done():
291+
t.FailNow()
292+
case update = <-updates:
293+
}
294+
if update.LatestBuild.Resources[0].Agents[0].StartupLogsOverflowed {
295+
break
296+
}
290297
}
291-
// Ensure that the UI gets an update when the logs overflow!
292-
require.True(t, update.LatestBuild.Resources[0].Agents[0].StartupLogsOverflowed)
298+
293299
})
294300
}
295301

0 commit comments

Comments
 (0)