MCPcopy Index your code
hub / github.com/docker/cli / makeFakeCli

Function makeFakeCli

cli/command/context/create_test.go:18–50  ·  view source on GitHub ↗
(t *testing.T, opts ...func(*test.FakeCli))

Source from the content-addressed store, hash-verified

16)
17
18func makeFakeCli(t *testing.T, opts ...func(*test.FakeCli)) *test.FakeCli {
19 t.Helper()
20 dir := t.TempDir()
21 storeConfig := store.NewConfig(
22 func() any { return &command.DockerContext{} },
23 store.EndpointTypeGetter(docker.DockerEndpoint, func() any { return &docker.EndpointMeta{} }),
24 )
25 contextStore := &command.ContextStoreWithDefault{
26 Store: store.New(dir, storeConfig),
27 Resolver: func() (*command.DefaultContext, error) {
28 return &command.DefaultContext{
29 Meta: store.Metadata{
30 Endpoints: map[string]any{
31 docker.DockerEndpoint: docker.EndpointMeta{
32 Host: "unix:///var/run/docker.sock",
33 },
34 },
35 Metadata: command.DockerContext{
36 Description: "",
37 },
38 Name: command.DefaultContextName,
39 },
40 TLS: store.ContextTLSData{},
41 }, nil
42 },
43 }
44 result := test.NewFakeCli(nil, opts...)
45 for _, o := range opts {
46 o(result)
47 }
48 result.SetContextStore(contextStore)
49 return result
50}
51
52func withCliConfig(configFile *configfile.ConfigFile) func(*test.FakeCli) {
53 return func(m *test.FakeCli) {

Callers 15

TestInspectFunction · 0.85
TestCreateFunction · 0.85
TestCreateFromContextFunction · 0.85
TestCreateFromCurrentFunction · 0.85
TestExportImportWithFileFunction · 0.85
TestExportImportPipeFunction · 0.85
TestExportExistingFileFunction · 0.85
TestShowFunction · 0.85
TestListFunction · 0.85
TestListJSONFunction · 0.85
TestListQuietFunction · 0.85

Calls 1

SetContextStoreMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…