MCPcopy Index your code
hub / github.com/docker/docker-agent / TestExecutorHasIsGeneric

Function TestExecutorHasIsGeneric

pkg/hooks/dispatch_test.go:45–69  ·  view source on GitHub ↗

TestExecutorHasIsGeneric exercises the generic Has API across every event kind to ensure compileEvents is wired correctly. It guards against regressions where adding a new event to the Config struct silently fails to surface in Has/Dispatch.

(t *testing.T)

Source from the content-addressed store, hash-verified

43// against regressions where adding a new event to the Config struct
44// silently fails to surface in Has/Dispatch.
45func TestExecutorHasIsGeneric(t *testing.T) {
46 t.Parallel()
47
48 // Empty config: no event has hooks.
49 empty := NewExecutor(nil, "/tmp", nil)
50 for ev := range onlyHooks {
51 assert.Falsef(t, empty.Has(ev), "empty executor must not report Has(%s)", ev)
52 }
53
54 // Cross-product: configuring event ev must light up Has(ev) and
55 // only Has(ev).
56 for ev, cfg := range onlyHooks {
57 exec := NewExecutor(cfg, "/tmp", nil)
58 for other := range onlyHooks {
59 if other == ev {
60 assert.Truef(t, exec.Has(other), "configuring %s must light up Has(%s)", ev, other)
61 } else {
62 assert.Falsef(t, exec.Has(other), "configuring %s must NOT light up Has(%s)", ev, other)
63 }
64 }
65 }
66
67 // Unknown events fall through cleanly rather than panicking.
68 assert.False(t, empty.Has(EventType("does-not-exist")))
69}

Callers

nothing calls this directly

Calls 3

HasMethod · 0.95
NewExecutorFunction · 0.85
EventTypeTypeAlias · 0.70

Tested by

no test coverage detected