MCPcopy Create free account
hub / github.com/docker/cli / TestConfigModification

Function TestConfigModification

cli/context/store/storeconfig_test.go:19–36  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17)
18
19func TestConfigModification(t *testing.T) {
20 cfg := NewConfig(func() any { return &testCtx{} }, EndpointTypeGetter("ep1", func() any { return &testEP1{} }))
21 assert.Equal(t, &testCtx{}, cfg.contextType())
22 assert.Equal(t, &testEP1{}, cfg.endpointTypes["ep1"]())
23 cfgCopy := cfg
24
25 // modify existing endpoint
26 cfg.SetEndpoint("ep1", func() any { return &testEP2{} })
27 // add endpoint
28 cfg.SetEndpoint("ep2", func() any { return &testEP3{} })
29 assert.Equal(t, &testCtx{}, cfg.contextType())
30 assert.Equal(t, &testEP2{}, cfg.endpointTypes["ep1"]())
31 assert.Equal(t, &testEP3{}, cfg.endpointTypes["ep2"]())
32 // check it applied on already initialized store
33 assert.Equal(t, &testCtx{}, cfgCopy.contextType())
34 assert.Equal(t, &testEP2{}, cfgCopy.endpointTypes["ep1"]())
35 assert.Equal(t, &testEP3{}, cfgCopy.endpointTypes["ep2"]())
36}
37
38func TestValidFilePaths(t *testing.T) {
39 paths := map[string]bool{

Callers

nothing calls this directly

Calls 3

SetEndpointMethod · 0.95
NewConfigFunction · 0.85
EndpointTypeGetterFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…