-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix flaky retention tests #3976
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,7 +66,7 @@ var ( | |
RowShards: 16, | ||
}, | ||
{ | ||
From: dayFromTime(start.Add(49 * time.Hour)), | ||
From: dayFromTime(start.Add(73 * time.Hour)), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this just some arbitrary value? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We want to set the date to |
||
IndexType: "boltdb", | ||
ObjectType: "filesystem", | ||
Schema: "v11", | ||
|
@@ -158,15 +158,13 @@ func (t *testStore) indexTables() []table { | |
} | ||
|
||
func (t *testStore) HasChunk(c chunk.Chunk) bool { | ||
t.t.Helper() | ||
var matchers []*labels.Matcher | ||
for _, l := range c.Metric { | ||
matchers = append(matchers, labels.MustNewMatcher(labels.MatchEqual, l.Name, l.Value)) | ||
chunks := t.GetChunks(c.UserID, c.From, c.Through, c.Metric) | ||
|
||
chunkIDs := make(map[string]struct{}) | ||
for _, chk := range chunks { | ||
chunkIDs[chk.ExternalKey()] = struct{}{} | ||
} | ||
chunks, err := t.Store.Get(user.InjectOrgID(context.Background(), c.UserID), | ||
c.UserID, c.From, c.Through, matchers...) | ||
require.NoError(t.t, err) | ||
return len(chunks) == 1 && c.ExternalKey() == chunks[0].ExternalKey() | ||
return len(chunkIDs) == 1 && c.ExternalKey() == chunks[0].ExternalKey() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could get multiple chunk ids if the chunk overlaps multiple schema configs because the Cortex code dedupes chunk ids within a store, not across the stores. This change dedupes the chunk ids before checking for having single expected chunk id in the response. |
||
} | ||
|
||
func (t *testStore) GetChunks(userID string, from, through model.Time, metric labels.Labels) []chunk.Chunk { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The schema start date for this and the previous one is too close with just a days gap. Based on when the tests run, when we add
24h
> duration <48h
tostart
, it could result in jumping ahead by 2 days and end up falling into this schema instead of the previous one. For example, ifstart
is9th Jun 2300 hours
and we add28h
like the test here, we would fall intoConfig[2]
as opposed to what the test expects i.eConfig[1]
.