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

maint: attempt to fix flaky integration tests #945

Merged
merged 2 commits into from
Dec 13, 2023
Merged

Conversation

VinozzZ
Copy link
Contributor

@VinozzZ VinozzZ commented Dec 12, 2023

Which problem is this PR solving?

Since sending a trace is an asynchronous operation, there's a race condition between the writes from libhoney to the transmission buffer and the reads issued from our tests into the buffer.

Short description of the changes

This PR changes tests to use transmission.MockSender instead. The mock sender uses a slice instead of an io.Writer as the buffer. This allows us to avoid race condition between reads and writes.

I also added a wait after sending the roundtrip request to make sure Refinery has a chance to flush its in-memory trace cache before we try to validate the sent trace.

@VinozzZ VinozzZ requested a review from a team as a code owner December 12, 2023 23:25
Copy link
Contributor

@kentquirk kentquirk left a comment

Choose a reason for hiding this comment

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

Oh! You found a MockSender, which I hope is less flaky. Nice.

@VinozzZ VinozzZ merged commit 4deed27 into main Dec 13, 2023
4 checks passed
@VinozzZ VinozzZ deleted the yingrong.fix_flaky_tests branch December 13, 2023 15:07
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.

2 participants