Improve test stability on OSX (#453)

This commit is contained in:
Guillaume Nodet
2021-07-29 07:42:36 +02:00
committed by GitHub
parent 3a72ddf7c8
commit caade66f19
3 changed files with 8 additions and 2 deletions

View File

@@ -100,6 +100,7 @@
<mvnd.test.hostLocalMavenRepo>${settings.localRepository}</mvnd.test.hostLocalMavenRepo> <mvnd.test.hostLocalMavenRepo>${settings.localRepository}</mvnd.test.hostLocalMavenRepo>
<preinstall.artifacts>${preinstall.artifacts}</preinstall.artifacts> <preinstall.artifacts>${preinstall.artifacts}</preinstall.artifacts>
</systemPropertyVariables> </systemPropertyVariables>
<rerunFailingTestsCount>2</rerunFailingTestsCount>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>

View File

@@ -24,6 +24,7 @@ import org.junit.jupiter.api.condition.OS;
import org.mvndaemon.mvnd.assertj.TestClientOutput; import org.mvndaemon.mvnd.assertj.TestClientOutput;
import org.mvndaemon.mvnd.client.Client; import org.mvndaemon.mvnd.client.Client;
import org.mvndaemon.mvnd.client.DaemonParameters; import org.mvndaemon.mvnd.client.DaemonParameters;
import org.mvndaemon.mvnd.common.DaemonInfo;
import org.mvndaemon.mvnd.junit.MvndTest; import org.mvndaemon.mvnd.junit.MvndTest;
import org.mvndaemon.mvnd.junit.TestRegistry; import org.mvndaemon.mvnd.junit.TestRegistry;
@@ -46,7 +47,7 @@ public class BootstrapPluginTest {
void cleanInstall() throws IOException, InterruptedException { void cleanInstall() throws IOException, InterruptedException {
assertDaemonRegistrySize(0); assertDaemonRegistrySize(0);
for (int i = 0; i < 20; i++) { for (int i = 0; i < 5; i++) {
final TestClientOutput output = new TestClientOutput(); final TestClientOutput output = new TestClientOutput();
try { try {
client.execute(output, "clean", "install", "-e", "-Dmvnd.log.level=DEBUG").assertSuccess(); client.execute(output, "clean", "install", "-e", "-Dmvnd.log.level=DEBUG").assertSuccess();
@@ -55,7 +56,9 @@ public class BootstrapPluginTest {
fail("Error", e); fail("Error", e);
} }
assertDaemonRegistrySize(1); assertDaemonRegistrySize(1);
Thread.sleep(100); /* Wait, till the instance becomes idle */
DaemonInfo d = registry.getAll().get(0);
registry.awaitIdle(d.getId());
} }
} }

View File

@@ -59,6 +59,8 @@ public class StopStatusTest {
client.execute(new TestClientOutput(), "clean").assertSuccess(); client.execute(new TestClientOutput(), "clean").assertSuccess();
/* There should still be exactly one item in the registry after the second build */ /* There should still be exactly one item in the registry after the second build */
assertDaemonRegistrySize(1); assertDaemonRegistrySize(1);
/* Wait, till the instance becomes idle */
registry.awaitIdle(d.getId());
client.execute(new TestClientOutput(), "--stop").assertSuccess(); client.execute(new TestClientOutput(), "--stop").assertSuccess();
/* No items in the registry after we have killed all daemons */ /* No items in the registry after we have killed all daemons */