MCPcopy Index your code
hub / github.com/docker/docker-agent / TestNoPredicateAlwaysAllowsFetch

Function TestNoPredicateAlwaysAllowsFetch

pkg/modelsdev/store_test.go:85–95  ·  view source on GitHub ↗

TestNoPredicateAlwaysAllowsFetch guards the default, backwards-compatible behaviour: with no knownProvider predicate every provider may fetch.

(t *testing.T)

Source from the content-addressed store, hash-verified

83// TestNoPredicateAlwaysAllowsFetch guards the default, backwards-compatible
84// behaviour: with no knownProvider predicate every provider may fetch.
85func TestNoPredicateAlwaysAllowsFetch(t *testing.T) {
86 t.Parallel()
87
88 cacheFile := filepath.Join(t.TempDir(), "models_dev.json")
89 fetched, fetch := trackingFetcher()
90 store, err := NewStore(WithCache(cacheFile), WithFetcher(fetch))
91 require.NoError(t, err)
92
93 _, _ = store.GetModel(expiredContext(t), NewID("mistral_gateway", "mistral-small-latest"))
94 assert.True(t, *fetched, "with no predicate, any provider may trigger a fetch")
95}
96
97// TestFetchDisallowedServesFromCache checks the cache-only path: a provider the
98// predicate rejects but that IS present in the on-disk cache resolves from the

Callers

nothing calls this directly

Calls 7

GetModelMethod · 0.95
trackingFetcherFunction · 0.85
WithFetcherFunction · 0.85
expiredContextFunction · 0.85
NewIDFunction · 0.85
NewStoreFunction · 0.70
WithCacheFunction · 0.70

Tested by

no test coverage detected