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

Function TestDeltaFIFO_KeyOf

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

Source from the content-addressed store, hash-verified

412}
413
414func TestDeltaFIFO_KeyOf(t *testing.T) {
415 f := DeltaFIFO{keyFunc: testFifoObjectKeyFunc}
416
417 table := []struct {
418 obj interface{}
419 key string
420 }{
421 {obj: testFifoObject{name: "A"}, key: "A"},
422 {obj: DeletedFinalStateUnknown{Key: "B", Obj: nil}, key: "B"},
423 {obj: Deltas{{Object: testFifoObject{name: "C"}}}, key: "C"},
424 {obj: Deltas{{Object: DeletedFinalStateUnknown{Key: "D", Obj: nil}}}, key: "D"},
425 }
426
427 for _, item := range table {
428 got, err := f.KeyOf(item.obj)
429 if err != nil {
430 t.Errorf("Unexpected error for %q: %v", item.obj, err)
431 continue
432 }
433 if e, a := item.key, got; e != a {
434 t.Errorf("Expected %v, got %v", e, a)
435 }
436 }
437}
438
439func TestDeltaFIFO_HasSynced(t *testing.T) {
440 tests := []struct {

Callers

nothing calls this directly

Calls 2

KeyOfMethod · 0.95
ErrorfMethod · 0.65

Tested by

no test coverage detected