(t *testing.T)
| 356 | } |
| 357 | |
| 358 | func TestInvokeAndCollectHooksCancelledContext(t *testing.T) { |
| 359 | cfg := configfile.New("") |
| 360 | cfg.Plugins = map[string]map[string]string{ |
| 361 | "test-plugin": {"hooks": "build"}, |
| 362 | } |
| 363 | root := &cobra.Command{Use: "docker"} |
| 364 | sub := &cobra.Command{Use: "build"} |
| 365 | root.AddCommand(sub) |
| 366 | |
| 367 | ctx, cancel := context.WithCancel(context.Background()) |
| 368 | cancel() // cancel immediately |
| 369 | |
| 370 | result := invokeAndCollectHooks( |
| 371 | ctx, cfg, root, sub, |
| 372 | "build", map[string]string{}, "exit status 1", |
| 373 | ) |
| 374 | assert.Check(t, is.Nil(result)) |
| 375 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…