(t *testing.T, opts ...func(*test.FakeCli))
| 16 | ) |
| 17 | |
| 18 | func 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 | |
| 52 | func withCliConfig(configFile *configfile.ConfigFile) func(*test.FakeCli) { |
| 53 | return func(m *test.FakeCli) { |
no test coverage detected
searching dependent graphs…