test: migrate chatd tests to AI Gateway routing (#26658)

Refs CODAGT-681

Migrates all chatd tests from `AIGatewayRoutingEnabled = false` (direct
routing) to AI Gateway routing using the test helpers extracted in
#26639.

- `coderd/x/chatd/chatd_test.go` — 6 full-server tests migrated to
`NewWithAPI` + daemon, `directChatRoutingDeploymentValues` helper
deleted, 3 bare-chatd tests renamed
- `coderd/x/chatd/context_integration_test.go` — 2 tests migrated
- `coderd/exp_chats_test.go` — `chatDeploymentValues` helper deleted,
all 5 helper functions now use `NewWithAPI` + daemon internally (no call
site changes)
- `coderd/exp_chats_acl_test.go` — stale `chatDeploymentValues`
reference replaced
- `enterprise/coderd/exp_chats_test.go` — 9 sites across 5
`TestChatStreamRelay` subtests migrated
- `cli/exp_scaletest_chat_test.go` — 1 test migrated
- `coderd/x/chatd/model_routing_internal_test.go` — 1 direct-only test
removed
- `coderd/x/chatd/chatd_internal_test.go` — 1 direct-only test removed

> 🤖
This commit is contained in:
Cian Johnston
2026-06-30 12:17:42 +01:00
committed by GitHub
parent 33780758c1
commit e5b7e74847
8 changed files with 210 additions and 182 deletions
+3 -4
View File
@@ -15,6 +15,7 @@ import (
"cdr.dev/slog/v3"
"cdr.dev/slog/v3/sloggers/sloghuman"
"github.com/coder/coder/v2/cli/clitest"
"github.com/coder/coder/v2/coderd/aibridgedtest"
"github.com/coder/coder/v2/coderd/coderdtest"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/scaletest/llmmock"
@@ -29,13 +30,11 @@ func TestScaleTestChat(t *testing.T) {
ctx := testutil.Context(t, testutil.WaitLong)
values := coderdtest.DeploymentValues(t, func(dv *codersdk.DeploymentValues) {
require.NoError(t, dv.AI.BridgeConfig.Enabled.Set("true"))
// Keep AI Gateway routing disabled so the chat uses the direct model
// route to the mock provider, avoiding the need for an aibridged daemon.
require.NoError(t, dv.AI.Chat.AIGatewayRoutingEnabled.Set("false"))
})
client := coderdtest.New(t, &coderdtest.Options{
client, _, api := coderdtest.NewWithAPI(t, &coderdtest.Options{
DeploymentValues: values,
})
aibridgedtest.StartTestAIBridgeDaemon(t.Context(), t, api, nil)
coderdtest.CreateFirstUser(t, client)
server := new(llmmock.Server)