Skip to content

Commit 89e75c4

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 e7561c6 commit 89e75c4

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
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;
2625

2726
import java.io.BufferedReader;
2827
import java.io.File;
@@ -31,8 +30,6 @@
3130
import java.util.Map;
3231

3332
import org.apache.commons.io.FileUtils;
34-
import org.apache.commons.lang3.JavaVersion;
35-
import org.apache.commons.lang3.SystemUtils;
3633
import org.apache.commons.vfs2.FileObject;
3734
import org.apache.commons.vfs2.FileSystemException;
3835
import org.apache.commons.vfs2.FileType;
@@ -49,6 +46,10 @@
4946
import org.junit.jupiter.api.AfterEach;
5047
import org.junit.jupiter.api.BeforeAll;
5148
import org.junit.jupiter.api.Test;
49+
import org.junit.jupiter.api.condition.DisabledForJreRange;
50+
import org.junit.jupiter.api.condition.DisabledOnOs;
51+
import org.junit.jupiter.api.condition.JRE;
52+
import org.junit.jupiter.api.condition.OS;
5253

5354
/**
5455
* This test class uses the Hadoop MiniDFSCluster class to create an embedded Hadoop cluster.
@@ -57,6 +58,8 @@
5758
* </p>
5859
*/
5960
@SuppressWarnings("resource")
61+
@DisabledForJreRange(min = JRE.JAVA_23)
62+
@DisabledOnOs(OS.WINDOWS)
6063
public class HdfsFileProviderTest {
6164

6265
// Turn off the MiniDFSCluster logging
@@ -87,10 +90,6 @@ public class HdfsFileProviderTest {
8790
* Will do nothing on Windows.
8891
*/
8992
public static void setUmask(final Configuration config) {
90-
if (SystemUtils.IS_OS_WINDOWS) {
91-
return;
92-
}
93-
9493
try {
9594
final Process p = Runtime.getRuntime().exec("/bin/sh -c umask");
9695
final BufferedReader bri = new BufferedReader(new InputStreamReader(p.getInputStream()));
@@ -108,7 +107,6 @@ public static void setUmask(final Configuration config) {
108107

109108
@BeforeAll
110109
public static void setUp() throws Exception {
111-
assumeTrue(SystemUtils.isJavaVersionAtMost(JavaVersion.JAVA_22));
112110
System.setProperty("test.basedir", "../commons-vfs2/target/test-classes/test-data");
113111
Logger.getRootLogger().setLevel(Level.ERROR);
114112

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,15 @@
1717
package org.apache.commons.vfs2.provider.hdfs;
1818

1919
import static org.apache.commons.vfs2.VfsTestUtils.getTestDirectoryFile;
20-
import static org.junit.jupiter.api.Assertions.fail;
2120
import static org.junit.jupiter.api.Assertions.assertTrue;
21+
import static org.junit.jupiter.api.Assertions.fail;
2222

2323
import java.io.File;
2424
import java.io.IOException;
2525
import java.util.Objects;
2626

2727
import org.apache.commons.io.FileUtils;
2828
import org.apache.commons.io.file.PathUtils;
29-
import org.apache.commons.lang3.SystemUtils;
3029
import org.apache.commons.vfs2.AbstractProviderTestConfig;
3130
import org.apache.commons.vfs2.FileObject;
3231
import org.apache.commons.vfs2.FileSystemManager;
@@ -41,17 +40,22 @@
4140
import org.apache.log4j.Level;
4241
import org.apache.log4j.Logger;
4342
import org.junit.jupiter.api.Assertions;
43+
import org.junit.jupiter.api.condition.DisabledForJreRange;
44+
import org.junit.jupiter.api.condition.DisabledOnJre;
4445
import org.junit.jupiter.api.condition.DisabledOnOs;
46+
import org.junit.jupiter.api.condition.JRE;
4547
import org.junit.jupiter.api.condition.OS;
4648

4749
/**
4850
* This test class uses the Hadoop MiniDFSCluster class to create an embedded Hadoop cluster.
4951
* <P>
5052
* This will only work on systems that Hadoop supports.
5153
*/
52-
@DisabledOnOs(value = OS.WINDOWS)
54+
@DisabledForJreRange(min = JRE.JAVA_23)
55+
@DisabledOnOs(OS.WINDOWS)
5356
public class HdfsFileProviderTestCase extends AbstractProviderTestConfig {
5457

58+
@DisabledForJreRange(min = JRE.JAVA_23)
5559
@DisabledOnOs(value = OS.WINDOWS)
5660
public static class HdfsProviderTestSuite extends ProviderTestSuiteJunit5 {
5761

@@ -140,8 +144,6 @@ protected void tearDown() throws Exception {
140144

141145
private static MiniDFSCluster cluster;
142146

143-
144-
145147
/**
146148
* Returns the base folder for read tests.
147149
*/

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,18 @@
1818

1919
import org.apache.commons.vfs2.provider.hdfs.HdfsFileProviderTestCase.HdfsProviderTestSuite;
2020
import org.junit.jupiter.api.TestInstance;
21+
import org.junit.jupiter.api.condition.DisabledForJreRange;
22+
import org.junit.jupiter.api.condition.DisabledOnJre;
2123
import org.junit.jupiter.api.condition.DisabledOnOs;
24+
import org.junit.jupiter.api.condition.JRE;
2225
import org.junit.jupiter.api.condition.OS;
2326

2427
/**
2528
* JUnit 5 test suite for HDFS provider (JUnit 5).
2629
*/
2730
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
28-
@DisabledOnOs(value = OS.WINDOWS)
31+
@DisabledForJreRange(min = JRE.JAVA_23)
32+
@DisabledOnOs(OS.WINDOWS)
2933
public class HdfsProviderSuiteTest extends HdfsProviderTestSuite {
3034

3135
public HdfsProviderSuiteTest() throws Exception {

0 commit comments

Comments
 (0)