Skip to content
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

Merged
merged 2 commits into from
Jun 29, 2022

Conversation

zchee
Copy link
Contributor

@zchee zchee commented Jun 28, 2022

exporter/collector/integrationtest: fix lack of sort expectFixture fields.

Fix: #421

@zchee
Copy link
Contributor Author

zchee commented Jun 28, 2022

cc: @dashpole

@zchee zchee changed the title exporter/collector/integrationtest: fix lack of sort expectFixture field exporter/collector/integrationtest: fix lack of sort expectFixture fields Jun 28, 2022
@zchee
Copy link
Contributor Author

zchee commented Jun 28, 2022

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
Copy link
Contributor Author

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

@zchee
Copy link
Contributor Author

zchee commented Jun 28, 2022

still fail...

@zchee zchee marked this pull request as draft June 28, 2022 19:22
@zchee
Copy link
Contributor Author

zchee commented Jun 28, 2022

added pre-sorting.

@zchee zchee marked this pull request as ready for review June 28, 2022 19:26
@damemi
Copy link
Contributor

damemi commented Jun 28, 2022

/gcbrun

Comment on lines +62 to +70
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
})
Copy link
Contributor

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

Copy link
Contributor Author

@zchee zchee Jun 28, 2022

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.

Copy link
Contributor Author

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.

Comment on lines +80 to +88
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
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

@zchee
Copy link
Contributor Author

zchee commented Jun 28, 2022

@damemi try to remove less func

@zchee
Copy link
Contributor Author

zchee commented Jun 28, 2022

@damemi seems passes?(still not sure why cmpopts not sorted...

@zchee zchee requested a review from damemi June 28, 2022 21:17
@damemi
Copy link
Contributor

damemi commented Jun 28, 2022

/gcbrun

@zchee
Copy link
Contributor Author

zchee commented Jun 29, 2022

@damemi still running gcbrun. Is it intended? (5 hours ago

@damemi
Copy link
Contributor

damemi commented Jun 29, 2022

@zchee yeah that's a known bug right now in CI reporting, looks good to me, I'll merge

@damemi damemi merged commit f69b19f into GoogleCloudPlatform:main Jun 29, 2022
@zchee
Copy link
Contributor Author

zchee commented Jun 29, 2022

@damemi Thanks! at least current main branch's tests are green. I hope this PR solved the flaky.

@zchee zchee deleted the fix-421-again branch June 29, 2022 12:02
damemi added a commit to damemi/opentelemetry-operations-go that referenced this pull request Jul 26, 2022
Same issue as fixed in GoogleCloudPlatform#445, however
that was just fixed for the test itself (the issue still existed for recording new fixtures)
damemi added a commit that referenced this pull request Jul 26, 2022
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix expected diff check in integration tests
2 participants