mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-09-27 16:08:21 +00:00
Wait for idle state in the StopStatusTest
This commit is contained in:
@@ -14,6 +14,7 @@ import org.jboss.fuse.mvnd.daemon.Client;
|
||||
import org.jboss.fuse.mvnd.daemon.ClientOutput;
|
||||
import org.jboss.fuse.mvnd.daemon.DaemonInfo;
|
||||
import org.jboss.fuse.mvnd.daemon.DaemonRegistry;
|
||||
import org.jboss.fuse.mvnd.daemon.DaemonState;
|
||||
import org.jboss.fuse.mvnd.junit.MvndTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
@@ -50,6 +51,17 @@ public class StopStatusTest {
|
||||
d.getUid() + " +" + d.getPid() + " +" + d.getAddress()));
|
||||
|
||||
}
|
||||
/* Wait, till the instance becomes idle */
|
||||
final int timeoutMs = 5000;
|
||||
final long deadline = System.currentTimeMillis() + timeoutMs;
|
||||
while (!registry.getAll().stream()
|
||||
.filter(di -> di.getUid().equals(d.getUid()) && di.getState() == DaemonState.Idle)
|
||||
.findFirst()
|
||||
.isPresent()) {
|
||||
Assertions.assertThat(deadline)
|
||||
.withFailMessage("Daemon %s should have become idle within %d", d.getUid(), timeoutMs)
|
||||
.isGreaterThan(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
client.execute(Mockito.mock(ClientOutput.class), "clean").assertSuccess();
|
||||
/* There should still be exactly one item in the registry after the second build */
|
||||
|
Reference in New Issue
Block a user