Skip to content

Commit

Permalink
Fix flaky ring downscale handler test (#9055)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhalterman authored Aug 19, 2024
1 parent 26a9634 commit 61dd68b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/ingester/downscale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestIngester_PrepareInstanceRingDownscaleHandler(t *testing.T) {
ingester, r := setup(true)

// Pre-condition: entry is not read-only.
test.Poll(t, time.Second, false, func() interface{} {
test.Poll(t, 5*time.Second, false, func() interface{} {
inst, err := r.GetInstance(ingester.lifecycler.ID)
require.NoError(t, err)
return inst.ReadOnly
Expand All @@ -69,7 +69,7 @@ func TestIngester_PrepareInstanceRingDownscaleHandler(t *testing.T) {
require.InDelta(t, time.Now().Unix(), resp.Timestamp, 10)

// Post-condition: entry is read only.
test.Poll(t, time.Second, true, func() interface{} {
test.Poll(t, 5*time.Second, true, func() interface{} {
inst, err := r.GetInstance(ingester.lifecycler.ID)
require.NoError(t, err)
return inst.ReadOnly && inst.ReadOnlyUpdatedTimestamp == resp.Timestamp
Expand All @@ -95,7 +95,7 @@ func TestIngester_PrepareInstanceRingDownscaleHandler(t *testing.T) {
// Switch entry to read-only.
ingester.PrepareInstanceRingDownscaleHandler(res, httptest.NewRequest(http.MethodPost, target, nil))
require.Equal(t, http.StatusOK, res.Code)
test.Poll(t, time.Second, true, func() interface{} {
test.Poll(t, 5*time.Second, true, func() interface{} {
inst, err := r.GetInstance(ingester.lifecycler.ID)
require.NoError(t, err)
return inst.ReadOnly
Expand All @@ -111,7 +111,7 @@ func TestIngester_PrepareInstanceRingDownscaleHandler(t *testing.T) {
require.Equal(t, int64(0), resp.Timestamp)

// Post-condition: entry is not read only.
test.Poll(t, time.Second, false, func() interface{} {
test.Poll(t, 5*time.Second, false, func() interface{} {
inst, err := r.GetInstance(ingester.lifecycler.ID)
require.NoError(t, err)
return inst.ReadOnly
Expand Down

0 comments on commit 61dd68b

Please sign in to comment.