MCPcopy Index your code
hub / github.com/coder/coder / recvMsg

Function recvMsg

agent/agentgit/agentgit_test.go:714–724  ·  view source on GitHub ↗

recvMsg reads the next server message, using the provided context for the timeout instead of a raw time.After.

(ctx context.Context, t *testing.T, ch <-chan codersdk.WorkspaceAgentGitServerMessage)

Source from the content-addressed store, hash-verified

712// recvMsg reads the next server message, using the provided
713// context for the timeout instead of a raw time.After.
714func recvMsg(ctx context.Context, t *testing.T, ch <-chan codersdk.WorkspaceAgentGitServerMessage) codersdk.WorkspaceAgentGitServerMessage {
715 t.Helper()
716 select {
717 case msg, ok := <-ch:
718 require.True(t, ok, "channel closed unexpectedly")
719 return msg
720 case <-ctx.Done():
721 t.Fatal("timed out waiting for server message")
722 return codersdk.WorkspaceAgentGitServerMessage{}
723 }
724}
725
726func TestWebSocketSubscribeAndReceiveChanges(t *testing.T) {
727 t.Parallel()

Calls 3

FatalMethod · 0.80
HelperMethod · 0.65
DoneMethod · 0.45

Tested by

no test coverage detected