newDebugEnabledTestServer creates a passive test server with AlwaysEnableDebugLogs=true so that IsEnabled(ctx, chatID, ownerID) always returns true regardless of runtime admin config. This lets chatd-level integration tests exercise the debug cleanup wiring without seeding the admin/user opt-in sett
( t *testing.T, db database.Store, ps dbpubsub.Pubsub, replicaID uuid.UUID, )
| 5867 | // chatd-level integration tests exercise the debug cleanup wiring |
| 5868 | // without seeding the admin/user opt-in settings tables. |
| 5869 | func newDebugEnabledTestServer( |
| 5870 | t *testing.T, |
| 5871 | db database.Store, |
| 5872 | ps dbpubsub.Pubsub, |
| 5873 | replicaID uuid.UUID, |
| 5874 | ) *chatd.Server { |
| 5875 | t.Helper() |
| 5876 | |
| 5877 | logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true}) |
| 5878 | server := chatd.New(chatd.Config{ |
| 5879 | Logger: logger, |
| 5880 | Database: db, |
| 5881 | ReplicaID: replicaID, |
| 5882 | Pubsub: ps, |
| 5883 | PendingChatAcquireInterval: testutil.WaitLong, |
| 5884 | AlwaysEnableDebugLogs: true, |
| 5885 | }) |
| 5886 | t.Cleanup(func() { |
| 5887 | require.NoError(t, server.Close()) |
| 5888 | }) |
| 5889 | return server |
| 5890 | } |
| 5891 | |
| 5892 | // newActiveTestServer creates a chatd server that actively polls for |
| 5893 | // and processes pending chats. Use this instead of newTestServer when |
no test coverage detected