MCPcopy
hub / github.com/kubernetes/client-go / TestHeapEmptyPop

Function TestHeapEmptyPop

tools/cache/heap_test.go:134–144  ·  view source on GitHub ↗

TestHeapEmptyPop tests that pop returns properly after heap is closed.

(t *testing.T)

Source from the content-addressed store, hash-verified

132
133// TestHeapEmptyPop tests that pop returns properly after heap is closed.
134func TestHeapEmptyPop(t *testing.T) {
135 h := NewHeap(testHeapObjectKeyFunc, compareInts)
136 go func() {
137 time.Sleep(1 * time.Second)
138 h.Close()
139 }()
140 _, err := h.Pop()
141 if err == nil || err.Error() != closedMsg {
142 t.Errorf("pop should have returned heap closed error: %v", err)
143 }
144}
145
146// TestHeap_AddIfNotPresent tests Heap.AddIfNotPresent and ensures that heap
147// invariant is preserved after adding items.

Callers

nothing calls this directly

Calls 6

CloseMethod · 0.95
PopMethod · 0.95
NewHeapFunction · 0.85
SleepMethod · 0.65
ErrorMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected