mirror of
https://github.com/status-im/consul.git
synced 2025-01-10 22:06:20 +00:00
Tightens timing up and reorders GC test to be less flaky.
This commit is contained in:
parent
7c6ab5e783
commit
7b966e2d26
@ -23,8 +23,8 @@ func TestTombstoneGC_invalid(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTombstoneGC(t *testing.T) {
|
||||
ttl := 500 * time.Millisecond
|
||||
gran := 200 * time.Millisecond
|
||||
ttl := 20 * time.Millisecond
|
||||
gran := 5 * time.Millisecond
|
||||
gc, err := NewTombstoneGC(ttl, gran)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
@ -38,11 +38,6 @@ func TestTombstoneGC(t *testing.T) {
|
||||
start := time.Now()
|
||||
gc.Hint(100)
|
||||
|
||||
time.Sleep(2*gran + gran/3)
|
||||
start2 := time.Now()
|
||||
gc.Hint(120)
|
||||
gc.Hint(125)
|
||||
|
||||
if !gc.PendingExpiration() {
|
||||
t.Fatalf("should be pending")
|
||||
}
|
||||
@ -61,6 +56,14 @@ func TestTombstoneGC(t *testing.T) {
|
||||
t.Fatalf("should get expiration")
|
||||
}
|
||||
|
||||
start2 := time.Now()
|
||||
gc.Hint(120)
|
||||
gc.Hint(125)
|
||||
|
||||
if !gc.PendingExpiration() {
|
||||
t.Fatalf("should be pending")
|
||||
}
|
||||
|
||||
select {
|
||||
case index := <-gc.ExpireCh():
|
||||
end := time.Now()
|
||||
|
Loading…
x
Reference in New Issue
Block a user