fix: iterate through all workspace updates on logs overflow (#6885)

This was causing some flakes!
This commit is contained in:
Kyle Carberry
2023-03-30 10:05:45 -05:00
committed by GitHub
parent e470162305
commit 5c1dc1b7fe

View File

@ -282,14 +282,19 @@ func TestWorkspaceAgentStartupLogs(t *testing.T) {
require.ErrorAs(t, err, &apiError) require.ErrorAs(t, err, &apiError)
require.Equal(t, http.StatusRequestEntityTooLarge, apiError.StatusCode()) require.Equal(t, http.StatusRequestEntityTooLarge, apiError.StatusCode())
// It's possible we have multiple updates queued, but that's alright, we just
// wait for the one where it overflows.
for {
var update codersdk.Workspace var update codersdk.Workspace
select { select {
case <-ctx.Done(): case <-ctx.Done():
t.FailNow() t.FailNow()
case update = <-updates: case update = <-updates:
} }
// Ensure that the UI gets an update when the logs overflow! if update.LatestBuild.Resources[0].Agents[0].StartupLogsOverflowed {
require.True(t, update.LatestBuild.Resources[0].Agents[0].StartupLogsOverflowed) break
}
}
}) })
} }