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

Function TestUpdateCallsPush

tools/cache/undelta_store_test.go:44–68  ·  view source on GitHub ↗

* var ( o1 interface{} = t{1} o2 interface{} = t{2} l1 []interface{} = []interface{}{t{1}} ) */

(t *testing.T)

Source from the content-addressed store, hash-verified

42*/
43
44func TestUpdateCallsPush(t *testing.T) {
45 mkObj := func(name string, val interface{}) testUndeltaObject {
46 return testUndeltaObject{name: name, val: val}
47 }
48
49 var got []interface{}
50 var callcount int = 0
51 push := func(m []interface{}) {
52 callcount++
53 got = m
54 }
55
56 u := NewUndeltaStore(push, testUndeltaKeyFunc)
57
58 u.Add(mkObj("a", 2))
59 u.Update(mkObj("a", 1))
60 if callcount != 2 {
61 t.Errorf("Expected 2 calls, got %d", callcount)
62 }
63
64 l := []interface{}{mkObj("a", 1)}
65 if !reflect.DeepEqual(l, got) {
66 t.Errorf("Expected %#v, Got %#v", l, got)
67 }
68}
69
70func TestDeleteCallsPush(t *testing.T) {
71 mkObj := func(name string, val interface{}) testUndeltaObject {

Callers

nothing calls this directly

Calls 4

AddMethod · 0.95
UpdateMethod · 0.95
NewUndeltaStoreFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected