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

[connector/spanmetrics] Fix flaky spanmetricsconnector test that relies on timing #33443

Conversation

swar8080
Copy link
Contributor

@swar8080 swar8080 commented Jun 9, 2024

Description:
Tries fixing some flaky unit tests that relied on time.Now() always returning a higher value than the previous call

The solution is reading the current time from a clock.Clock interface. The test relying on ever-increasing Now() values uses a mock that always returns an increasing value.

Link to tracking Issue: #33438

Testing:

  • Ran the component locally to verify the ticker still flushes after the configured duration passes

Closes #33438

@swar8080 swar8080 force-pushed the fix-spanmetricsconnector-test-raceconditions_clock branch from 1b3b604 to d1030ef Compare June 9, 2024 19:41
Copy link
Contributor

@jcreixell jcreixell left a comment

Choose a reason for hiding this comment

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

LGTM

@Frapschen Frapschen added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jun 19, 2024
@crobert-1 crobert-1 added the Run Windows Enable running windows test on a PR label Jun 20, 2024
@crobert-1
Copy link
Member

Failure in connector/servicegraph tests appears to be unrelated to this change, I've filed #33679 to address it.

@dmitryax dmitryax merged commit 501ef8b into open-telemetry:main Jul 2, 2024
170 checks passed
@github-actions github-actions bot added this to the next release milestone Jul 2, 2024
cparkins pushed a commit to AmadeusITGroup/opentelemetry-collector-contrib that referenced this pull request Jul 11, 2024
…es on timing (open-telemetry#33443)

**Description:** <Describe what has changed.>
Tries fixing some flaky unit tests that relied on `time.Now()` always
returning a higher value than the previous call

The solution is reading the current time from a `clock.Clock` interface.
The test relying on ever-increasing `Now()` values uses a mock that
always returns an increasing value.

**Link to tracking Issue:** open-telemetry#33438

**Testing:**
- Ran the component locally to verify the ticker still flushes after the
configured duration passes

Closes open-telemetry#33438
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
connector/spanmetrics Run Windows Enable running windows test on a PR Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[connector/spanmetrics] Unit test failures
7 participants