Copilot commented on code in PR #8000:
URL: https://github.com/apache/hbase/pull/8000#discussion_r3005185945


##########
hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestSecureWAL.java:
##########
@@ -89,19 +82,21 @@ public static void setUpBeforeClass() throws Exception {
     TEST_UTIL.startMiniDFSCluster(3);
   }
 
-  @AfterClass
+  @AfterAll
   public static void tearDownAfterClass() throws Exception {
     TEST_UTIL.shutdownMiniCluster();
   }
 
-  @Before
-  public void setUp() {
+  @BeforeEach
+  public void setUp(TestInfo testInfo) {
+    testMethodName = testInfo.getTestMethod().get().getName();
     TEST_UTIL.getConfiguration().set(WALFactory.WAL_PROVIDER, walProvider);
   }
 
-  @Test
+  @TestTemplate
   public void testSecureWAL() throws Exception {
-    TableName tableName = 
TableName.valueOf(name.getMethodName().replaceAll("[^a-zA-Z0-9]", "_"));
+    TableName tableName =
+      TableName.valueOf(testMethodName.replaceAll("[^a-zA-Z0-9]", "_"));
     NavigableMap<byte[], Integer> scopes = new 
TreeMap<>(Bytes.BYTES_COMPARATOR);

Review Comment:
   This class is executed as a `@TestTemplate` with multiple `walProvider` 
parameters, but `TableName` is derived only from the Java method name 
(`testSecureWAL`). Unlike the old JUnit4 Parameterized + TestName behavior, 
JUnit5's `testInfo.getTestMethod().get().getName()` does not include the 
invocation index/parameter value, so different parameter invocations will reuse 
the same table/WAL identifiers and can collide with leftover state (WAL files, 
dirs). Build the name from `testInfo.getDisplayName()` and/or `walProvider` 
(and keep the sanitization) to guarantee uniqueness per invocation, or 
explicitly clean the WAL root between invocations.



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