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

Function TestPassiveServerDoesNotProcess

coderd/x/chatd/chatd_test.go:5813–5836  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

5811}
5812
5813func TestPassiveServerDoesNotProcess(t *testing.T) {
5814 t.Parallel()
5815
5816 ctx := testutil.Context(t, testutil.WaitLong)
5817 db, ps := dbtestutil.NewDB(t, dbtestutil.WithDumpOnFailure())
5818 user, org, model := seedChatDependencies(t, db)
5819
5820 server := newTestServer(t, db, ps, uuid.New())
5821 chat, err := server.CreateChat(ctx, chatd.CreateOptions{
5822 OrganizationID: org.ID,
5823 OwnerID: user.ID,
5824 Title: "should-stay-pending",
5825 InitialUserContent: []codersdk.ChatMessagePart{{Type: codersdk.ChatMessagePartTypeText, Text: "hello"}},
5826 ModelConfigID: model.ID,
5827 })
5828 require.NoError(t, err)
5829
5830 chatd.WaitUntilIdleForTest(server)
5831
5832 // Re-read from DB to catch any unexpected state transition.
5833 stored, err := db.GetChatByID(ctx, chat.ID)
5834 require.NoError(t, err)
5835 require.Equal(t, database.ChatStatusPending, stored.Status)
5836}
5837
5838// newStartedTestServer creates a server with Start() called.
5839// Uses a long acquire interval so processing is triggered by

Callers

nothing calls this directly

Calls 10

ContextFunction · 0.92
NewDBFunction · 0.92
WithDumpOnFailureFunction · 0.92
WaitUntilIdleForTestFunction · 0.92
seedChatDependenciesFunction · 0.70
newTestServerFunction · 0.70
NewMethod · 0.65
CreateChatMethod · 0.65
GetChatByIDMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected