Apache9 commented on code in PR #8185:
URL: https://github.com/apache/hbase/pull/8185#discussion_r3207489665
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactionFileNotFound.java:
##########
@@ -193,9 +187,9 @@ public void testCompactionAfterRefresh() throws Exception {
} catch (IOException e) {
LOG.error("Got an exception during compaction", e);
if (e instanceof FileNotFoundException) {
- Assert.fail("Got a FNFE during compaction");
+ fail("Got a FNFE during compaction");
Review Comment:
A bit strange that why not just throw the exception out...
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestClearRegionBlockCache.java:
##########
@@ -95,12 +92,12 @@ public void setup() throws Exception {
HTU.flush(TABLE_NAME);
}
- @After
+ @AfterEach
public void teardown() throws Exception {
HTU.shutdownMiniCluster();
Review Comment:
This means we need to restart the cluster for every test method? Can file
another issue to dig more, maybe we should split this to two tests, where we
start cluster with different cacheType.
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompaction.java:
##########
@@ -747,7 +742,7 @@ public List<Path> compact(ThroughputController
throughputController, User user)
this.wait();
}
} catch (InterruptedException e) {
- Assume.assumeNoException(e);
+ Assumptions.abort(e.getMessage());
Review Comment:
This is a bit strange, anyway, can be a separated issue.
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCleanupMetaWAL.java:
##########
@@ -31,32 +30,28 @@
import org.apache.hadoop.hbase.master.procedure.ServerCrashProcedure;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.util.CommonFSUtils;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@Category(MediumTests.class)
+@Tag(MediumTests.TAG)
public class TestCleanupMetaWAL {
+
private static final Logger LOG =
LoggerFactory.getLogger(TestCleanupMetaWAL.class);
private final static HBaseTestingUtil TEST_UTIL = new HBaseTestingUtil();
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestCleanupMetaWAL.class);
-
- @BeforeClass
+ @BeforeAll
public static void before() throws Exception {
TEST_UTIL.startMiniCluster(2);
}
- @AfterClass
+ @AfterAll
public static void after() throws Exception {
- TEST_UTIL.shutdownMiniZKCluster();
+ TEST_UTIL.shutdownMiniCluster();
Review Comment:
OK, we fixed an old bug here...
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactingToCellFlatMapMemStore.java:
##########
@@ -73,13 +74,9 @@ public TestCompactingToCellFlatMapMemStore(String type) {
}
@Override
- public void tearDown() throws Exception {
- chunkCreator.clearChunksInPool();
- super.tearDown();
- }
-
- @Override
- public void setUp() throws Exception {
+ @BeforeEach
+ public void setUp(TestInfo testInfo) throws Exception {
Review Comment:
Is the behavior expected? Better introduce some dummy abstract method and
call it in the parent test class, and implement the dummy method in this sub
class, so it will be more clear?
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDefaultMemStore.java:
##########
@@ -1083,10 +1072,10 @@ private long runSnapshot(final AbstractMemStore hmc)
throws UnexpectedStateExcep
int oldHistorySize = hmc.getSnapshot().getCellsCount();
MemStoreSnapshot snapshot = hmc.snapshot();
// Make some assertions about what just happened.
- assertTrue("History size has not increased",
- oldHistorySize < hmc.getSnapshot().getCellsCount());
+ assertTrue(oldHistorySize < hmc.getSnapshot().getCellsCount(),
+ "History size has not increased");
long t = memstore.timeOfOldestEdit();
- assertTrue("Time of oldest edit is not Long.MAX_VALUE", t ==
Long.MAX_VALUE);
+ assertTrue(t == Long.MAX_VALUE, "Time of oldest edit is not
Long.MAX_VALUE");
Review Comment:
assertEquals
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactSplitThread.java:
##########
@@ -123,7 +117,7 @@ public void testThreadPoolSizeTuning() throws Exception {
try {
regionServer.getCompactSplitThread().onConfigurationChange(conf);
} catch (IllegalArgumentException iae) {
- Assert.fail("Update bigger configuration failed!");
+ fail("Update bigger configuration failed!");
Review Comment:
It is not good that we eat the exception information...
--
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]