Skip to content

Commit 64d4915

Browse files
authored
HBASE-26039 TestReplicationKillRS is useless after HBASE-23956 (#3440)
Signed-off-by: Michael Stack <stack@apache.org>
1 parent 79659d8 commit 64d4915

7 files changed

+30
-42
lines changed

hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public class TestReplicationBase {
8383
protected static Configuration CONF2 = UTIL2.getConfiguration();
8484

8585
protected static int NUM_SLAVES1 = 1;
86-
protected static final int NUM_SLAVES2 = 1;
86+
protected static int NUM_SLAVES2 = 1;
8787
protected static final int NB_ROWS_IN_BATCH = 100;
8888
protected static final int NB_ROWS_IN_BIG_BATCH =
8989
NB_ROWS_IN_BATCH * 10;

hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillMasterRS.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,27 @@
2020
import org.apache.hadoop.hbase.HBaseClassTestRule;
2121
import org.apache.hadoop.hbase.testclassification.LargeTests;
2222
import org.apache.hadoop.hbase.testclassification.ReplicationTests;
23+
import org.junit.BeforeClass;
2324
import org.junit.ClassRule;
2425
import org.junit.Test;
2526
import org.junit.experimental.categories.Category;
2627

2728
/**
28-
* Runs the TestReplicationKillRS test and selects the RS to kill in the master cluster
29-
* Do not add other tests in this class.
29+
* Runs the TestReplicationKillRS test and selects the RS to kill in the master cluster Do not add
30+
* other tests in this class.
3031
*/
3132
@Category({ ReplicationTests.class, LargeTests.class })
3233
public class TestReplicationKillMasterRS extends TestReplicationKillRS {
3334

3435
@ClassRule
3536
public static final HBaseClassTestRule CLASS_RULE =
36-
HBaseClassTestRule.forClass(TestReplicationKillMasterRS.class);
37+
HBaseClassTestRule.forClass(TestReplicationKillMasterRS.class);
38+
39+
@BeforeClass
40+
public static void setUpBeforeClass() throws Exception {
41+
NUM_SLAVES1 = 2;
42+
TestReplicationBase.setUpBeforeClass();
43+
}
3744

3845
@Test
3946
public void killOneMasterRS() throws Exception {

hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillMasterRSCompressed.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,9 @@ public class TestReplicationKillMasterRSCompressed extends TestReplicationKillMa
3636
public static final HBaseClassTestRule CLASS_RULE =
3737
HBaseClassTestRule.forClass(TestReplicationKillMasterRSCompressed.class);
3838

39-
/**
40-
* @throws java.lang.Exception
41-
*/
4239
@BeforeClass
4340
public static void setUpBeforeClass() throws Exception {
4441
CONF1.setBoolean(HConstants.ENABLE_WAL_COMPRESSION, true);
45-
TestReplicationBase.setUpBeforeClass();
42+
TestReplicationKillMasterRS.setUpBeforeClass();
4643
}
4744
}

hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillMasterRSWithSeparateOldWALs.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
1717
*/
18-
1918
package org.apache.hadoop.hbase.replication;
2019

2120
import org.apache.hadoop.hbase.HBaseClassTestRule;
@@ -24,24 +23,18 @@
2423
import org.apache.hadoop.hbase.wal.AbstractFSWALProvider;
2524
import org.junit.BeforeClass;
2625
import org.junit.ClassRule;
27-
import org.junit.Test;
2826
import org.junit.experimental.categories.Category;
2927

3028
@Category({ ReplicationTests.class, LargeTests.class })
31-
public class TestReplicationKillMasterRSWithSeparateOldWALs extends TestReplicationKillRS {
29+
public class TestReplicationKillMasterRSWithSeparateOldWALs extends TestReplicationKillMasterRS {
3230

3331
@ClassRule
3432
public static final HBaseClassTestRule CLASS_RULE =
35-
HBaseClassTestRule.forClass(TestReplicationKillMasterRSWithSeparateOldWALs.class);
33+
HBaseClassTestRule.forClass(TestReplicationKillMasterRSWithSeparateOldWALs.class);
3634

3735
@BeforeClass
3836
public static void setUpBeforeClass() throws Exception {
3937
CONF1.setBoolean(AbstractFSWALProvider.SEPARATE_OLDLOGDIR, true);
40-
TestReplicationBase.setUpBeforeClass();
41-
}
42-
43-
@Test
44-
public void killOneMasterRS() throws Exception {
45-
loadTableAndKillRS(UTIL1);
38+
TestReplicationKillMasterRS.setUpBeforeClass();
4639
}
4740
}

hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillRS.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import static org.junit.Assert.fail;
2121

22-
import org.apache.hadoop.hbase.HBaseClassTestRule;
2322
import org.apache.hadoop.hbase.HBaseTestingUtility;
2423
import org.apache.hadoop.hbase.UnknownScannerException;
2524
import org.apache.hadoop.hbase.client.Connection;
@@ -28,28 +27,19 @@
2827
import org.apache.hadoop.hbase.client.ResultScanner;
2928
import org.apache.hadoop.hbase.client.Scan;
3029
import org.apache.hadoop.hbase.client.Table;
31-
import org.apache.hadoop.hbase.testclassification.LargeTests;
32-
import org.apache.hadoop.hbase.testclassification.ReplicationTests;
3330
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
34-
import org.junit.ClassRule;
35-
import org.junit.experimental.categories.Category;
3631
import org.slf4j.Logger;
3732
import org.slf4j.LoggerFactory;
3833

39-
@Category({ ReplicationTests.class, LargeTests.class })
40-
public class TestReplicationKillRS extends TestReplicationBase {
41-
42-
@ClassRule
43-
public static final HBaseClassTestRule CLASS_RULE =
44-
HBaseClassTestRule.forClass(TestReplicationKillRS.class);
34+
public abstract class TestReplicationKillRS extends TestReplicationBase {
4535

4636
private static final Logger LOG = LoggerFactory.getLogger(TestReplicationKillRS.class);
4737

4838
/**
4939
* Load up 1 tables over 2 region servers and kill a source during the upload. The failover
5040
* happens internally. WARNING this test sometimes fails because of HBASE-3515
5141
*/
52-
public void loadTableAndKillRS(HBaseTestingUtility util) throws Exception {
42+
protected void loadTableAndKillRS(HBaseTestingUtility util) throws Exception {
5343
// killing the RS with hbase:meta can result into failed puts until we solve
5444
// IO fencing
5545
int rsToKill1 = util.getHBaseCluster().getServerWithMeta() == 0 ? 1 : 0;

hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillSlaveRS.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,27 @@
2020
import org.apache.hadoop.hbase.HBaseClassTestRule;
2121
import org.apache.hadoop.hbase.testclassification.LargeTests;
2222
import org.apache.hadoop.hbase.testclassification.ReplicationTests;
23+
import org.junit.BeforeClass;
2324
import org.junit.ClassRule;
2425
import org.junit.Test;
2526
import org.junit.experimental.categories.Category;
2627

2728
/**
28-
* Runs the TestReplicationKillRS test and selects the RS to kill in the slave cluster
29-
* Do not add other tests in this class.
29+
* Runs the TestReplicationKillRS test and selects the RS to kill in the slave cluster Do not add
30+
* other tests in this class.
3031
*/
3132
@Category({ ReplicationTests.class, LargeTests.class })
3233
public class TestReplicationKillSlaveRS extends TestReplicationKillRS {
3334

3435
@ClassRule
3536
public static final HBaseClassTestRule CLASS_RULE =
36-
HBaseClassTestRule.forClass(TestReplicationKillSlaveRS.class);
37+
HBaseClassTestRule.forClass(TestReplicationKillSlaveRS.class);
38+
39+
@BeforeClass
40+
public static void setUpBeforeClass() throws Exception {
41+
NUM_SLAVES2 = 2;
42+
TestReplicationBase.setUpBeforeClass();
43+
}
3744

3845
@Test
3946
public void killOneSlaveRS() throws Exception {

hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillSlaveRSWithSeparateOldWALs.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,18 @@
2424
import org.apache.hadoop.hbase.wal.AbstractFSWALProvider;
2525
import org.junit.BeforeClass;
2626
import org.junit.ClassRule;
27-
import org.junit.Test;
2827
import org.junit.experimental.categories.Category;
2928

3029
@Category({ ReplicationTests.class, LargeTests.class })
31-
public class TestReplicationKillSlaveRSWithSeparateOldWALs extends TestReplicationKillRS {
30+
public class TestReplicationKillSlaveRSWithSeparateOldWALs extends TestReplicationKillSlaveRS {
3231

3332
@ClassRule
3433
public static final HBaseClassTestRule CLASS_RULE =
35-
HBaseClassTestRule.forClass(TestReplicationKillSlaveRSWithSeparateOldWALs.class);
34+
HBaseClassTestRule.forClass(TestReplicationKillSlaveRSWithSeparateOldWALs.class);
3635

3736
@BeforeClass
3837
public static void setUpBeforeClass() throws Exception {
3938
CONF1.setBoolean(AbstractFSWALProvider.SEPARATE_OLDLOGDIR, true);
40-
TestReplicationBase.setUpBeforeClass();
41-
}
42-
43-
@Test
44-
public void killOneSlaveRS() throws Exception {
45-
loadTableAndKillRS(UTIL2);
39+
TestReplicationKillSlaveRS.setUpBeforeClass();
4640
}
4741
}

0 commit comments

Comments
 (0)