-
Notifications
You must be signed in to change notification settings - Fork 103
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
exporter/collector/integrationtest: fix lack of sort expectFixture fields #445
Conversation
cc: @dashpole |
gotcha. This change should be don't flaky. |
@@ -72,14 +72,23 @@ func TestMetrics(t *testing.T) { | |||
fixture, | |||
expectFixture, | |||
func(i, j int) bool { | |||
return fixture.CreateTimeSeriesRequests[i].Name > fixture.CreateTimeSeriesRequests[j].Name | |||
return fixture.CreateTimeSeriesRequests[i].Name < fixture.CreateTimeSeriesRequests[j].Name |
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.
change to not reverse sort
still fail... |
Fix: GoogleCloudPlatform#421 Signed-off-by: Koichi Shiraishi <[email protected]>
added pre-sorting. |
/gcbrun |
sort.Slice(expectFixture.CreateTimeSeriesRequests, func(i, j int) bool { | ||
return expectFixture.CreateTimeSeriesRequests[i].Name < expectFixture.CreateTimeSeriesRequests[j].Name | ||
}) | ||
sort.Slice(expectFixture.CreateMetricDescriptorRequests, func(i, j int) bool { | ||
return expectFixture.CreateMetricDescriptorRequests[i].Name < expectFixture.CreateMetricDescriptorRequests[j].Name | ||
}) | ||
sort.Slice(expectFixture.CreateServiceTimeSeriesRequests, func(i, j int) bool { | ||
return expectFixture.CreateServiceTimeSeriesRequests[i].Name < expectFixture.CreateServiceTimeSeriesRequests[j].Name | ||
}) |
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.
do you need these sorts? or does just adding the expectFixture
sorts in the call to DiffMetricProtos
fix it? Just seems like you're sorting twice
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.
yep, I don't know why, But needs sort twice. If removed, flaky again.
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 tried go test -run=30 ./..., if removed above line, fail on my local machine.
sort.Slice(fixture.CreateTimeSeriesRequests, func(i, j int) bool { | ||
return fixture.CreateTimeSeriesRequests[i].Name < fixture.CreateTimeSeriesRequests[j].Name | ||
}) | ||
sort.Slice(fixture.CreateMetricDescriptorRequests, func(i, j int) bool { | ||
return fixture.CreateMetricDescriptorRequests[i].Name < fixture.CreateMetricDescriptorRequests[j].Name | ||
}) | ||
sort.Slice(fixture.CreateServiceTimeSeriesRequests, func(i, j int) bool { | ||
return fixture.CreateServiceTimeSeriesRequests[i].Name < fixture.CreateServiceTimeSeriesRequests[j].Name | ||
}) |
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.
same as above
Signed-off-by: Koichi Shiraishi <[email protected]>
@damemi try to remove less func |
@damemi seems passes?(still not sure why cmpopts not sorted... |
/gcbrun |
@damemi still running |
@zchee yeah that's a known bug right now in CI reporting, looks good to me, I'll merge |
@damemi Thanks! at least current main branch's tests are green. I hope this PR solved the flaky. |
Same issue as fixed in GoogleCloudPlatform#445, however that was just fixed for the test itself (the issue still existed for recording new fixtures)
* Add Makefile target to generate test fixtures * update fixtures * Add sorting to metrics record fixtures Same issue as fixed in #445, however that was just fixed for the test itself (the issue still existed for recording new fixtures) * record fixtures
exporter/collector/integrationtest: fix lack of sort
expectFixture
fields.Fix: #421