Re: [PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
liuxiaocs7 merged PR #8210: URL: https://github.com/apache/hbase/pull/8210 -- 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]
Re: [PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
liuxiaocs7 merged PR #8209: URL: https://github.com/apache/hbase/pull/8209 -- 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]
Re: [PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
liuxiaocs7 merged PR #8201: URL: https://github.com/apache/hbase/pull/8201 -- 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]
Re: [PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
Copilot commented on code in PR #8210:
URL: https://github.com/apache/hbase/pull/8210#discussion_r3210985276
##
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHBaseWalOnEC.java:
##
@@ -82,37 +74,39 @@ public static void setUpBeforeClass() throws Exception {
try (FSDataOutputStream out = fs.create(new Path("/canary"))) {
// If this comes back as having hflush then some test setup assumption
is wrong.
// Fail the test so that a developer has to look and triage
-assertFalse("Did not enable EC!",
out.hasCapability(StreamCapabilities.HFLUSH));
+assertFalse(out.hasCapability(StreamCapabilities.HFLUSH), "Did not
enable EC!");
}
} catch (NoSuchMethodException e) {
// We're not testing anything interesting if EC is not available, so
skip the rest of the test
- Assume.assumeNoException("Using an older version of hadoop; EC not
available.", e);
+ Assumptions.assumeTrue(false, "Using an older version of hadoop; EC not
available.");
}
Review Comment:
If the Hadoop version lacks the EC APIs, this `@BeforeAll` has already
started a MiniDFSCluster before hitting the assumption. Aborting the test at
that point can leak the cluster (and threads/files) because `@AfterAll` will
not run when `@BeforeAll` aborts. Consider restructuring so you check for
required methods before starting the cluster, or ensure the MiniDFSCluster is
shut down in the catch/finally path before calling Assumptions.*.
--
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]
[PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
liuxiaocs7 opened a new pull request, #8210: URL: https://github.com/apache/hbase/pull/8210 - for branch-2.5 - see: HBASE-30124 -- 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]
Re: [PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
liuxiaocs7 commented on code in PR #8209:
URL: https://github.com/apache/hbase/pull/8209#discussion_r3210925547
##
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/throttle/TestStoreHotnessProtector.java:
##
@@ -102,10 +96,9 @@ public void testPreparePutCounter() throws Exception {
countDownLatch.await(60, TimeUnit.SECONDS);
// no exception
-Assert.assertEquals(exception.get(), null);
-
Assert.assertEquals(storeHotnessProtector.getPreparePutToStoreMap().size(), 1);
-
Assert.assertEquals(storeHotnessProtector.getPreparePutToStoreMap().get(family).get(),
- threadCount);
+assertEquals(exception.get(), null);
+assertEquals(storeHotnessProtector.getPreparePutToStoreMap().size(), 1);
+
assertEquals(storeHotnessProtector.getPreparePutToStoreMap().get(family).get(),
threadCount);
Review Comment:
Migration remains consistent, and a new issue will be used to resolve this
problem
--
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]
Re: [PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
Copilot commented on code in PR #8209:
URL: https://github.com/apache/hbase/pull/8209#discussion_r3210904064
##
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/throttle/TestStoreHotnessProtector.java:
##
@@ -102,10 +96,9 @@ public void testPreparePutCounter() throws Exception {
countDownLatch.await(60, TimeUnit.SECONDS);
// no exception
-Assert.assertEquals(exception.get(), null);
-
Assert.assertEquals(storeHotnessProtector.getPreparePutToStoreMap().size(), 1);
-
Assert.assertEquals(storeHotnessProtector.getPreparePutToStoreMap().get(family).get(),
- threadCount);
+assertEquals(exception.get(), null);
+assertEquals(storeHotnessProtector.getPreparePutToStoreMap().size(), 1);
+
assertEquals(storeHotnessProtector.getPreparePutToStoreMap().get(family).get(),
threadCount);
Review Comment:
Several `assertEquals` calls have the arguments reversed (e.g.,
`assertEquals(exception.get(), null)` and `assertEquals(map.size(), 1)`). These
still work, but they produce confusing failure output because JUnit treats the
first argument as the expected value. Prefer `assertNull(exception.get())` and
`assertEquals(1, map.size())` (expected-first) for clearer diagnostics.
--
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]
[PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
liuxiaocs7 opened a new pull request, #8209: URL: https://github.com/apache/hbase/pull/8209 - for branch-2.6 - see: HBASE-30124 -- 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]
Re: [PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
liuxiaocs7 commented on code in PR #8201:
URL: https://github.com/apache/hbase/pull/8201#discussion_r3210805206
##
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRollAbort.java:
##
@@ -134,7 +130,7 @@ public void tearDown() throws Exception {
* Tests that RegionServer aborts if we hit an error closing the WAL when
there are unsynced WAL
* edits. See HBASE-4282.
*/
- @Test
+ @TestTemplate
public void testRSAbortWithUnflushedEdits() throws Exception {
LOG.info("Starting testRSAbortWithUnflushedEdits()");
Review Comment:
Good catch
--
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]
Re: [PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
Copilot commented on code in PR #8201:
URL: https://github.com/apache/hbase/pull/8201#discussion_r3199474359
##
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRollAbort.java:
##
@@ -184,7 +180,7 @@ public void testRSAbortWithUnflushedEdits() throws
Exception {
* declared it dead and started to split. Want log rolling after a master
split to fail. See
* HBASE-2312.
*/
- @Test
+ @TestTemplate
public void testLogRollAfterSplitStart() throws IOException {
LOG.info("Verify wal roll after split starts will fail.");
Review Comment:
Same issue here: `@TestTemplate` is used without any registered
`TestTemplateInvocationContextProvider` for this class. Convert this to `@Test`
(or annotate/register the intended template provider).
##
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALCellCodecWithCompression.java:
##
@@ -42,53 +43,45 @@
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.util.Bytes;
-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.runners.Parameterized.Parameters;
-
-@Category({ RegionServerTests.class, SmallTests.class })
-@RunWith(Parameterized.class)
-public class TestWALCellCodecWithCompression {
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.params.provider.Arguments;
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
-HBaseClassTestRule.forClass(TestWALCellCodecWithCompression.class);
[email protected](RegionServerTests.TAG)
[email protected](SmallTests.TAG)
+@HBaseParameterizedTestTemplate
+public class TestWALCellCodecWithCompression {
- private Compression.Algorithm compression;
+ private final Compression.Algorithm compression;
public TestWALCellCodecWithCompression(Compression.Algorithm algo) {
this.compression = algo;
}
- @Parameters
- public static List params() {
-return HBaseTestingUtility.COMPRESSION_ALGORITHMS_PARAMETERIZED;
+ public static Stream parameters() {
+return
HBaseTestingUtility.COMPRESSION_ALGORITHMS_PARAMETERIZED.stream().map(Arguments::of);
}
- @Test
+ @TestTemplate
public void testEncodeDecodeKVsWithTags() throws Exception {
doTest(false, false);
}
- @Test
+ @TestTemplate
public void testEncodeDecodeKVsWithTagsWithTagsCompression() throws
Exception {
doTest(true, false);
}
- @Test
+ @TestTemplate
public void testEncodeDecodeOffKVsWithTagsWithTagsCompression() throws
Exception {
-doTest(true, true);
+doTest(true, false);
}
Review Comment:
`testEncodeDecodeOffKVsWithTagsWithTagsCompression` is supposed to exercise
the off-heap KV path, but it currently calls `doTest(true, false)` (same as the
on-heap tags-compression test). This leaves the off-heap + tag-compression
combination untested; pass `offheapKV=true` for this test.
##
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRollAbort.java:
##
@@ -134,7 +130,7 @@ public void tearDown() throws Exception {
* Tests that RegionServer aborts if we hit an error closing the WAL when
there are unsynced WAL
* edits. See HBASE-4282.
*/
- @Test
+ @TestTemplate
public void testRSAbortWithUnflushedEdits() throws Exception {
LOG.info("Starting testRSAbortWithUnflushedEdits()");
Review Comment:
These methods are annotated with `@TestTemplate`, but the class is not
annotated with `@HBaseParameterizedTestTemplate` (and no other
`TestTemplateInvocationContextProvider` is registered). JUnit Jupiter will fail
to execute a `@TestTemplate` without an invocation context provider; use
`@Test` here (or add the appropriate template provider).
--
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]
[PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
liuxiaocs7 opened a new pull request, #8201: URL: https://github.com/apache/hbase/pull/8201 - for branch-2 - see: HBASE-30124 -- 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]
Re: [PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
liuxiaocs7 merged PR #8180: URL: https://github.com/apache/hbase/pull/8180 -- 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]
Re: [PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
liuxiaocs7 commented on PR #8180: URL: https://github.com/apache/hbase/pull/8180#issuecomment-4373211607 OK, we need to merge https://github.com/apache/hbase/pull/8151 and https://github.com/apache/hbase/pull/8183 together -- 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]
Re: [PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
Copilot commented on code in PR #8180:
URL: https://github.com/apache/hbase/pull/8180#discussion_r3172331500
##
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALReplay.java:
##
@@ -21,24 +21,26 @@
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.HBaseTestingUtil;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
import org.apache.hadoop.hbase.wal.WAL;
import org.apache.hadoop.hbase.wal.WALFactory;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.TestInfo;
-@Category({ RegionServerTests.class, MediumTests.class })
+@Tag(RegionServerTests.TAG)
+@Tag(MediumTests.TAG)
public class TestWALReplay extends AbstractTestWALReplay {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
-HBaseClassTestRule.forClass(TestWALReplay.class);
+ @BeforeAll
+ public static void setUpBeforeClass(TestInfo testInfo) throws Exception {
+if (testInfo.getTestClass().get() == TestWALReplay.class) {
+ setUpBeforeClass();
+}
+ }
Review Comment:
`@BeforeAll` methods cannot be `static` with injected parameters like
`TestInfo` (JUnit Jupiter does not support parameter injection for static
lifecycle methods). This will fail test discovery/execution. Remove this
overload and just annotate the existing no-arg `setUpBeforeClass()` (or make
the `@BeforeAll` non-static with `@TestInstance(PER_CLASS)`).
##
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestAsyncWALReplay.java:
##
@@ -21,37 +21,39 @@
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.testclassification.MediumTests;
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
import org.apache.hadoop.hbase.util.Threads;
import org.apache.hadoop.hbase.wal.WAL;
import org.apache.hadoop.hbase.wal.WALFactory;
-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.junit.jupiter.api.TestInfo;
import
org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder;
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({ RegionServerTests.class, MediumTests.class })
+@Tag(RegionServerTests.TAG)
+@Tag(MediumTests.TAG)
public class TestAsyncWALReplay extends AbstractTestWALReplay {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
-HBaseClassTestRule.forClass(TestAsyncWALReplay.class);
-
private static EventLoopGroup GROUP;
private static Class CHANNEL_CLASS;
- @BeforeClass
+ @BeforeAll
+ public static void setUpBeforeClass(TestInfo testInfo) throws Exception {
+if (testInfo.getTestClass().get() == TestAsyncWALReplay.class) {
+ setUpBeforeClass();
+}
+ }
Review Comment:
`@BeforeAll` is static here but declares a `TestInfo` parameter. JUnit
Jupiter does not support parameter injection for static `@BeforeAll` methods,
so this will throw a ParameterResolutionException at runtime. Prefer annotating
the existing no-arg `setUpBeforeClass()` (or switch to non-static `@BeforeAll`
with `@TestInstance(PER_CLASS)`).
##
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/AbstractTestFSWAL.java:
##
@@ -391,20 +391,19 @@ 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);
+AbstractFSWAL wal = newWAL(FS, CommonFSUtils.getWALRootDir(CONF),
testName,
+ HConstants.HREGION_OLDLOGDIR_NAME, CONF, null, true, null, null);
long filenum = EnvironmentEdgeManager.currentTime();
Path path = wal.computeFilename(filenum);
wal.createWriterInstance
[PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
liuxiaocs7 opened a new pull request, #8180: URL: https://github.com/apache/hbase/pull/8180 - for branch-3 - see: HBASE-30124 -- 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]
Re: [PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
liuxiaocs7 merged PR #8151: URL: https://github.com/apache/hbase/pull/8151 -- 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]
Re: [PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
liuxiaocs7 commented on PR #8151: URL: https://github.com/apache/hbase/pull/8151#issuecomment-4353700230 I checked, and the number of UTs is the same before and after the modification -- 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]
Re: [PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
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(WA
Re: [PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
liuxiaocs7 commented on code in PR #8151:
URL: https://github.com/apache/hbase/pull/8151#discussion_r3155269944
##
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALCellCodecWithCompression.java:
##
@@ -17,78 +17,71 @@
*/
package org.apache.hadoop.hbase.regionserver.wal;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Stream;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.ArrayBackedTag;
import org.apache.hadoop.hbase.ByteBufferKeyValue;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseCommonTestingUtil;
+import org.apache.hadoop.hbase.HBaseParameterizedTestTemplate;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.PrivateCellUtil;
-import org.apache.hadoop.hbase.Tag;
import org.apache.hadoop.hbase.codec.Codec.Decoder;
import org.apache.hadoop.hbase.codec.Codec.Encoder;
import org.apache.hadoop.hbase.io.compress.Compression;
import org.apache.hadoop.hbase.io.util.LRUDictionary;
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.util.Bytes;
-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.runners.Parameterized.Parameters;
-
-@Category({ RegionServerTests.class, SmallTests.class })
-@RunWith(Parameterized.class)
-public class TestWALCellCodecWithCompression {
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.params.provider.Arguments;
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
-HBaseClassTestRule.forClass(TestWALCellCodecWithCompression.class);
+@Tag(RegionServerTests.TAG)
+@Tag(SmallTests.TAG)
+@HBaseParameterizedTestTemplate
+public class TestWALCellCodecWithCompression {
- private Compression.Algorithm compression;
+ private final Compression.Algorithm compression;
public TestWALCellCodecWithCompression(Compression.Algorithm algo) {
this.compression = algo;
}
- @Parameters
- public static List params() {
-return HBaseCommonTestingUtil.COMPRESSION_ALGORITHMS_PARAMETERIZED;
+ public static Stream parameters() {
+return
HBaseCommonTestingUtil.COMPRESSION_ALGORITHMS_PARAMETERIZED.stream().map(Arguments::of);
}
- @Test
+ @TestTemplate
public void testEncodeDecodeKVsWithTags() throws Exception {
doTest(false, false);
}
- @Test
+ @TestTemplate
public void testEncodeDecodeKVsWithTagsWithTagsCompression() throws
Exception {
doTest(true, false);
}
- @Test
+ @TestTemplate
public void testEncodeDecodeOffKVsWithTagsWithTagsCompression() throws
Exception {
doTest(true, false);
}
Review Comment:
see: HBASE-30128 and https://github.com/apache/hbase/pull/8158
--
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]
Re: [PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
liuxiaocs7 commented on code in PR #8151:
URL: https://github.com/apache/hbase/pull/8151#discussion_r3155269944
##
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALCellCodecWithCompression.java:
##
@@ -17,78 +17,71 @@
*/
package org.apache.hadoop.hbase.regionserver.wal;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Stream;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.ArrayBackedTag;
import org.apache.hadoop.hbase.ByteBufferKeyValue;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseCommonTestingUtil;
+import org.apache.hadoop.hbase.HBaseParameterizedTestTemplate;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.PrivateCellUtil;
-import org.apache.hadoop.hbase.Tag;
import org.apache.hadoop.hbase.codec.Codec.Decoder;
import org.apache.hadoop.hbase.codec.Codec.Encoder;
import org.apache.hadoop.hbase.io.compress.Compression;
import org.apache.hadoop.hbase.io.util.LRUDictionary;
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.util.Bytes;
-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.runners.Parameterized.Parameters;
-
-@Category({ RegionServerTests.class, SmallTests.class })
-@RunWith(Parameterized.class)
-public class TestWALCellCodecWithCompression {
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.params.provider.Arguments;
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
-HBaseClassTestRule.forClass(TestWALCellCodecWithCompression.class);
+@Tag(RegionServerTests.TAG)
+@Tag(SmallTests.TAG)
+@HBaseParameterizedTestTemplate
+public class TestWALCellCodecWithCompression {
- private Compression.Algorithm compression;
+ private final Compression.Algorithm compression;
public TestWALCellCodecWithCompression(Compression.Algorithm algo) {
this.compression = algo;
}
- @Parameters
- public static List params() {
-return HBaseCommonTestingUtil.COMPRESSION_ALGORITHMS_PARAMETERIZED;
+ public static Stream parameters() {
+return
HBaseCommonTestingUtil.COMPRESSION_ALGORITHMS_PARAMETERIZED.stream().map(Arguments::of);
}
- @Test
+ @TestTemplate
public void testEncodeDecodeKVsWithTags() throws Exception {
doTest(false, false);
}
- @Test
+ @TestTemplate
public void testEncodeDecodeKVsWithTagsWithTagsCompression() throws
Exception {
doTest(true, false);
}
- @Test
+ @TestTemplate
public void testEncodeDecodeOffKVsWithTagsWithTagsCompression() throws
Exception {
doTest(true, false);
}
Review Comment:
see: HBASE-30128
--
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]
Re: [PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
liuxiaocs7 commented on code in PR #8151:
URL: https://github.com/apache/hbase/pull/8151#discussion_r3148494534
##
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALCellCodecWithCompression.java:
##
@@ -17,78 +17,71 @@
*/
package org.apache.hadoop.hbase.regionserver.wal;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Stream;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.ArrayBackedTag;
import org.apache.hadoop.hbase.ByteBufferKeyValue;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseCommonTestingUtil;
+import org.apache.hadoop.hbase.HBaseParameterizedTestTemplate;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.PrivateCellUtil;
-import org.apache.hadoop.hbase.Tag;
import org.apache.hadoop.hbase.codec.Codec.Decoder;
import org.apache.hadoop.hbase.codec.Codec.Encoder;
import org.apache.hadoop.hbase.io.compress.Compression;
import org.apache.hadoop.hbase.io.util.LRUDictionary;
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.util.Bytes;
-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.runners.Parameterized.Parameters;
-
-@Category({ RegionServerTests.class, SmallTests.class })
-@RunWith(Parameterized.class)
-public class TestWALCellCodecWithCompression {
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.params.provider.Arguments;
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
-HBaseClassTestRule.forClass(TestWALCellCodecWithCompression.class);
+@Tag(RegionServerTests.TAG)
+@Tag(SmallTests.TAG)
+@HBaseParameterizedTestTemplate
+public class TestWALCellCodecWithCompression {
- private Compression.Algorithm compression;
+ private final Compression.Algorithm compression;
public TestWALCellCodecWithCompression(Compression.Algorithm algo) {
this.compression = algo;
}
- @Parameters
- public static List params() {
-return HBaseCommonTestingUtil.COMPRESSION_ALGORITHMS_PARAMETERIZED;
+ public static Stream parameters() {
+return
HBaseCommonTestingUtil.COMPRESSION_ALGORITHMS_PARAMETERIZED.stream().map(Arguments::of);
}
- @Test
+ @TestTemplate
public void testEncodeDecodeKVsWithTags() throws Exception {
doTest(false, false);
}
- @Test
+ @TestTemplate
public void testEncodeDecodeKVsWithTagsWithTagsCompression() throws
Exception {
doTest(true, false);
}
- @Test
+ @TestTemplate
public void testEncodeDecodeOffKVsWithTagsWithTagsCompression() throws
Exception {
doTest(true, false);
}
Review Comment:
Will file another jira to resolve this issue
--
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]
Re: [PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
Copilot commented on code in PR #8151:
URL: https://github.com/apache/hbase/pull/8151#discussion_r3147731972
##
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALCellCodecWithCompression.java:
##
@@ -17,78 +17,71 @@
*/
package org.apache.hadoop.hbase.regionserver.wal;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Stream;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.ArrayBackedTag;
import org.apache.hadoop.hbase.ByteBufferKeyValue;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseCommonTestingUtil;
+import org.apache.hadoop.hbase.HBaseParameterizedTestTemplate;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.PrivateCellUtil;
-import org.apache.hadoop.hbase.Tag;
import org.apache.hadoop.hbase.codec.Codec.Decoder;
import org.apache.hadoop.hbase.codec.Codec.Encoder;
import org.apache.hadoop.hbase.io.compress.Compression;
import org.apache.hadoop.hbase.io.util.LRUDictionary;
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.util.Bytes;
-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.runners.Parameterized.Parameters;
-
-@Category({ RegionServerTests.class, SmallTests.class })
-@RunWith(Parameterized.class)
-public class TestWALCellCodecWithCompression {
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.params.provider.Arguments;
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
-HBaseClassTestRule.forClass(TestWALCellCodecWithCompression.class);
+@Tag(RegionServerTests.TAG)
+@Tag(SmallTests.TAG)
+@HBaseParameterizedTestTemplate
+public class TestWALCellCodecWithCompression {
- private Compression.Algorithm compression;
+ private final Compression.Algorithm compression;
public TestWALCellCodecWithCompression(Compression.Algorithm algo) {
this.compression = algo;
}
- @Parameters
- public static List params() {
-return HBaseCommonTestingUtil.COMPRESSION_ALGORITHMS_PARAMETERIZED;
+ public static Stream parameters() {
+return
HBaseCommonTestingUtil.COMPRESSION_ALGORITHMS_PARAMETERIZED.stream().map(Arguments::of);
}
- @Test
+ @TestTemplate
public void testEncodeDecodeKVsWithTags() throws Exception {
doTest(false, false);
}
- @Test
+ @TestTemplate
public void testEncodeDecodeKVsWithTagsWithTagsCompression() throws
Exception {
doTest(true, false);
}
- @Test
+ @TestTemplate
public void testEncodeDecodeOffKVsWithTagsWithTagsCompression() throws
Exception {
doTest(true, false);
}
Review Comment:
`testEncodeDecodeOffKVsWithTagsWithTagsCompression` currently calls
`doTest(true, false)`, which exercises the on-heap KV path. Given the test name
and `doTest(..., offheapKV)` signature, this should likely pass `true` for the
`offheapKV` argument so the off-heap encoding/decoding path is actually covered.
##
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALConfiguration.java:
##
@@ -17,58 +17,55 @@
*/
package org.apache.hadoop.hbase.regionserver.wal;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
-import java.util.Arrays;
+import java.util.stream.Stream;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.HBaseParameterizedTestTemplate;
import org.apache.hadoop.hbase.HBaseTestingUtil;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.wal.WAL;
import org.apache.hadoop.hbase.wal.WALFactory;
import org.apache.hadoop.hbase.wal.WALProvider;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TestName;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.BeforeEach
[PR] HBASE-30124 Upgrade hbase-server to use junit5 Part14 [hbase]
liuxiaocs7 opened a new pull request, #8151: URL: https://github.com/apache/hbase/pull/8151 - see: HBASE-30124 -- 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]
