Copilot commented on code in PR #8063:
URL: https://github.com/apache/hbase/pull/8063#discussion_r3080783029
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFilterListOnMini.java:
##########
@@ -128,7 +120,7 @@ public void testColumnPrefixFilterConcatWithOR() throws
Exception {
cellCount += result.listCells().size();
resultCount++;
}
- Assert.assertEquals(resultCount, 1);
- Assert.assertEquals(cellCount, 4);
+ assertEquals(resultCount, 1);
+ assertEquals(cellCount, 4);
Review Comment:
`assertEquals` in JUnit5 is `assertEquals(expected, actual)`, but these
calls pass `(actual, expected)`. This won't change pass/fail, but it will
produce misleading failure diagnostics. Swap the arguments to `assertEquals(1,
resultCount)` and `assertEquals(4, cellCount)`.
```suggestion
assertEquals(1, resultCount);
assertEquals(4, cellCount);
```
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/filter/FilterTestingCluster.java:
##########
@@ -94,21 +89,20 @@ private static void initialize(Configuration conf) {
try {
admin = TEST_UTIL.getAdmin();
} catch (MasterNotRunningException e) {
- assertNull("Master is not running", e);
+ assertNull(e, "Master is not running");
} catch (ZooKeeperConnectionException e) {
- assertNull("Cannot connect to ZooKeeper", e);
+ assertNull(e, "Cannot connect to ZooKeeper");
} catch (IOException e) {
- assertNull("IOException", e);
+ assertNull(e, "IOException");
}
}
- @BeforeClass
public static void setUp() throws Exception {
TEST_UTIL.startMiniCluster(1);
initialize(TEST_UTIL.getConfiguration());
}
Review Comment:
The `setUp` method is no longer annotated (JUnit4 `@BeforeClass` was
removed), so subclasses won't automatically start the mini cluster under
JUnit5. Add `@BeforeAll` to this static method (and import
`org.junit.jupiter.api.BeforeAll`) so the base fixture runs reliably.
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestMultiRowRangeFilter.java:
##########
@@ -425,9 +415,10 @@ public void testMultiRowRangeFilterWithInclusive() throws
IOException {
}
@Test
- public void testMultiRowRangeFilterWithExclusive() throws IOException {
- tableName = TableName.valueOf(name.getMethodName());
+ public void testMultiRowRangeFilterWithExclusive(TestInfo testInfo) throws
IOException {
+ tableName = TableName.valueOf(testInfo.getTestMethod().get().getName());
TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD,
6000000);
+ TEST_UTIL.createTable(tableName, family, Integer.MAX_VALUE);
Review Comment:
This test creates the same table twice (`TEST_UTIL.createTable` is called on
the same `tableName` in consecutive lines). This will typically fail with a
'table already exists' error. Remove the redundant first call and keep only the
`Table ht = ...` creation (or create once and reuse).
```suggestion
```
--
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]