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

metric_calculator_test is failing on ARM #38205

Closed
atoulme opened this issue Feb 25, 2025 · 6 comments · Fixed by #38431
Closed

metric_calculator_test is failing on ARM #38205

atoulme opened this issue Feb 25, 2025 · 6 comments · Fixed by #38431
Labels
arm64 Issues related to arm64 architecture bug Something isn't working ci-cd CI, CD, testing, build issues internal/aws

Comments

@atoulme
Copy link
Contributor

atoulme commented Feb 25, 2025

Description

=== FAIL: . TestSweep (0.00s)
make[1]: *** Waiting for unfinished jobs....
    metric_calculator_test.go:276: 
        	Error Trace:	/home/runner/work/opentelemetry-collector-contrib/opentelemetry-collector-contrib/internal/aws/metrics/metric_calculator_test.go:276
        	Error:      	"1.892346ms" is not less than or equal to "1ms"
        	Test:       	TestSweep

=== FAIL: . TestSweep (re-run 1) (0.00s)
    metric_calculator_test.go:276: 
        	Error Trace:	/home/runner/work/opentelemetry-collector-contrib/opentelemetry-collector-contrib/internal/aws/metrics/metric_calculator_test.go:276
        	Error:      	"1.9[58](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/13532271051/job/37816975925?pr=38204#step:7:59)426ms" is not less than or equal to "1ms"
        	Test:       	TestSweep

https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/13532271051/job/37816975925?pr=38204

@atoulme atoulme added bug Something isn't working needs triage New item requiring triage arm64 Issues related to arm64 architecture internal/aws ci-cd CI, CD, testing, build issues and removed needs triage New item requiring triage labels Feb 25, 2025
Copy link
Contributor

Pinging code owners for internal/aws: @Aneurysm9 @mxiamxia. See Adding Labels via Comments if you do not have permissions to add labels yourself. For example, comment '/label priority:p2 -needs-triaged' to set the priority and remove the needs-triaged label.

@dehaansa
Copy link
Contributor

From what I am reading, line 276 here doesn't appear to be an effective test, due to the behavior of the time.NewTicker used in mwe.Sweep.

According to the go source the time returned on the ticker.C channel is always the expected time from the ticker, even if it was not able to schedule to send at that time. This means that line 276 isn't really testing the behavior of the code, just the behavior of the scheduler.

for i := 1; i <= 2; i++ {
	// sweepTime is the time that the internal ticker _expected_ to tick, may not be close (1ms) to the current time
	sweepTime := <-sweepEvent
	// tickTime is the time since test start plus the # of expected ticks
	tickTime := time.Since(start) + mwe.ttl*time.Duration(i)
	require.False(t, closed.Load())
	// This is asserting that the ttl is less than or equal to the time since the start captured before the mwe.sweep function was called,
	// so it's asserting that time consumed until now is greater than one ttl. Should probably be ttl * i, and tickTime should just be time.Since(start)
	assert.LessOrEqual(t, mwe.ttl, tickTime)
	// This is asserting that the time since the _expected_ current tick time is less than or equal to the ttl.
	// This is just testing if the internal timer got to schedule its tick well, and isn't late? This is go runtime behavior, not MWE behavior.
	assert.LessOrEqual(t, time.Since(sweepTime), mwe.ttl)
}

@atoulme
Copy link
Contributor Author

atoulme commented Mar 5, 2025

What should we do @dehaansa ?

@dehaansa
Copy link
Contributor

dehaansa commented Mar 6, 2025

What should we do @dehaansa ?

I was hoping for some codeowner input, as my read of this could be incorrect. I would be in favor of just removing the last assert in this test, and a small modification to the second to last assert. I'll make a proposed fix PR.

@dehaansa
Copy link
Contributor

dehaansa commented Mar 6, 2025

Proposed change, waiting for tests to validate. #38431

@atoulme
Copy link
Contributor Author

atoulme commented Mar 6, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arm64 Issues related to arm64 architecture bug Something isn't working ci-cd CI, CD, testing, build issues internal/aws
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants