-
Notifications
You must be signed in to change notification settings - Fork 368
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
[test] Wait for AsyncTraceWriter to finish sending traces #1422
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1422 +/- ##
==========================================
- Coverage 98.13% 98.13% -0.01%
==========================================
Files 771 771
Lines 36929 36930 +1
==========================================
Hits 36242 36242
- Misses 687 688 +1
Continue to review full report at Codecov.
|
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.
Big thanks for fixing this. I had seen it, but ended up not looking into it, but was really getting annoyed. Much ❤️ .
# Are there more items to be processed next? | ||
def work_pending? | ||
!buffer.empty? | ||
end |
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'm a big fan of self-describing code. If we like the comment, why not turning this into def more_items_to_be_proccessed?
or similar? :)
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 do agree that comments <<< well-named-things.
I mean, isn't "more_items_to_be_processed?" =~ "work_pending?" 😄 I think the main issue is that, like all things complex, there's nuance that would be hard to capture in the name.
Maybe "more_items_to_be_processed?" or similar would be better, but I'm sneaking away with the ✅ for now for the non-flaky CI.
This PR addresses an old, but recently more pronounced flaky test, regarding a
Datadog::Workers::AsyncTraceWriter
test.This this was trying to wait until the writer had flushed all data, but instead, was waiting until the writer had started processing all traces (by calling
#work_pending?
).#work_pending?
is used internally by the writer to know if there are traces queued to be process, thus allowing the tracer to either go on a busy processing loop, or sleep for a short bit. This behaviour describes correctly if "Is there more work to be done next?", which is exactly what it represents, but does not answer "Is all the work done?".This PR waits for the tracer to completely finish its work before verifying the desired conditions.
There's no impact on the correctness of the
AsyncTraceWriter
, as it is behaving as expected.