Skip to content

Commit 5b15268

Browse files
committed
Disable HDFS tests on Java 23 and above
java.lang.UnsupportedOperationException: getSubject is not supported at java.base/javax.security.auth.Subject.getSubject(Subject.java:277) at org.apache.hadoop.security.UserGroupInformation.getCurrentUser(UserGroupInformation.java:588) at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:887) at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:851) at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1396) at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:495) at org.apache.hadoop.hdfs.DFSTestUtil.formatNameNode(DFSTestUtil.java:256) at org.apache.hadoop.hdfs.MiniDFSCluster.configureNameService(MiniDFSCluster.java:1158) at org.apache.hadoop.hdfs.MiniDFSCluster.createNameNodesAndSetConf(MiniDFSCluster.java:1042) at org.apache.hadoop.hdfs.MiniDFSCluster.initMiniDFSCluster(MiniDFSCluster.java:974) at org.apache.hadoop.hdfs.MiniDFSCluster.<init>(MiniDFSCluster.java:594) at org.apache.hadoop.hdfs.MiniDFSCluster$Builder.build(MiniDFSCluster.java:533) at org.apache.commons.vfs2.provider.hdfs.HdfsFileProviderTest.setUp(HdfsFileProviderTest.java:128)
1 parent 02fbd83 commit 5b15268

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

commons-vfs2-hdfs/src/test/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileProviderTest.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import static org.junit.jupiter.api.Assertions.assertNotNull;
2323
import static org.junit.jupiter.api.Assertions.assertThrows;
2424
import static org.junit.jupiter.api.Assertions.assertTrue;
25+
import static org.junit.jupiter.api.Assumptions.assumeTrue;
2526

2627
import java.io.BufferedReader;
2728
import java.io.File;
@@ -30,6 +31,7 @@
3031
import java.util.Map;
3132

3233
import org.apache.commons.io.FileUtils;
34+
import org.apache.commons.lang3.JavaVersion;
3335
import org.apache.commons.lang3.SystemUtils;
3436
import org.apache.commons.vfs2.FileObject;
3537
import org.apache.commons.vfs2.FileSystemException;
@@ -47,16 +49,14 @@
4749
import org.junit.jupiter.api.AfterEach;
4850
import org.junit.jupiter.api.BeforeAll;
4951
import org.junit.jupiter.api.Test;
50-
import org.junit.jupiter.api.condition.DisabledOnOs;
51-
import org.junit.jupiter.api.condition.OS;
5252

5353
/**
5454
* This test class uses the Hadoop MiniDFSCluster class to create an embedded Hadoop cluster.
55-
* <P>
55+
* <p>
5656
* This will only work on systems that Hadoop supports.
57+
* </p>
5758
*/
5859
@SuppressWarnings("resource")
59-
@DisabledOnOs(value = OS.WINDOWS)
6060
public class HdfsFileProviderTest {
6161

6262
// Turn off the MiniDFSCluster logging
@@ -108,6 +108,7 @@ public static void setUmask(final Configuration config) {
108108

109109
@BeforeAll
110110
public static void setUp() throws Exception {
111+
assumeTrue(SystemUtils.isJavaVersionAtMost(JavaVersion.JAVA_22));
111112
System.setProperty("test.basedir", "../commons-vfs2/target/test-classes/test-data");
112113
Logger.getRootLogger().setLevel(Level.ERROR);
113114

@@ -140,7 +141,9 @@ public static void tearDown() throws Exception {
140141
if (null != hdfs) {
141142
hdfs.close();
142143
}
143-
manager.close();
144+
if (manager != null) {
145+
manager.close();
146+
}
144147
}
145148

146149
@AfterEach

0 commit comments

Comments
 (0)