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

Wait for WEBrick server start during tests #883

Merged
merged 1 commit into from
Dec 20, 2019

Conversation

marcotc
Copy link
Member

@marcotc marcotc commented Dec 11, 2019

Fixes this flaky test:

  1) Adapters::UnixSocket integration tests when sending traces through Unix socket client sends traces successfully
     Failure/Error: expect(messages).to have(1).items
       expected 1 items, got 0
     # ./spec/ddtrace/transport/http/adapters/unix_socket_integration_spec.rb:79:in `block (3 levels) in <top (required)>'

This happens because we don't wait until WEBrick::HTTPServer#start finishes its internal socket initialization before trying to use it.

Unfortunately, WEBrick::HTTPServer#start is a method that never returns. We need to use a special callback parameter, StartCallback, to inform us that the server is ready.

@marcotc marcotc added the dev/testing Involves testing processes (e.g. RSpec) label Dec 11, 2019
@marcotc marcotc requested a review from a team December 11, 2019 22:56
@marcotc marcotc self-assigned this Dec 11, 2019
@marcotc marcotc changed the title Wait for WEBrick server start during testing Wait for WEBrick server start during tests Dec 11, 2019
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.

👍

@marcotc marcotc merged commit 6ae74f4 into master Dec 20, 2019
@marcotc marcotc deleted the test/fix-flaky-unix-socket-test branch December 20, 2019 18:51
@delner delner mentioned this pull request Dec 30, 2019
@marcotc marcotc added this to the 0.31.0 milestone Jan 7, 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