From a9fbfec8d60dd62f94578a773056704c6d02551d Mon Sep 17 00:00:00 2001 From: Peter Dannemann <28637185+petedannemann@users.noreply.github.com> Date: Tue, 10 Oct 2023 17:19:12 -0400 Subject: [PATCH] stop flaky test failures (#159) * add sleep to stop flaky test failures * remove unused import * fix sleep * fix retry instead of sleeping * improve checks * remove duplicate code * use one retry --- pkg/admin/brokerclient_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/admin/brokerclient_test.go b/pkg/admin/brokerclient_test.go index d998df84..7b181d7b 100644 --- a/pkg/admin/brokerclient_test.go +++ b/pkg/admin/brokerclient_test.go @@ -455,10 +455,18 @@ func TestBrokerClientAlterAssignments(t *testing.T) { topicInfo, err = client.GetTopic(ctx, topicName, true) require.NoError(t, err) + // Alter partition succeeded if topicInfo.Partitions[2].Replicas[0] != 5 { return fmt.Errorf("Assign partitions change not reflected yet") } + // ISR shrink completed + for _, partition := range topicInfo.Partitions { + if len(partition.Replicas) != 2 { + return fmt.Errorf("Assign partitions change not reflected yet") + } + } + return nil })