Skip to content

Commit e032538

Browse files
committed
HBASE-30188 Upgrade hbase-server to use junit5 Part20 (#8286) (#8298)
(cherry picked from commit 8ce9e3b) Signed-off-by: Xiao Liu <liuxiaocs@apache.org>
1 parent 2495df1 commit e032538

20 files changed

Lines changed: 885 additions & 856 deletions

hbase-endpoint/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpToolWithBulkLoadedData.java

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
*/
1818
package org.apache.hadoop.hbase.replication;
1919

20-
import static org.apache.hadoop.hbase.replication.TestReplicationBase.NB_RETRIES;
21-
import static org.apache.hadoop.hbase.replication.TestReplicationBase.SLEEP_TIME;
22-
import static org.apache.hadoop.hbase.replication.TestReplicationBase.row;
23-
import static org.junit.Assert.assertEquals;
20+
import static org.apache.hadoop.hbase.replication.TestReplicationBaseNoBeforeAll.NB_RETRIES;
21+
import static org.apache.hadoop.hbase.replication.TestReplicationBaseNoBeforeAll.SLEEP_TIME;
22+
import static org.apache.hadoop.hbase.replication.TestReplicationBaseNoBeforeAll.row;
23+
import static org.junit.jupiter.api.Assertions.assertEquals;
2424

2525
import java.io.IOException;
2626
import java.util.ArrayList;
@@ -32,7 +32,6 @@
3232
import org.apache.hadoop.conf.Configuration;
3333
import org.apache.hadoop.fs.FileSystem;
3434
import org.apache.hadoop.fs.Path;
35-
import org.apache.hadoop.hbase.HBaseClassTestRule;
3635
import org.apache.hadoop.hbase.HBaseTestingUtility;
3736
import org.apache.hadoop.hbase.HConstants;
3837
import org.apache.hadoop.hbase.TableName;
@@ -45,19 +44,15 @@
4544
import org.apache.hadoop.hbase.tool.BulkLoadHFiles;
4645
import org.apache.hadoop.hbase.util.Bytes;
4746
import org.apache.hadoop.hbase.util.HFileTestUtil;
48-
import org.junit.ClassRule;
49-
import org.junit.Test;
50-
import org.junit.experimental.categories.Category;
47+
import org.junit.jupiter.api.Tag;
48+
import org.junit.jupiter.api.Test;
5149
import org.slf4j.Logger;
5250
import org.slf4j.LoggerFactory;
5351

54-
@Category({ ReplicationTests.class, LargeTests.class })
52+
@Tag(ReplicationTests.TAG)
53+
@Tag(LargeTests.TAG)
5554
public class TestReplicationSyncUpToolWithBulkLoadedData extends TestReplicationSyncUpToolBase {
5655

57-
@ClassRule
58-
public static final HBaseClassTestRule CLASS_RULE =
59-
HBaseClassTestRule.forClass(TestReplicationSyncUpToolWithBulkLoadedData.class);
60-
6156
private static final Logger LOG =
6257
LoggerFactory.getLogger(TestReplicationSyncUpToolWithBulkLoadedData.class);
6358

@@ -122,12 +117,12 @@ private void mimicSyncUpAfterBulkLoad(Iterator<String> randomHFileRangeListItera
122117
loadAndReplicateHFiles(false, randomHFileRangeListIterator);
123118

124119
int rowCount_ht1Source = UTIL1.countRows(ht1Source);
125-
assertEquals("t1_syncup has 206 rows on source, after bulk load of another 103 hfiles", 206,
126-
rowCount_ht1Source);
120+
assertEquals(206, rowCount_ht1Source,
121+
"t1_syncup has 206 rows on source, after bulk load of another 103 hfiles");
127122

128123
int rowCount_ht2Source = UTIL1.countRows(ht2Source);
129-
assertEquals("t2_syncup has 406 rows on source, after bulk load of another 203 hfiles", 406,
130-
rowCount_ht2Source);
124+
assertEquals(406, rowCount_ht2Source,
125+
"t2_syncup has 406 rows on source, after bulk load of another 203 hfiles");
131126

132127
shutDownSourceHBaseCluster();
133128
restartTargetHBaseCluster(1);
@@ -137,8 +132,8 @@ private void mimicSyncUpAfterBulkLoad(Iterator<String> randomHFileRangeListItera
137132
// Before sync up
138133
int rowCountHt1TargetAtPeer1 = UTIL2.countRows(ht1TargetAtPeer1);
139134
int rowCountHt2TargetAtPeer1 = UTIL2.countRows(ht2TargetAtPeer1);
140-
assertEquals("@Peer1 t1_syncup should still have 100 rows", 100, rowCountHt1TargetAtPeer1);
141-
assertEquals("@Peer1 t2_syncup should still have 200 rows", 200, rowCountHt2TargetAtPeer1);
135+
assertEquals(100, rowCountHt1TargetAtPeer1, "@Peer1 t1_syncup should still have 100 rows");
136+
assertEquals(200, rowCountHt2TargetAtPeer1, "@Peer1 t2_syncup should still have 200 rows");
142137

143138
// Run sync up tool
144139
syncUp(UTIL1);
@@ -157,10 +152,10 @@ private void mimicSyncUpAfterBulkLoad(Iterator<String> randomHFileRangeListItera
157152
rowCount_ht2Source = UTIL1.countRows(ht2Source);
158153
LOG.debug("t2_syncup should have 406 rows at source, and it is " + rowCount_ht2Source);
159154
}
160-
assertEquals("@Peer1 t1_syncup should be sync up and have 200 rows", 200,
161-
rowCountHt1TargetAtPeer1);
162-
assertEquals("@Peer1 t2_syncup should be sync up and have 400 rows", 400,
163-
rowCountHt2TargetAtPeer1);
155+
assertEquals(200, rowCountHt1TargetAtPeer1,
156+
"@Peer1 t1_syncup should be sync up and have 200 rows");
157+
assertEquals(400, rowCountHt2TargetAtPeer1,
158+
"@Peer1 t2_syncup should be sync up and have 400 rows");
164159
}
165160
if (rowCountHt1TargetAtPeer1 == 200 && rowCountHt2TargetAtPeer1 == 400) {
166161
LOG.info("SyncUpAfterBulkLoad succeeded at retry = " + i);
@@ -228,7 +223,7 @@ private void loadAndValidateHFileReplication(String testName, byte[] row, byte[]
228223
Table source, byte[][][] hfileRanges, int numOfRows) throws Exception {
229224
Path dir = UTIL1.getDataTestDirOnTestFS(testName);
230225
FileSystem fs = UTIL1.getTestFileSystem();
231-
dir = dir.makeQualified(fs);
226+
dir = dir.makeQualified(fs.getUri(), fs.getWorkingDirectory());
232227
Path familyDir = new Path(dir, Bytes.toString(fam));
233228

234229
int hfileIdx = 0;
@@ -248,7 +243,7 @@ private void loadFromOtherHDFSAndValidateHFileReplication(String testName, byte[
248243
Table source, byte[][][] hfileRanges, int numOfRows) throws Exception {
249244
Path dir = UTIL2.getDataTestDirOnTestFS(testName);
250245
FileSystem fs = UTIL2.getTestFileSystem();
251-
dir = dir.makeQualified(fs);
246+
dir = dir.makeQualified(fs.getUri(), fs.getWorkingDirectory());
252247
Path familyDir = new Path(dir, Bytes.toString(fam));
253248

254249
int hfileIdx = 0;
@@ -269,7 +264,7 @@ private void wait(Table target, int expectedCount, String msg)
269264
for (int i = 0; i < NB_RETRIES; i++) {
270265
int rowCountHt2TargetAtPeer1 = UTIL2.countRows(target);
271266
if (i == NB_RETRIES - 1) {
272-
assertEquals(msg, expectedCount, rowCountHt2TargetAtPeer1);
267+
assertEquals(expectedCount, rowCountHt2TargetAtPeer1, msg);
273268
}
274269
if (expectedCount == rowCountHt2TargetAtPeer1) {
275270
break;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@
4141
import org.apache.hadoop.hbase.TableName;
4242
import org.apache.hadoop.hbase.client.Admin;
4343
import org.apache.hadoop.hbase.replication.DummyReplicationEndpoint;
44+
import org.apache.hadoop.hbase.replication.ReplicationEndpointTestBase.InterClusterReplicationEndpointForTest;
4445
import org.apache.hadoop.hbase.replication.ReplicationException;
4546
import org.apache.hadoop.hbase.replication.ReplicationPeerConfig;
4647
import org.apache.hadoop.hbase.replication.ReplicationPeerConfigBuilder;
4748
import org.apache.hadoop.hbase.replication.ReplicationPeerDescription;
4849
import org.apache.hadoop.hbase.replication.ReplicationQueueStorage;
4950
import org.apache.hadoop.hbase.replication.ReplicationStorageFactory;
50-
import org.apache.hadoop.hbase.replication.TestReplicationEndpoint.InterClusterReplicationEndpointForTest;
5151
import org.apache.hadoop.hbase.testclassification.ClientTests;
5252
import org.apache.hadoop.hbase.testclassification.MediumTests;
5353
import org.junit.jupiter.api.AfterAll;

0 commit comments

Comments
 (0)