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 <cyril.tovena@gmail.com>
pull/3835/head
Cyril Tovena 4 years ago committed by GitHub
parent 22c4b072a0
commit 7e658e8766
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      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)
}
})

Loading…
Cancel
Save