Skip to content

Commit 17a8f98

Browse files
CopilotCharlieTLe
andauthored
Fix flaky TestMultitenantAlertmanager_zoneAwareSharding by waiting for ring convergence (#7854)
* Initial plan * Wait for ring convergence in zoneAwareSharding test to fix flakiness Co-authored-by: CharlieTLe <3375195+CharlieTLe@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: CharlieTLe <3375195+CharlieTLe@users.noreply.github.com>
1 parent f172a5a commit 17a8f98

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎pkg/alertmanager/multitenant_test.go‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,15 @@ func TestMultitenantAlertmanager_zoneAwareSharding(t *testing.T) {
860860
am2ZoneA := createInstance(2, "zoneA", registriesZoneA)
861861
am1ZoneB := createInstance(3, "zoneB", registriesZoneB)
862862

863+
// Wait until every instance's ring client sees all the instances, otherwise
864+
// ownership is computed against a partial ring view and tenants may get
865+
// double-counted.
866+
for _, am := range []*MultitenantAlertmanager{am1ZoneA, am2ZoneA, am1ZoneB} {
867+
test.Poll(t, 5*time.Second, 3, func() any {
868+
return am.ring.InstancesCount()
869+
})
870+
}
871+
863872
{
864873
require.NoError(t, alertStore.SetAlertConfig(ctx, alertspb.AlertConfigDesc{
865874
User: user1,

0 commit comments

Comments
 (0)