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

Function newActiveTestServer

coderd/x/chatd/chatd_test.go:5896–5922  ·  view source on GitHub ↗

newActiveTestServer creates a chatd server that actively polls for and processes pending chats. Use this instead of newTestServer when the test needs the chat loop to actually run. Optional config overrides are applied after the defaults.

(
	t *testing.T,
	db database.Store,
	ps dbpubsub.Pubsub,
	overrides ...func(*chatd.Config),
)

Source from the content-addressed store, hash-verified

5894// the test needs the chat loop to actually run. Optional config
5895// overrides are applied after the defaults.
5896func newActiveTestServer(
5897 t *testing.T,
5898 db database.Store,
5899 ps dbpubsub.Pubsub,
5900 overrides ...func(*chatd.Config),
5901) *chatd.Server {
5902 t.Helper()
5903
5904 logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true})
5905 cfg := chatd.Config{
5906 Logger: logger,
5907 Database: db,
5908 ReplicaID: uuid.New(),
5909 Pubsub: ps,
5910 PendingChatAcquireInterval: 10 * time.Millisecond,
5911 InFlightChatStaleAfter: testutil.WaitSuperLong,
5912 }
5913 for _, o := range overrides {
5914 o(&cfg)
5915 }
5916 server := chatd.New(cfg)
5917 server.Start()
5918 t.Cleanup(func() {
5919 require.NoError(t, server.Close())
5920 })
5921 return server
5922}
5923
5924func TestProposeChatTitle_DebugRun(t *testing.T) {
5925 t.Parallel()

Calls 6

NewFunction · 0.92
HelperMethod · 0.65
NewMethod · 0.65
StartMethod · 0.65
CleanupMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected