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

Fix flaky test - TestSpanProcessorWithOnDroppedSpanOption #4451

Closed
wants to merge 1 commit into from

Conversation

ChenX1993
Copy link
Contributor

Which problem is this PR solving?

Resolves #4450

Short description of the changes

Due to concurrency, it is not guaranteed that which one of the second span and third span will be dropped in the test or both could be dropped. But it is guaranteed that at least one of them will be dropped.

Update the test to set a boolean flag when any span is dropped.
Welcome to suggestion!

@ChenX1993 ChenX1993 requested a review from a team as a code owner May 10, 2023 06:31
@ChenX1993 ChenX1993 requested a review from albertteoh May 10, 2023 06:31
Signed-off-by: Chen Xu <chen.x@uber.com>
@codecov
Copy link

codecov bot commented May 10, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.01 🎉

Comparison is base (5c3c20d) 97.07% compared to head (50ea77e) 97.09%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4451      +/-   ##
==========================================
+ Coverage   97.07%   97.09%   +0.01%     
==========================================
  Files         300      300              
  Lines       17728    17728              
==========================================
+ Hits        17210    17213       +3     
+ Misses        416      414       -2     
+ Partials      102      101       -1     
Flag Coverage Δ
unittests 97.09% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -679,5 +680,5 @@ func TestSpanProcessorWithOnDroppedSpanOption(t *testing.T) {
}, processor.SpansOptions{SpanFormat: processor.JaegerSpanFormat})

assert.NoError(t, err)
assert.Equal(t, []string{"op2", "op3"}, droppedOperations)
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest you keep the original test but add an assert.Eventually to ensure the right state, like so:

assert.NoError(t, err)

assert.Eventually(t, func() bool {
	return len(droppedOperations) == 2
}, 5*time.Second, 10*time.Millisecond)

assert.Equal(t, []string{"op2", "op3"}, droppedOperations)

@yurishkuro
Copy link
Member

closing to minimize noise, feel free to reopen if comments are addressed

@yurishkuro yurishkuro closed this May 27, 2023
yurishkuro added a commit that referenced this pull request May 27, 2023
* Resolves #4450
* Alternative to #4451

Signed-off-by: Yuri Shkuro <github@ysh.us>
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.

[Bug]: Flaky Test: TestSpanProcessorWithOnDroppedSpanOption
3 participants