You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2026/10/15 02:54:03 UTC
(hbase) branch branch-3 updated: HBASE-30452 Exclude JUnit libraries from shaded testing util (#8755)
This is an automated email from the ASF dual-hosted git repository.
Apache9 pushed a commit to branch branch-3
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-3 by this push:
new c10be02ae03 HBASE-30452 Exclude JUnit libraries from shaded testing util (#8755)
c10be02ae03 is described below
commit c10be02ae03c35a782420f1b435041f07b6ea260
Author: Ma Zhengxuan <49...@users.noreply.github.com>
AuthorDate: Thu Oct 15 10:10:35 2026 +0800
HBASE-30452 Exclude JUnit libraries from shaded testing util (#8755)
Signed-off-by: Duo Zhang <zh...@apache.org>
Signed-off-by: Xiao Liu <li...@apache.org>
(cherry picked from commit eb8d19a6ddc931ee1e7a1562fd16c624c83a828f)
---
.../shaded/TestShadedTestingUtilJarContents.java | 54 ++++++++++++++++++++++
hbase-shaded/hbase-shaded-testing-util/pom.xml | 6 +++
2 files changed, 60 insertions(+)
diff --git a/hbase-shaded/hbase-shaded-testing-util-tester/src/test/java/org/apache/hbase/shaded/TestShadedTestingUtilJarContents.java b/hbase-shaded/hbase-shaded-testing-util-tester/src/test/java/org/apache/hbase/shaded/TestShadedTestingUtilJarContents.java
new file mode 100644
index 00000000000..c17fb6faade
--- /dev/null
+++ b/hbase-shaded/hbase-shaded-testing-util-tester/src/test/java/org/apache/hbase/shaded/TestShadedTestingUtilJarContents.java
@@ -0,0 +1,54 @@
+/*
+ * 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.hbase.shaded;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
+import java.io.File;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import org.apache.hadoop.hbase.HBaseTestingUtil;
+import org.apache.hadoop.hbase.testclassification.ClientTests;
+import org.apache.hadoop.hbase.testclassification.SmallTests;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+
+@Tag(ClientTests.TAG)
+@Tag(SmallTests.TAG)
+public class TestShadedTestingUtilJarContents {
+
+ @Test
+ public void testNoBundledJUnitLibraries() throws Exception {
+ File path =
+ new File(HBaseTestingUtil.class.getProtectionDomain().getCodeSource().getLocation().toURI());
+ try (JarFile jar = new JarFile(path)) {
+ JarEntry unexpectedEntry = jar.stream().filter(entry -> {
+ String name = entry.getName();
+ return name.startsWith("META-INF/services/org.junit.platform.") || name.endsWith(".class")
+ && (name.startsWith("org/junit/") && !name.equals("org/junit/Assert.class")
+ || name.startsWith("org/opentest4j/") || name.startsWith("org/apiguardian/")
+ || name.matches("META-INF/versions/[0-9]+/org/junit/.*"));
+ }).findFirst().orElse(null);
+ assertNull(unexpectedEntry, () -> "Unexpected bundled entry: " + unexpectedEntry);
+ // HBase's JUnit 4 shim is needed by bundled Hadoop test utilities.
+ assertNotNull(jar.getEntry("org/junit/Assert.class"));
+ assertNotNull(jar.getEntry("META-INF/services/org.junit.jupiter.api.extension.Extension"));
+ }
+ }
+}
diff --git a/hbase-shaded/hbase-shaded-testing-util/pom.xml b/hbase-shaded/hbase-shaded-testing-util/pom.xml
index 6d574f526f5..97895e23dfe 100644
--- a/hbase-shaded/hbase-shaded-testing-util/pom.xml
+++ b/hbase-shaded/hbase-shaded-testing-util/pom.xml
@@ -131,6 +131,12 @@
<exclude>org.javassist:*</exclude>
<exclude>io.opentelemetry:*</exclude>
<exclude>io.opentelemetry.semconv:*</exclude>
+ <!-- The test runner must provide a consistent JUnit version. -->
+ <exclude>junit:junit</exclude>
+ <exclude>org.junit.jupiter:*</exclude>
+ <exclude>org.junit.platform:*</exclude>
+ <exclude>org.opentest4j:opentest4j</exclude>
+ <exclude>org.apiguardian:apiguardian-api</exclude>
</excludes>
</artifactSet>
</configuration>