mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
test(store/event_test): add a test for a full queue
This commit is contained in:
parent
317b34f4a0
commit
e1d909eb0e
@ -64,3 +64,23 @@ func TestScanHistory(t *testing.T) {
|
|||||||
t.Fatalf("bad index shoud reuturn nil")
|
t.Fatalf("bad index shoud reuturn nil")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TestFullEventQueue tests a queue with capacity = 10
|
||||||
|
// Add 1000 events into that queue, and test if scanning
|
||||||
|
// works still for previous events.
|
||||||
|
func TestFullEventQueue(t *testing.T) {
|
||||||
|
|
||||||
|
eh := newEventHistory(10)
|
||||||
|
|
||||||
|
// Add
|
||||||
|
for i := 0; i < 1000; i++ {
|
||||||
|
e := newEvent(Create, "/foo", uint64(i), uint64(i))
|
||||||
|
eh.addEvent(e)
|
||||||
|
e, err := eh.scan("/foo", true, uint64(i-1))
|
||||||
|
if i > 0 {
|
||||||
|
if e == nil || err != nil {
|
||||||
|
t.Fatalf("scan error [/foo] [%v] %v", i-1, i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user