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 bad await loop in tracer test #911

Merged
merged 1 commit into from
Jan 8, 2020
Merged

Fix bad await loop in tracer test #911

merged 1 commit into from
Jan 8, 2020

Conversation

marcotc
Copy link
Member

@marcotc marcotc commented Jan 8, 2020

The following wait loop does not exist as one would expect:

1000.times do
  mutex.synchronize do
    break unless @thread_ctx.nil? || @thread_span.nil?
  end
  sleep 0.01
end

The break statement is actually breaking out of #synchronize, not #times, meaning this test always runs to its maximum time of around 11s.

This PR replaces this loop with our helper method try_wait_until. I also removed the mutex around the instance variable assignment verification, as instance variable assignment is an atomic VM operation.

This is the slowest single test in our test suite currently.

@marcotc marcotc added the dev/testing Involves testing processes (e.g. RSpec) label Jan 8, 2020
@marcotc marcotc requested a review from a team January 8, 2020 19:52
@marcotc marcotc self-assigned this Jan 8, 2020
Copy link
Contributor

@delner delner left a comment

Choose a reason for hiding this comment

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

Nice! I was wondering what test took so long in the Minitest suite.

@marcotc marcotc merged commit d6b5634 into master Jan 8, 2020
@marcotc marcotc deleted the test/fix-wait-loop branch January 8, 2020 21:37
marcotc added a commit that referenced this pull request Jan 15, 2020
@marcotc marcotc mentioned this pull request Jan 15, 2020
@marcotc marcotc added this to the 0.31.1 milestone Jan 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev/testing Involves testing processes (e.g. RSpec)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants