(t *testing.T)
| 277 | } |
| 278 | |
| 279 | func TestDeltaFIFO_ReplaceMakesDeletions(t *testing.T) { |
| 280 | f := NewDeltaFIFO( |
| 281 | testFifoObjectKeyFunc, |
| 282 | keyLookupFunc(func() []testFifoObject { |
| 283 | return []testFifoObject{mkFifoObj("foo", 5), mkFifoObj("bar", 6), mkFifoObj("baz", 7)} |
| 284 | }), |
| 285 | ) |
| 286 | f.Delete(mkFifoObj("baz", 10)) |
| 287 | f.Replace([]interface{}{mkFifoObj("foo", 5)}, "0") |
| 288 | |
| 289 | expectedList := []Deltas{ |
| 290 | {{Deleted, mkFifoObj("baz", 10)}}, |
| 291 | {{Sync, mkFifoObj("foo", 5)}}, |
| 292 | // Since "bar" didn't have a delete event and wasn't in the Replace list |
| 293 | // it should get a tombstone key with the right Obj. |
| 294 | {{Deleted, DeletedFinalStateUnknown{Key: "bar", Obj: mkFifoObj("bar", 6)}}}, |
| 295 | } |
| 296 | |
| 297 | for _, expected := range expectedList { |
| 298 | cur := Pop(f).(Deltas) |
| 299 | if e, a := expected, cur; !reflect.DeepEqual(e, a) { |
| 300 | t.Errorf("Expected %#v, got %#v", e, a) |
| 301 | } |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | func TestDeltaFIFO_UpdateResyncRace(t *testing.T) { |
| 306 | f := NewDeltaFIFO( |
nothing calls this directly
no test coverage detected