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

Function TestCreateErrorFromDaemon

cli/command/plugin/create_test.go:92–107  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

90}
91
92func TestCreateErrorFromDaemon(t *testing.T) {
93 tmpDir := fs.NewDir(t, "plugin-create-test",
94 fs.WithDir("rootfs"),
95 fs.WithFile("config.json", `{ "Name": "plugin-foo" }`))
96 defer tmpDir.Remove()
97
98 cmd := newCreateCommand(test.NewFakeCli(&fakeClient{
99 pluginCreateFunc: func(createContext io.Reader, createOptions client.PluginCreateOptions) (client.PluginCreateResult, error) {
100 return client.PluginCreateResult{}, errors.New("error creating plugin")
101 },
102 }))
103 cmd.SetArgs([]string{"plugin-foo", tmpDir.Path()})
104 cmd.SetOut(io.Discard)
105 cmd.SetErr(io.Discard)
106 assert.ErrorContains(t, cmd.Execute(), "error creating plugin")
107}
108
109func TestCreatePlugin(t *testing.T) {
110 tmpDir := fs.NewDir(t, "plugin-create-test",

Callers

nothing calls this directly

Calls 6

SetArgsMethod · 0.80
newCreateCommandFunction · 0.70
RemoveMethod · 0.65
PathMethod · 0.65
SetOutMethod · 0.45
SetErrMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…