HBASE-14427 Fix 'should' assertions in TestFastFail (Abhishek Singh Chouhan)

This commit is contained in:
stack 2015-10-21 09:53:27 -07:00
parent 6e3b7af0ef
commit b3afdb8de1

View File

@ -60,7 +60,7 @@ public class TestFastFail {
private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static byte[] FAMILY = Bytes.toBytes("testFamily"); private static byte[] FAMILY = Bytes.toBytes("testFamily");
private static final Random random = new Random(); private static final Random random = new Random();
private static int SLAVES = 3; private static int SLAVES = 1;
private static byte[] QUALIFIER = Bytes.toBytes("testQualifier"); private static byte[] QUALIFIER = Bytes.toBytes("testQualifier");
private static final int SLEEPTIME = 5000; private static final int SLEEPTIME = 5000;
@ -217,8 +217,6 @@ public class TestFastFail {
doneHalfway.await(); doneHalfway.await();
ClusterStatus status = TEST_UTIL.getHBaseCluster().getClusterStatus();
// Kill a regionserver // Kill a regionserver
TEST_UTIL.getHBaseCluster().getRegionServer(0).getRpcServer().stop(); TEST_UTIL.getHBaseCluster().getRegionServer(0).getRpcServer().stop();
TEST_UTIL.getHBaseCluster().getRegionServer(0).stop("Testing"); TEST_UTIL.getHBaseCluster().getRegionServer(0).stop("Testing");
@ -227,8 +225,8 @@ public class TestFastFail {
continueOtherHalf.countDown(); continueOtherHalf.countDown();
Thread.sleep(2 * SLEEPTIME); Thread.sleep(2 * SLEEPTIME);
// Restore the cluster // Start a RS in the cluster
TEST_UTIL.getHBaseCluster().restoreClusterStatus(status); TEST_UTIL.getHBaseCluster().startRegionServer();
int numThreadsReturnedFalse = 0; int numThreadsReturnedFalse = 0;
int numThreadsReturnedTrue = 0; int numThreadsReturnedTrue = 0;
@ -269,19 +267,16 @@ public class TestFastFail {
assertEquals("The regionservers that returned true should equal to the" assertEquals("The regionservers that returned true should equal to the"
+ " number of successful threads", numThreadsReturnedTrue, + " number of successful threads", numThreadsReturnedTrue,
numSuccessfullThreads.get()); numSuccessfullThreads.get());
/* 'should' is not worthy of an assert. Disabling because randomly this seems to randomly
* not but true. St.Ack 20151012
*
assertTrue( assertTrue(
"There should be atleast one thread that retried instead of failing", "There will be atleast one thread that retried instead of failing",
MyPreemptiveFastFailInterceptor.numBraveSouls.get() > 0); MyPreemptiveFastFailInterceptor.numBraveSouls.get() > 0);
assertTrue( assertTrue(
"There should be atleast one PreemptiveFastFail exception," "There will be atleast one PreemptiveFastFail exception,"
+ " otherwise, the test makes little sense." + " otherwise, the test makes little sense."
+ "numPreemptiveFastFailExceptions: " + "numPreemptiveFastFailExceptions: "
+ numPreemptiveFastFailExceptions.get(), + numPreemptiveFastFailExceptions.get(),
numPreemptiveFastFailExceptions.get() > 0); numPreemptiveFastFailExceptions.get() > 0);
*/
assertTrue( assertTrue(
"Only few thread should ideally be waiting for the dead " "Only few thread should ideally be waiting for the dead "
+ "regionserver to be coming back. numBlockedWorkers:" + "regionserver to be coming back. numBlockedWorkers:"