-
Notifications
You must be signed in to change notification settings - Fork 21
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 tests #369
Fix flaky tests #369
Conversation
body string | ||
} | ||
|
||
func createDataQueriesForTests(tsdbQueries []tsdbQuery) []backend.DataQuery { |
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.
Alternatively I could create a second helper that takes an array, but the map sort of implies that it should take multiple queries.
"name": "HTTP GET /dispatch", | ||
"startTime": "2023-10-18T07:58:37.818589Z", | ||
"links": [], | ||
} |
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.
I just changed the indents on this to be easier to read.
pkg/opensearch/lucene_handler.go
Outdated
operations := make([]string, 0, len(operationMap)) | ||
for op := range operationMap { | ||
operations = append(operations, op) | ||
} | ||
slices.Sort(operations) |
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.
I feel like if sorting the operations benefitted users in someway it might make sense to do this, but if I understand correctly this is always going to be rendered as a graph where sorting won't really matter. I would vote we try sorting in the test if that's possible?
What this PR does / why we need it:
Due to backend.Responses being a map, we end up getting the services/operations in an inconsistent order when we have multiple responses. This makes some of the tests flaky (test 1 and test 2). One fix for that is just sorting the operations and services (done in this pr), though if we think that's too expensive (I don't think we should have that many of them?) we could also try to rework the tests, though considering that one of them involves checking a big json string that could either be a bit complex or just involve not using 2 responses (though that reduces the test coverage).
The other change was to avoid a seg fault in
TestProcessTraceListAndTraceSpansResponse
, which was happening because the helper that generated the test queries used a map and was unordered. Changed to an array.Which issue(s) this PR fixes:
Fixes #368
Special notes for your reviewer: