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

Function WaitForChatSettled

coderd/coderdtest/chat.go:88–106  ·  view source on GitHub ↗

WaitForChatSettled waits for a chat to leave active processing and drains tracked chat daemon work before returning the final row.

(
	ctx context.Context,
	t testing.TB,
	api *coderd.API,
	chatID uuid.UUID,
)

Source from the content-addressed store, hash-verified

86// WaitForChatSettled waits for a chat to leave active processing and drains
87// tracked chat daemon work before returning the final row.
88func WaitForChatSettled(
89 ctx context.Context,
90 t testing.TB,
91 api *coderd.API,
92 chatID uuid.UUID,
93) database.Chat {
94 t.Helper()
95
96 require.NotNil(t, api)
97 waitForChatTerminalState(ctx, t, api.Database, chatID)
98
99 server := api.ChatDaemonForTest()
100 require.NotNil(t, server)
101 chatd.WaitUntilIdleForTest(server)
102
103 chat, err := getChatByIDAsSystem(ctx, api.Database, chatID)
104 require.NoError(t, err)
105 return chat
106}
107
108func waitForChatTerminalState(
109 ctx context.Context,

Callers 3

TestPatchChatFunction · 0.92
TestRegenerateChatTitleFunction · 0.92
TestProposeChatTitleFunction · 0.92

Calls 5

WaitUntilIdleForTestFunction · 0.92
waitForChatTerminalStateFunction · 0.85
getChatByIDAsSystemFunction · 0.85
ChatDaemonForTestMethod · 0.80
HelperMethod · 0.65

Tested by 3

TestPatchChatFunction · 0.74
TestRegenerateChatTitleFunction · 0.74
TestProposeChatTitleFunction · 0.74