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

Function TestDeleteCallsPush

tools/cache/undelta_store_test.go:70–93  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

68}
69
70func TestDeleteCallsPush(t *testing.T) {
71 mkObj := func(name string, val interface{}) testUndeltaObject {
72 return testUndeltaObject{name: name, val: val}
73 }
74
75 var got []interface{}
76 var callcount int = 0
77 push := func(m []interface{}) {
78 callcount++
79 got = m
80 }
81
82 u := NewUndeltaStore(push, testUndeltaKeyFunc)
83
84 u.Add(mkObj("a", 2))
85 u.Delete(mkObj("a", ""))
86 if callcount != 2 {
87 t.Errorf("Expected 2 calls, got %d", callcount)
88 }
89 expected := []interface{}{}
90 if !reflect.DeepEqual(expected, got) {
91 t.Errorf("Expected %#v, Got %#v", expected, got)
92 }
93}
94
95func TestReadsDoNotCallPush(t *testing.T) {
96 push := func(m []interface{}) {

Callers

nothing calls this directly

Calls 4

AddMethod · 0.95
DeleteMethod · 0.95
NewUndeltaStoreFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected