adoroszlai commented on code in PR #1452:
URL: https://github.com/apache/ratis/pull/1452#discussion_r3206409770
##########
ratis-test/src/test/java/org/apache/ratis/util/TestLifeCycle.java:
##########
@@ -101,4 +104,68 @@ private static void
testInvalidTransition(TriConsumer<LifeCycle.State, LifeCycle
}
}
+ @Test
+ public void testStartAndTransition() throws Exception {
+ final SimulatedServer simulatedServer = new SimulatedServer();
+ assertEquals(NEW, simulatedServer.getLifeCycleState());
+
+ final CompletableFuture<Throwable> f = CompletableFuture.supplyAsync(() ->
{
+ try {
+ simulatedServer.start();
+ throw new AssertionError("start() should fail");
+ } catch (Exception e) {
+ return e.getCause();
+ }
+ });
+
+ Thread.sleep(100);
+ assertEquals(STARTING, simulatedServer.getLifeCycleState());
Review Comment:
Would using `JavaUtils.attemptUntilTrue` be better than `Thread.sleep`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]