ivankelly commented on a change in pull request #1233: ZOOKEEPER-3701 Split 
brain on log disk full
URL: https://github.com/apache/zookeeper/pull/1233#discussion_r369968658
 
 

 ##########
 File path: 
zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/LearnerTest.java
 ##########
 @@ -300,4 +307,52 @@ public void syncTest() throws Exception {
         }
     }
 
+    @Test
+    public void truncFailTest() throws Exception {
+        final boolean[] exitProcCalled = {false};
+
+        ServiceUtils.setSystemExitProcedure(new Consumer<Integer>() {
+            @Override
+            public void accept(Integer exitCode) {
+                exitProcCalled[0] = true;
+                assertThat(exitCode, 
equalTo(ExitCode.QUORUM_PACKET_ERROR.getValue()));
 
 Review comment:
   This assertion will not happen in the main junit thread, so if it asserts 
false, the behaviour will be unpredictable (the test will probably ignore it). 
   
   Instead of this, I'd replace exitProcCalled with a 
```CompletableFuture<Integer>``` and at the end of the  test method do
   ```
   assertThat(exitCode.get(10, TimeUnit.SECONDS), 
equalTo(ExitCode.QUORUM_PACKET_ERROR.getValue()));
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to