MCPcopy Create free account
hub / github.com/docker/cli / TestInvokeAndCollectHooksCancelledContext

Function TestInvokeAndCollectHooksCancelledContext

cli-plugins/manager/hooks_test.go:358–375  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

356}
357
358func 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}

Callers

nothing calls this directly

Calls 1

invokeAndCollectHooksFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…