fix flaky test
Removed flaky logic around waiting in tests.
Removed thread.sleep and replaced with triggers via CountDownLatch
R: @scwhittle @Abacn
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
- [ ] Mention the appropriate issue in your description (for example:
addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, commentfixes #<ISSUE NUMBER>instead. - [ ] Update
CHANGES.mdwith noteworthy changes. - [ ] If this contribution is large, please file an Apache Individual Contributor License Agreement.
See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.
Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:
R: @damccorm added as fallback since no labels match configuration
Available commands:
stop reviewer notifications- opt out of the automated review toolingremind me after tests pass- tag the comment author after tests passwaiting on author- shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)
The PR bot will only process comments in the main thread (not review comments).
Do you know how to run a test 100x to verify it isn't flaky? I'm not sure if there is a gradle invocation to do that or not. Maybe @Abacn knows
Do you know how to run a test 100x to verify it isn't flaky? I'm not sure if there is a gradle invocation to do that or not. Maybe @Abacn knows
It's unit test and the command can be this
first in https://github.com/apache/beam/blob/master/runners/google-cloud-dataflow-java/worker/build.gradle add a line
test.outputs.upToDateWhen {false}
(ref: https://stackoverflow.com/questions/29427020/how-to-run-gradle-test-when-all-tests-are-up-to-date);
then use a script like
for i in `seq 1 100`; do
./gradlew :runners:google-cloud-dataflow-java:worker:test --tests *someSpecificUnitTest*
done
and see the result.
The problem is the tests with racing condition tends to be more flaky on GitHub Action than on local machines. This may be because the GHA runner has different load each time run, which affects timing, but the local machine do not
Thanks! I'll run it and circle back
@Abacn is there anyway I can run it in the same environment as GitHub actions? Or simulate the different loads?
running this command locally
:runners:google-cloud-dataflow-java:worker:test --tests "org.apache.beam.runners.dataflow.worker.windmill.client.grpc.StreamingEngineClientTest"
:runners:google-cloud-dataflow-java:worker:test --tests "org.apache.beam.runners.dataflow.worker.windmill.client.grpc.StreamingEngineClientTest"
was successful @Abacn