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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 7 deletions

View File

@ -282,14 +282,19 @@ func TestWorkspaceAgentStartupLogs(t *testing.T) {
require.ErrorAs(t, err, &apiError)
require.Equal(t, http.StatusRequestEntityTooLarge, apiError.StatusCode())
var update codersdk.Workspace
select {
case <-ctx.Done():
t.FailNow()
case update = <-updates:
// 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
select {
case <-ctx.Done():
t.FailNow()
case update = <-updates:
}
if update.LatestBuild.Resources[0].Agents[0].StartupLogsOverflowed {
break
}
}
// Ensure that the UI gets an update when the logs overflow!
require.True(t, update.LatestBuild.Resources[0].Agents[0].StartupLogsOverflowed)
})
}