MCPcopy Create free account
hub / github.com/docker/docker-agent / TestFetchModelsFromURL_ContextCanceled

Function TestFetchModelsFromURL_ContextCanceled

cmd/root/models_test.go:285–300  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

283}
284
285func 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
302func TestFetchModelsFromURL_SkipsEmbeddingModels(t *testing.T) {
303 // The function passes all model IDs through; embedding filtering

Callers

nothing calls this directly

Calls 5

fetchModelsFromURLFunction · 0.85
ContextMethod · 0.80
LoadMethod · 0.80
CleanupMethod · 0.65
StoreMethod · 0.45

Tested by

no test coverage detected