Skip to content

Commit

Permalink
Simplify testWatch
Browse files Browse the repository at this point in the history
  • Loading branch information
errordeveloper committed Dec 17, 2021
1 parent 1dd4d4f commit 94321b2
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions testutils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,12 @@ func testWatch(t *testing.T, kv store.Store) {

// Update loop
go func() {
timeout := time.After(1 * time.Second)
tick := time.Tick(250 * time.Millisecond)
for {
select {
case <-timeout:
return
case <-tick:
err := kv.Put(key, newValue, nil)
if assert.NoError(t, err) {
continue
}
for i := 0; i < 4; i++ {
err := kv.Put(key, newValue, nil)
if !assert.NoError(t, err) {
return
}
time.Sleep(50 * time.Microsecond)
}
}()

Expand Down

0 comments on commit 94321b2

Please sign in to comment.