(t *testing.T)
| 308 | } |
| 309 | |
| 310 | func TestRunPluginHooksErrorHooks(t *testing.T) { |
| 311 | cfg := configfile.New("") |
| 312 | cfg.Plugins = map[string]map[string]string{ |
| 313 | "test-plugin": {"error-hooks": "build"}, |
| 314 | } |
| 315 | provider := &fakeConfigProvider{cfg: cfg} |
| 316 | root := &cobra.Command{Use: "docker"} |
| 317 | sub := &cobra.Command{Use: "build"} |
| 318 | root.AddCommand(sub) |
| 319 | |
| 320 | // Should not panic — error-hooks with error message |
| 321 | RunPluginHooks(context.Background(), provider, root, sub, []string{"build"}, "exit status 1") |
| 322 | |
| 323 | // Should not panic — error-hooks with no error (should be skipped) |
| 324 | RunPluginHooks(context.Background(), provider, root, sub, []string{"build"}, "") |
| 325 | } |
| 326 | |
| 327 | func TestInvokeAndCollectHooksErrorHooksSkippedOnSuccess(t *testing.T) { |
| 328 | cfg := configfile.New("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…