Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions pkg/alertmanager/multitenant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1325,18 +1325,15 @@ func TestMultitenantAlertmanager_SyncOnRingTopologyChanges(t *testing.T) {
return ringDesc, true, nil
}))

// Assert if we expected a sync or not.
// Assert if we expected an additional sync or not.
expectedSyncs := 1
if tt.expected {
test.Poll(t, time.Second, float64(2), func() interface{} {
metrics := regs.BuildMetricFamiliesPerUser()
return metrics.GetSumOfCounters("cortex_alertmanager_sync_configs_total")
})
} else {
time.Sleep(250 * time.Millisecond)

metrics := regs.BuildMetricFamiliesPerUser()
assert.Equal(t, float64(1), metrics.GetSumOfCounters("cortex_alertmanager_sync_configs_total"))
expectedSyncs++
}
test.Poll(t, 5*time.Second, float64(expectedSyncs), func() interface{} {
metrics := regs.BuildMetricFamiliesPerUser()
return metrics.GetSumOfCounters("cortex_alertmanager_sync_configs_total")
})
})
}
}
Expand Down