buildFromEnv exercises the same env-config-in/providers-out path that production uses on boot: SeedAIProvidersFromEnv writes the env-derived rows to the database, and BuildProviders reads them back as runtime [aibridge.Provider] instances. This keeps the existing TestBuildProviders table intact whil
(t *testing.T, cfg codersdk.AIBridgeConfig)
| 29 | // table intact while reflecting the post-refactor flow where the database |
| 30 | // is the single source of truth. |
| 31 | func buildFromEnv(t *testing.T, cfg codersdk.AIBridgeConfig) ([]aibridge.Provider, error) { |
| 32 | t.Helper() |
| 33 | db, _ := dbtestutil.NewDB(t) |
| 34 | ctx := testutil.Context(t, testutil.WaitShort) |
| 35 | logger := slogtest.Make(t, nil) |
| 36 | if err := coderd.SeedAIProvidersFromEnv(ctx, db, cfg, logger); err != nil { |
| 37 | return nil, err |
| 38 | } |
| 39 | providers, _, err := BuildProviders(ctx, db, cfg, logger) |
| 40 | return providers, err |
| 41 | } |
| 42 | |
| 43 | func TestBuildProviders(t *testing.T) { |
| 44 | t.Parallel() |
no test coverage detected