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

Function TestRunPluginHooksErrorHooks

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

Source from the content-addressed store, hash-verified

308}
309
310func 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
327func TestInvokeAndCollectHooksErrorHooksSkippedOnSuccess(t *testing.T) {
328 cfg := configfile.New("")

Callers

nothing calls this directly

Calls 1

RunPluginHooksFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…