Skip to content

fix(coderd): prevent lost messages in watchWorkspaceAgentMetadata #7934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix update of got
  • Loading branch information
mafredri committed Jun 13, 2023
commit 3e908d75b43bc4f7b615d69970ea4e62b42e2336
8 changes: 7 additions & 1 deletion coderd/workspaceagents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,13 @@ func TestWorkspaceAgent_Metadata(t *testing.T) {
// We can't trust the order of the updates due to timers and debounces,
// so let's check a few times once more.
for i := 0; i < 2 && (want.Value != got.Result.Value || want.Error != got.Result.Error); i++ {
recvUpdate()
update = recvUpdate()
for _, m := range update {
if m.Description.Key == got.Description.Key {
got = m
break
}
}
}
ok1 := assert.Equal(t, want.Value, got.Result.Value)
ok2 := assert.Equal(t, want.Error, got.Result.Error)
Expand Down