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

Function TestDeltaFIFO_detectLineJumpers

tools/cache/delta_fifo_test.go:358–384  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

356}
357
358func TestDeltaFIFO_detectLineJumpers(t *testing.T) {
359 f := NewDeltaFIFO(testFifoObjectKeyFunc, nil)
360
361 f.Add(mkFifoObj("foo", 10))
362 f.Add(mkFifoObj("bar", 1))
363 f.Add(mkFifoObj("foo", 11))
364 f.Add(mkFifoObj("foo", 13))
365 f.Add(mkFifoObj("zab", 30))
366
367 if e, a := 13, testPop(f).val; a != e {
368 t.Fatalf("expected %d, got %d", e, a)
369 }
370
371 f.Add(mkFifoObj("foo", 14)) // ensure foo doesn't jump back in line
372
373 if e, a := 1, testPop(f).val; a != e {
374 t.Fatalf("expected %d, got %d", e, a)
375 }
376
377 if e, a := 30, testPop(f).val; a != e {
378 t.Fatalf("expected %d, got %d", e, a)
379 }
380
381 if e, a := 14, testPop(f).val; a != e {
382 t.Fatalf("expected %d, got %d", e, a)
383 }
384}
385
386func TestDeltaFIFO_addIfNotPresent(t *testing.T) {
387 f := NewDeltaFIFO(testFifoObjectKeyFunc, nil)

Callers

nothing calls this directly

Calls 4

AddMethod · 0.95
NewDeltaFIFOFunction · 0.85
mkFifoObjFunction · 0.85
testPopFunction · 0.85

Tested by

no test coverage detected