(t *testing.T)
| 283 | } |
| 284 | |
| 285 | func TestFetchModelsFromURL_ContextCanceled(t *testing.T) { |
| 286 | t.Parallel() |
| 287 | |
| 288 | var called atomic.Bool |
| 289 | server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 290 | called.Store(true) |
| 291 | })) |
| 292 | t.Cleanup(server.Close) |
| 293 | |
| 294 | ctx, cancel := context.WithCancel(t.Context()) |
| 295 | cancel() |
| 296 | |
| 297 | models := fetchModelsFromURL(ctx, server.URL+"/v1/models", server.Client()) |
| 298 | assert.Empty(t, models) |
| 299 | assert.False(t, called.Load(), "server must not be reached with an already-canceled context") |
| 300 | } |
| 301 | |
| 302 | func TestFetchModelsFromURL_SkipsEmbeddingModels(t *testing.T) { |
| 303 | // The function passes all model IDs through; embedding filtering |
nothing calls this directly
no test coverage detected