test: isolate passive chatd internal tests (#26369)

Make `newInternalTestServer` use option functions for logger, clock, and
worker startup, and make it passive by default so internal chatd tests
only opt into background execution when they need a real worker.

Use the passive server path in `TestAwaitSubagentCompletion` for the
state-driven subtests, keep `ContextCanceled` explicitly active for real
provider cancellation coverage, and keep the fail-fast default AI
provider base URL so accidental provider calls still fail immediately.

Closes CODAGT-586
Closes https://github.com/coder/internal/issues/1549
This commit is contained in:
Ethan
2026-06-18 00:21:09 +10:00
committed by GitHub
parent be25ba24b0
commit 35af54d6aa
3 changed files with 65 additions and 85 deletions
+7 -6
View File
@@ -218,12 +218,13 @@ func AIProvider(t testing.TB, db database.Store, seed database.AIProvider, munge
displayName = sql.NullString{String: name, Valid: true}
}
params := database.InsertAIProviderParams{
ID: id,
Type: provType,
Name: name,
DisplayName: displayName,
Enabled: takeFirst(seed.Enabled, true),
BaseUrl: takeFirst(seed.BaseUrl, "https://api.example.com/"),
ID: id,
Type: provType,
Name: name,
DisplayName: displayName,
Enabled: takeFirst(seed.Enabled, true),
// Use an unsupported scheme so leaked test provider calls fail immediately without retries.
BaseUrl: takeFirst(seed.BaseUrl, "invalid://test.invalid/"),
Settings: seed.Settings,
SettingsKeyID: seed.SettingsKeyID,
}