Apache9 commented on code in PR #8151:
URL: https://github.com/apache/hbase/pull/8151#discussion_r3165190768


##########
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/AbstractTestFSWAL.java:
##########
@@ -391,20 +391,22 @@ public void testFindMemStoresEligibleForFlush() throws 
Exception {
 
   }
 
-  @Test(expected = IOException.class)
+  @Test
   public void testFailedToCreateWALIfParentRenamed()
     throws IOException, CommonFSUtils.StreamLacksCapabilityException {
-    AbstractFSWAL<?> wal = newWAL(FS, CommonFSUtils.getWALRootDir(CONF),
-      currentTest.getMethodName(), HConstants.HREGION_OLDLOGDIR_NAME, CONF, 
null, true, null, null);
-    long filenum = EnvironmentEdgeManager.currentTime();
-    Path path = wal.computeFilename(filenum);
-    wal.createWriterInstance(FS, path);
-    Path parent = path.getParent();
-    path = wal.computeFilename(filenum + 1);
-    Path newPath = new Path(parent.getParent(), parent.getName() + 
"-splitting");
-    FS.rename(parent, newPath);
-    wal.createWriterInstance(FS, path);
-    fail("It should fail to create the new WAL");
+    assertThrows(IOException.class, () -> {
+      AbstractFSWAL<?> wal = newWAL(FS, CommonFSUtils.getWALRootDir(CONF), 
currentTest,
+        HConstants.HREGION_OLDLOGDIR_NAME, CONF, null, true, null, null);
+      long filenum = EnvironmentEdgeManager.currentTime();
+      Path path = wal.computeFilename(filenum);
+      wal.createWriterInstance(FS, path);
+      Path parent = path.getParent();
+      path = wal.computeFilename(filenum + 1);
+      Path newPath = new Path(parent.getParent(), parent.getName() + 
"-splitting");
+      FS.rename(parent, newPath);
+      wal.createWriterInstance(FS, path);
+      fail("It should fail to create the new WAL");

Review Comment:
   We do not need this fail assertion any more? And we'd better only wrap the 
statement which throws IOException only, not the whole method.



##########
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestAsyncFSWALDurability.java:
##########
@@ -22,37 +22,32 @@
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.io.asyncfs.monitor.StreamSlowMonitor;
-import org.apache.hadoop.hbase.regionserver.RegionServerServices;
+import org.apache.hadoop.hbase.testclassification.RegionServerTests;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
 import org.apache.hadoop.hbase.wal.WALProvider.AsyncWriter;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-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.apache.hbase.thirdparty.io.netty.channel.Channel;
 import org.apache.hbase.thirdparty.io.netty.channel.EventLoopGroup;
 import org.apache.hbase.thirdparty.io.netty.channel.nio.NioEventLoopGroup;
 import 
org.apache.hbase.thirdparty.io.netty.channel.socket.nio.NioSocketChannel;
 
-@Category({ RegionServerServices.class, SmallTests.class })

Review Comment:
   OK, fixed a typo...



##########
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/compactions/PerfTestCompactionPolicies.java:
##########
@@ -36,25 +37,20 @@
 import org.apache.hadoop.hbase.testclassification.MediumTests;
 import org.apache.hadoop.hbase.testclassification.RegionServerTests;
 import org.apache.hadoop.hbase.util.ReflectionUtils;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.params.provider.Arguments;
 
 /**
  * This is not a unit test. It is not run as part of the general unit test 
suite. It is for
  * comparing compaction policies. You must run it explicitly; e.g. mvn test
  * -Dtest=PerfTestCompactionPolicies
  */
-@Category({ RegionServerTests.class, MediumTests.class })
-@RunWith(Parameterized.class)
+@Tag(RegionServerTests.TAG)
+@Tag(MediumTests.TAG)
+@HBaseParameterizedTestTemplate

Review Comment:
   Better add name field here? And seems the javadoc is incorrect now?



##########
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/AbstractTestFSWAL.java:
##########
@@ -533,13 +535,15 @@ public void testWriteEntryCanBeNull() throws IOException {
     }
   }
 
-  @Test(expected = WALClosedException.class)
+  @Test
   public void testRollWriterForClosedWAL() throws IOException {
-    String testName = currentTest.getMethodName();
-    AbstractFSWAL<?> wal = newWAL(FS, CommonFSUtils.getWALRootDir(CONF), 
DIR.toString(), testName,
-      CONF, null, true, null, null);
-    wal.close();
-    wal.rollWriter();
+    assertThrows(WALClosedException.class, () -> {
+      String testName = currentTest;
+      AbstractFSWAL<?> wal = newWAL(FS, CommonFSUtils.getWALRootDir(CONF), 
DIR.toString(), testName,
+        CONF, null, true, null, null);
+      wal.close();
+      wal.rollWriter();

Review Comment:
   Ditto.



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

Reply via email to