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

Function withTestConfig

cmd/root/models_test.go:58–63  ·  view source on GitHub ↗

withTestConfig injects a hermetic env provider and an in-memory models.dev store into the models command. It keeps listing side-effect-free: without it the real env provider chain shells out to the OS keychain / pass / 1Password for every missing API key and the store fetches https://models.dev, mak

(env map[string]string)

Source from the content-addressed store, hash-verified

56// for every missing API key and the store fetches https://models.dev, making
57// the tests slow and non-parallelizable.
58func withTestConfig(env map[string]string) modelsCmdOption {
59 return func(rc *config.RuntimeConfig) {
60 rc.EnvProviderForTests = environment.NewMapEnvProvider(env)
61 rc.ModelsDevStoreOverride = modelsdev.NewDatabaseStore(testCatalog())
62 }
63}
64
65func TestModelsListCommand_DefaultOutput(t *testing.T) {
66 t.Parallel()

Calls 3

NewMapEnvProviderFunction · 0.92
NewDatabaseStoreFunction · 0.92
testCatalogFunction · 0.85

Tested by

no test coverage detected