(t *testing.T)
| 244 | } |
| 245 | |
| 246 | func TestPoolReplaceProvidersAfterShutdownIsNoop(t *testing.T) { |
| 247 | t.Parallel() |
| 248 | |
| 249 | logger := slogtest.Make(t, nil) |
| 250 | opts := aibridged.PoolOptions{MaxItems: 1, TTL: time.Minute} |
| 251 | pool, err := aibridged.NewCachedBridgePool(opts, nil, logger, nil, testTracer) |
| 252 | require.NoError(t, err) |
| 253 | |
| 254 | require.NoError(t, pool.Shutdown(t.Context())) |
| 255 | require.NotPanics(t, func() { |
| 256 | pool.ReplaceProviders([]aibridge.Provider{ |
| 257 | aibridge.NewOpenAIProvider(config.OpenAI{Name: "new", BaseURL: "https://example.com"}), |
| 258 | }) |
| 259 | }) |
| 260 | |
| 261 | _, err = pool.Acquire(t.Context(), aibridged.Request{ |
| 262 | SessionKey: "key", |
| 263 | InitiatorID: uuid.New(), |
| 264 | APIKeyID: uuid.New().String(), |
| 265 | }, func() (aibridged.DRPCClient, error) { |
| 266 | return nil, context.Canceled |
| 267 | }, newMockMCPFactory(nil)) |
| 268 | require.ErrorContains(t, err, "pool shutting down") |
| 269 | } |
| 270 | |
| 271 | func TestPool_Expiry(t *testing.T) { |
| 272 | t.Parallel() |
nothing calls this directly
no test coverage detected