MCPcopy
hub / github.com/kubernetes/node-problem-detector / TestTomb

Function TestTomb

pkg/util/tomb/tomb_test.go:24–39  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22)
23
24func TestTomb(t *testing.T) {
25 tomb := NewTomb()
26 workflow := []string{}
27 expected := []string{"stop", "stopping", "stopped"}
28 go func() {
29 defer tomb.Done()
30 <-tomb.Stopping()
31 workflow = append(workflow, "stopping")
32 }()
33 workflow = append(workflow, "stop")
34 tomb.Stop()
35 workflow = append(workflow, "stopped")
36 if !reflect.DeepEqual(workflow, expected) {
37 t.Errorf("expected workflow %v, got %v", expected, workflow)
38 }
39}

Callers

nothing calls this directly

Calls 4

DoneMethod · 0.95
StoppingMethod · 0.95
StopMethod · 0.95
NewTombFunction · 0.85

Tested by

no test coverage detected