szetszwo commented on code in PR #1452:
URL: https://github.com/apache/ratis/pull/1452#discussion_r3209903302
##########
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:
Since the test is very simple, it is reliable to just use `Thread.sleep`.
An embarrassing reason is that TestRaftAsyncWithNetty often fails. It is
not easy to pass all the tests. We probably should disable
TestRaftAsyncWithNetty until it is fixed.
--
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]