maedhroz commented on a change in pull request #1301:
URL: https://github.com/apache/cassandra/pull/1301#discussion_r796162969



##########
File path: test/unit/org/apache/cassandra/utils/JVMStabilityInspectorTest.java
##########
@@ -54,43 +59,60 @@ public void testKill() throws Exception
 
         Config.DiskFailurePolicy oldPolicy = 
DatabaseDescriptor.getDiskFailurePolicy();
         Config.CommitFailurePolicy oldCommitPolicy = 
DatabaseDescriptor.getCommitFailurePolicy();
+        FileUtils.setFSErrorHandler(new DefaultFSErrorHandler());
         try
         {
-            killerForTests.reset();
-            JVMStabilityInspector.inspectThrowable(new IOException());
-            assertFalse(killerForTests.wasKilled());
-
-            
DatabaseDescriptor.setDiskFailurePolicy(Config.DiskFailurePolicy.die);
-            killerForTests.reset();
-            JVMStabilityInspector.inspectThrowable(new FSReadError(new 
IOException(), "blah"));
-            assertTrue(killerForTests.wasKilled());
-
-            killerForTests.reset();
-            JVMStabilityInspector.inspectThrowable(new FSWriteError(new 
IOException(), "blah"));
-            assertTrue(killerForTests.wasKilled());
-
-            killerForTests.reset();
-            JVMStabilityInspector.inspectThrowable(new 
CorruptSSTableException(new IOException(), "blah"));
-            assertTrue(killerForTests.wasKilled());
-
-            killerForTests.reset();
-            JVMStabilityInspector.inspectThrowable(new RuntimeException(new 
CorruptSSTableException(new IOException(), "blah")));
-            assertTrue(killerForTests.wasKilled());
-
-            
DatabaseDescriptor.setCommitFailurePolicy(Config.CommitFailurePolicy.die);
-            killerForTests.reset();
-            JVMStabilityInspector.inspectCommitLogThrowable(new Throwable());
-            assertTrue(killerForTests.wasKilled());
-
-            killerForTests.reset();
-            JVMStabilityInspector.inspectThrowable(new Exception(new 
IOException()));
-            assertFalse(killerForTests.wasKilled());
+            for (boolean daemonSetupCompleted : Arrays.asList(false, true))
+            {
+                // disk policy acts differently depending on if setup is 
complete or not; which is defined by
+                // the daemon thread not being null

Review comment:
       The disk policy looks at whether setup is complete, which means the 
daemon must both be registered and have had `completeSetup()` called. Should we 
do the latter here when `daemonSetupCompleted == true`?




-- 
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to