Skip to content
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
chore: add validation that channel works first
  • Loading branch information
DanielleMaywood committed Aug 18, 2025
commit 123760a73e3ff5203f2fc183fc2a4603a110539a
12 changes: 12 additions & 0 deletions coderd/workspaceagents_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,18 @@ func TestWatchAgentContainers(t *testing.T) {
defer decoder.Close()
decodeCh := decoder.Chan()

// And: We can successfully send through the channel.
testutil.RequireSend(ctx, t, containersCh, codersdk.WorkspaceAgentListContainersResponse{
Containers: []codersdk.WorkspaceAgentContainer{{
ID: "test-container-id",
}},
})

// And: Receive the data.
containerResp := testutil.RequireReceive(ctx, t, decodeCh)
require.Len(t, containerResp.Containers, 1)
require.Equal(t, "test-container-id", containerResp.Containers[0].ID)

// When: We close the `containersCh`
close(containersCh)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have at least one test message sent first to confirm the base case works and then the exit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me


Expand Down
Loading