You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "liuxiaocs7 (via GitHub)" <gi...@apache.org> on 2026/04/07 08:50:33 UTC
[PR] HBASE-30059 Upgrade hbase-server to use junit5 Part6 [hbase]
liuxiaocs7 opened a new pull request, #8028:
URL: https://github.com/apache/hbase/pull/8028
- see: HBASE-30059
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-30059 Upgrade hbase-server to use junit5 Part6 [hbase]
Posted by "liuxiaocs7 (via GitHub)" <gi...@apache.org>.
liuxiaocs7 commented on PR #8028:
URL: https://github.com/apache/hbase/pull/8028#issuecomment-4211204472
I checked that the number of unit tests was consistent before and after, and that the unit tests were run in the same way.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-30059 Upgrade hbase-server to use junit5 Part6 [hbase]
Posted by "liuxiaocs7 (via GitHub)" <gi...@apache.org>.
liuxiaocs7 merged PR #8028:
URL: https://github.com/apache/hbase/pull/8028
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-30059 Upgrade hbase-server to use junit5 Part6 [hbase]
Posted by "liuxiaocs7 (via GitHub)" <gi...@apache.org>.
liuxiaocs7 commented on code in PR #8028:
URL: https://github.com/apache/hbase/pull/8028#discussion_r3055298380
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestMasterAbortWhileMergingTable.java:
##########
@@ -17,10 +17,11 @@
*/
package org.apache.hadoop.hbase.master.assignment;
+import static org.junit.jupiter.api.Assertions.*;
Review Comment:
> avoid `*` import here
done in https://github.com/apache/hbase/pull/8028/changes/411b2053c3129d9d0c42b94d0a9b77d7efafd896
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-30059 Upgrade hbase-server to use junit5 Part6 [hbase]
Posted by "liuxiaocs7 (via GitHub)" <gi...@apache.org>.
liuxiaocs7 commented on code in PR #8028:
URL: https://github.com/apache/hbase/pull/8028#discussion_r3055283806
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestMasterAbortWhileMergingTable.java:
##########
@@ -17,10 +17,11 @@
*/
package org.apache.hadoop.hbase.master.assignment;
+import static org.junit.jupiter.api.Assertions.*;
Review Comment:
void `*` import
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-30059 Upgrade hbase-server to use junit5 Part6 [hbase]
Posted by "liuxiaocs7 (via GitHub)" <gi...@apache.org>.
liuxiaocs7 commented on code in PR #8028:
URL: https://github.com/apache/hbase/pull/8028#discussion_r3055283806
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestMasterAbortWhileMergingTable.java:
##########
@@ -17,10 +17,11 @@
*/
package org.apache.hadoop.hbase.master.assignment;
+import static org.junit.jupiter.api.Assertions.*;
Review Comment:
avoid `*` import here
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-30059 Upgrade hbase-server to use junit5 Part6 [hbase]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #8028:
URL: https://github.com/apache/hbase/pull/8028#discussion_r3055396036
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestModifyTableWhileMerging.java:
##########
@@ -98,8 +94,8 @@ public void test() throws Exception {
long proc = executor.submitProcedure(mergeTableRegionsProcedure);
UTIL.waitFor(3000000, () -> UTIL.getMiniHBaseCluster().getMaster().getMasterProcedureExecutor()
.isFinished(procModify));
- Assert.assertEquals("Modify Table procedure should success!",
- ProcedureProtos.ProcedureState.SUCCESS, modifyTableProcedure.getState());
+ assertEquals(modifyTableProcedure.getState(), ProcedureProtos.ProcedureState.SUCCESS,
Review Comment:
`assertEquals` argument order is reversed for JUnit Jupiter. The first argument should be the expected value and the second the actual value; otherwise assertion failure output will be misleading.
```suggestion
assertEquals(ProcedureProtos.ProcedureState.SUCCESS, modifyTableProcedure.getState(),
```
##########
hbase-common/src/test/java/org/apache/hadoop/hbase/TableNameTestExtension.java:
##########
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase;
+
+import org.junit.jupiter.api.extension.BeforeEachCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+/**
+ * Returns a {@code TableName} based on currently running test method name.
+ */
+public class TableNameTestExtension implements BeforeEachCallback {
+
+ private TableName tableName;
+
+ /**
+ * Helper to handle parameterized method names. Unlike regular test methods, parameterized method
+ * names look like 'foo[x]'. This is problematic for tests that use this name for HBase tables.
+ * This helper strips out the parameter suffixes.
+ * @return current test method name with out parameterized suffixes.
Review Comment:
Typo in Javadoc: "with out" should be "without" ("without parameterized suffixes").
```suggestion
* @return current test method name without parameterized suffixes.
```
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestExceptionInAssignRegion.java:
##########
@@ -98,14 +95,14 @@ public void testExceptionInAssignRegion() {
long prodId = procedureExecutor.submitProcedure(assignRegionProcedure);
ProcedureTestingUtility.waitProcedure(procedureExecutor, prodId);
- Assert.assertEquals("Should be two RS since other is aborted", 2,
- UTIL.getMiniHBaseCluster().getLiveRegionServerThreads().size());
- Assert.assertNull("RIT Map doesn't have correct value",
- getRegionServer(0).getRegionsInTransitionInRS().get(hri.getEncodedNameAsBytes()));
- Assert.assertNull("RIT Map doesn't have correct value",
- getRegionServer(1).getRegionsInTransitionInRS().get(hri.getEncodedNameAsBytes()));
- Assert.assertNull("RIT Map doesn't have correct value",
- getRegionServer(2).getRegionsInTransitionInRS().get(hri.getEncodedNameAsBytes()));
+ assertEquals(UTIL.getMiniHBaseCluster().getLiveRegionServerThreads().size(), 2,
Review Comment:
`assertEquals` argument order is reversed for JUnit Jupiter. Use `assertEquals(expected, actual, message)` so the failure diff reports the correct expected/actual values.
```suggestion
assertEquals(2, UTIL.getMiniHBaseCluster().getLiveRegionServerThreads().size(),
```
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestRogueRSAssignment.java:
##########
@@ -158,10 +153,10 @@ public void testReportRSWithWrongRegion() throws Exception {
// sending fake request to master
// TODO: replace YouAreDeadException with appropriate exception as and when necessary
- exception.expect(ServiceException.class);
- exception.expectCause(isA(YouAreDeadException.class));
- RegionServerStatusProtos.RegionServerReportResponse response =
- master.getMasterRpcServices().regionServerReport(null, request.build());
+ ServiceException exception = assertThrows(ServiceException.class,
+ () -> master.getMasterRpcServices().regionServerReport(null, request.build()));
+ org.hamcrest.MatcherAssert.assertThat((YouAreDeadException) exception.getCause(),
+ isA(YouAreDeadException.class));
Review Comment:
Avoid casting `exception.getCause()` to `YouAreDeadException` before asserting its type. The cast can throw `ClassCastException` and obscure the real failure; assert against the raw cause (or use `assertInstanceOf`) instead.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] HBASE-30059 Upgrade hbase-server to use junit5 Part6 [hbase]
Posted by "Apache9 (via GitHub)" <gi...@apache.org>.
Apache9 commented on code in PR #8028:
URL: https://github.com/apache/hbase/pull/8028#discussion_r3052209780
##########
hbase-common/src/test/java/org/apache/hadoop/hbase/TableNameTestExtension.java:
##########
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase;
+
+import org.junit.jupiter.api.extension.BeforeEachCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+/**
+ * Returns a {@code TableName} based on currently running test method name.
+ */
+public class TableNameTestExtension implements BeforeEachCallback {
Review Comment:
Good.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org