MCPcopy
hub / github.com/marmotedu/iam / TestCallbacksGetCalled

Function TestCallbacksGetCalled

pkg/shutdown/shutdown_test.go:67–85  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

65}
66
67func TestCallbacksGetCalled(t *testing.T) {
68 gs := New()
69
70 c := make(chan int, 100)
71 for i := 0; i < 15; i++ {
72 gs.AddShutdownCallback(ShutdownFunc(func(string) error {
73 c <- 1
74 return nil
75 }))
76 }
77
78 gs.StartShutdown(SMFinishFunc(func() error {
79 return nil
80 }))
81
82 if len(c) != 15 {
83 t.Error("Expected 15 elements in channel, got ", len(c))
84 }
85}
86
87func TestStartGetsCalled(t *testing.T) {
88 gs := New()

Callers

nothing calls this directly

Calls 6

ShutdownFuncFuncType · 0.85
SMFinishFuncFuncType · 0.85
NewFunction · 0.70
AddShutdownCallbackMethod · 0.65
StartShutdownMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…