From caade66f19ffa8bddda556676d530da328c5eae9 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Thu, 29 Jul 2021 07:42:36 +0200 Subject: [PATCH] Improve test stability on OSX (#453) --- integration-tests/pom.xml | 1 + .../java/org/mvndaemon/mvnd/it/BootstrapPluginTest.java | 7 +++++-- .../test/java/org/mvndaemon/mvnd/it/StopStatusTest.java | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 3bd60752..ad801e8f 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -100,6 +100,7 @@ ${settings.localRepository} ${preinstall.artifacts} + 2 diff --git a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/BootstrapPluginTest.java b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/BootstrapPluginTest.java index 1e6709c1..f8657258 100644 --- a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/BootstrapPluginTest.java +++ b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/BootstrapPluginTest.java @@ -24,6 +24,7 @@ import org.junit.jupiter.api.condition.OS; import org.mvndaemon.mvnd.assertj.TestClientOutput; import org.mvndaemon.mvnd.client.Client; import org.mvndaemon.mvnd.client.DaemonParameters; +import org.mvndaemon.mvnd.common.DaemonInfo; import org.mvndaemon.mvnd.junit.MvndTest; import org.mvndaemon.mvnd.junit.TestRegistry; @@ -46,7 +47,7 @@ public class BootstrapPluginTest { void cleanInstall() throws IOException, InterruptedException { assertDaemonRegistrySize(0); - for (int i = 0; i < 20; i++) { + for (int i = 0; i < 5; i++) { final TestClientOutput output = new TestClientOutput(); try { client.execute(output, "clean", "install", "-e", "-Dmvnd.log.level=DEBUG").assertSuccess(); @@ -55,7 +56,9 @@ public class BootstrapPluginTest { fail("Error", e); } assertDaemonRegistrySize(1); - Thread.sleep(100); + /* Wait, till the instance becomes idle */ + DaemonInfo d = registry.getAll().get(0); + registry.awaitIdle(d.getId()); } } diff --git a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/StopStatusTest.java b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/StopStatusTest.java index 5e87bb43..dc4e1773 100644 --- a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/StopStatusTest.java +++ b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/StopStatusTest.java @@ -59,6 +59,8 @@ public class StopStatusTest { client.execute(new TestClientOutput(), "clean").assertSuccess(); /* There should still be exactly one item in the registry after the second build */ assertDaemonRegistrySize(1); + /* Wait, till the instance becomes idle */ + registry.awaitIdle(d.getId()); client.execute(new TestClientOutput(), "--stop").assertSuccess(); /* No items in the registry after we have killed all daemons */