From 7e658e8766ee8601c0474b5644b6c87ca72433f5 Mon Sep 17 00:00:00 2001 From: Cyril Tovena Date: Thu, 10 Jun 2021 09:09:00 +0200 Subject: [PATCH] Fixes a flaky retention test. (#3833) This was due because the condition was using a string array that may be not in correct order. Signed-off-by: Cyril Tovena --- .../stores/shipper/compactor/retention/retention_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/storage/stores/shipper/compactor/retention/retention_test.go b/pkg/storage/stores/shipper/compactor/retention/retention_test.go index 3f7e28906cc1..4799c6b28079 100644 --- a/pkg/storage/stores/shipper/compactor/retention/retention_test.go +++ b/pkg/storage/stores/shipper/compactor/retention/retention_test.go @@ -5,6 +5,7 @@ import ( "crypto/sha256" "encoding/base64" "path/filepath" + "sort" "strconv" "strings" "sync" @@ -156,10 +157,13 @@ func Test_Retention(t *testing.T) { expectDeleted = append(expectDeleted, tt.chunks[i].ExternalKey()) } } + sort.Strings(expectDeleted) store.Stop() if len(expectDeleted) != 0 { require.Eventually(t, func() bool { - return assert.ObjectsAreEqual(expectDeleted, chunkClient.getDeletedChunkIds()) + actual := chunkClient.getDeletedChunkIds() + sort.Strings(actual) + return assert.ObjectsAreEqual(expectDeleted, actual) }, 10*time.Second, 1*time.Second) } })