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

[BEAM-5709] Fix flaky tests in BeamFnControlServiceTest. #6639

Merged
merged 1 commit into from Oct 12, 2018

Conversation

youngoli
Copy link
Contributor

See the Jira issue for a description of the cause of the flakiness. This attempts to fix the issue by waiting a sufficiently long time for any actions that rely on the server shutdown to finish.


Follow this checklist to help us incorporate your contribution quickly and easily:

  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

It will help us expedite review of your Pull Request if you tag someone (e.g. @username) to look at it.

Post-Commit Tests Status (on master branch)

Lang SDK Apex Dataflow Flink Gearpump Samza Spark
Go Build Status --- --- --- --- --- ---
Java Build Status Build Status Build Status Build Status Build Status Build Status Build Status
Python Build Status --- Build Status
Build Status
Build Status --- --- ---

@youngoli
Copy link
Contributor Author

R: @boyuanzz

@youngoli
Copy link
Contributor Author

CC: @kennknowles

For committer approval once this is reviewed.

@boyuanzz
Copy link
Contributor

Thanks for this! Please wait for all tests pass.

Copy link
Member

@kennknowles kennknowles left a comment

Choose a reason for hiding this comment

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

I will merge after tests pass as long as we have a bug about getting rid of the sleeps.

@@ -88,6 +88,8 @@ public void testClientConnecting() throws Exception {
server.shutdown();
server.awaitTermination(1, TimeUnit.SECONDS);
server.shutdownNow();
Thread.sleep(1000); // Wait for stub to close stream.
Copy link
Member

Choose a reason for hiding this comment

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

Fixing a flake is important enough that we can merge this, but please keep a ticket open. If you have time and inclination to fix the test to use a latch instead of a sleep, that would be preferable. I imagine you can do this with the mocks by inserting code to run when onCompleted is called, or you could move away from mocks since StreamObserver is easy to implement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That sounds like a good idea. I'm assuming with that method some kind of timeout would be set on the latch, so that if onCompleted doesn't get called in a certain timespan we can fail the test?

Copy link
Member

Choose a reason for hiding this comment

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

Yes. And since it is just a unit test that won't have wide variance, we can just put @Test(timeout=2000) on the method using JUnit's support. So in the happy case it succeeds instantly, and failure by timeout in 2 seconds.

See the Jira issue for a description of the cause of the flakiness. This attempts to fix the issue by waiting a sufficiently long time for any actions that rely on the server shutdown to finish.
@youngoli
Copy link
Contributor Author

Fixed formatting errors that were causing test failures due to Spotless.

@kennknowles kennknowles merged commit ca37470 into apache:master Oct 12, 2018
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.

None yet

3 participants