| 90 | } |
| 91 | |
| 92 | func 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 | |
| 109 | func TestCreatePlugin(t *testing.T) { |
| 110 | tmpDir := fs.NewDir(t, "plugin-create-test", |