Copilot commented on code in PR #8125:
URL: https://github.com/apache/hbase/pull/8125#discussion_r3142147830
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRollingRestart.java:
##########
@@ -99,8 +103,7 @@ public void testBasicRollingRestart() throws Exception {
cluster.waitForActiveAndReadyMaster();
// Create a table with regions
- final TableName tableName =
- TableName.valueOf(name.getMethodName().replaceAll("[\\[|\\]]", "-"));
+ final TableName tableName = TableName.valueOf(testMethodName);
byte[] family = Bytes.toBytes("family");
Review Comment:
This test starts a MiniHBaseCluster inside the test body and only shuts it
down at the end of the method. If any assertion/exception occurs before the
shutdown call, the mini cluster may be left running and can cause subsequent
tests to hang or interfere with each other. Consider moving the shutdown to an
@AfterEach/@AfterAll hook or wrapping the test body in a try/finally that
always calls shutdownMiniCluster().
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterOperationsForRegionReplicas.java:
##########
@@ -383,7 +381,7 @@ private void
validateSingleRegionServerAssignment(Connection connection, int num
Map<RegionInfo, ServerName> regionToServerMap =
snapshot.getRegionToRegionServerMap();
assertEquals(regionToServerMap.size(), numRegions * numReplica + 1);
Map<ServerName, List<RegionInfo>> serverToRegionMap =
snapshot.getRegionServerToRegionMap();
- assertEquals("One Region Only", 1, serverToRegionMap.keySet().size());
+ assertEquals(1, serverToRegionMap.keySet().size(), "One Region Only");
Review Comment:
JUnit Jupiter's assertEquals signature is assertEquals(expected, actual,
message). Here the arguments are reversed (size() is passed as expected and the
computed value as actual), which makes assertion failure output harder to
interpret. Please swap the first two arguments so the expected value is
`numRegions * numReplica + 1` and the actual is `regionToServerMap.size()`.
--
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]