Fixed flaky ExamplesTest.JavaFramework. Review: https://reviews.apache.org/r/37415
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/7e631d61 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/7e631d61 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/7e631d61 Branch: refs/heads/master Commit: 7e631d612896cd1b8d4de46ff500677de9c63900 Parents: 554bd8d Author: Greg Mann <[email protected]> Authored: Sun Aug 16 19:13:56 2015 +0200 Committer: Till Toenshoff <[email protected]> Committed: Sun Aug 16 19:13:56 2015 +0200 ---------------------------------------------------------------------- src/examples/java/TestFramework.java | 10 ++++++++++ 1 file changed, 10 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/7e631d61/src/examples/java/TestFramework.java ---------------------------------------------------------------------- diff --git a/src/examples/java/TestFramework.java b/src/examples/java/TestFramework.java index 265005b..aad94c0 100644 --- a/src/examples/java/TestFramework.java +++ b/src/examples/java/TestFramework.java @@ -268,6 +268,16 @@ public class TestFramework { // Ensure that the driver process terminates. driver.stop(); + // For this test to pass reliably on some platforms, this sleep is + // required to ensure that the SchedulerDriver teardown is complete + // before the JVM starts running native object destructors after + // System.exit() is called. 500ms proved successful in test runs, + // but on a heavily-loaded machine it might not. + // TODO(greg): Ideally, we would inspect the status of the driver + // and its associated tasks via the Java API and wait until their + // teardown is complete to exit. + Thread.sleep(500); + System.exit(status); } }
