Skip to content

HADOOP-19427. [JDK17] Upgrade JUnit from 4 to 5 in hadoop-compat-bench. #7619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions hadoop-tools/hadoop-compat-bench/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,31 @@
<artifactId>mockito-inline</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
*/
package org.apache.hadoop.fs.compat.common;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.apache.hadoop.fs.compat.HdfsCompatTool;
import org.apache.hadoop.fs.compat.hdfs.HdfsCompatMiniCluster;
import org.apache.hadoop.fs.compat.hdfs.HdfsCompatTestCommand;
import org.apache.hadoop.conf.Configuration;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class TestHdfsCompatDefaultSuites {
@Test
Expand All @@ -35,7 +36,7 @@ public void testSuiteAll() throws Exception {
HdfsCompatCommand cmd = new HdfsCompatTestCommand(uri, "ALL", conf);
cmd.initialize();
HdfsCompatReport report = cmd.apply();
Assert.assertEquals(0, report.getFailedCase().size());
assertEquals(0, report.getFailedCase().size());
new HdfsCompatTool(conf).printReport(report, System.out);
} finally {
cluster.shutdown();
Expand All @@ -52,7 +53,7 @@ public void testSuiteTpcds() throws Exception {
HdfsCompatCommand cmd = new HdfsCompatTestCommand(uri, "TPCDS", conf);
cmd.initialize();
HdfsCompatReport report = cmd.apply();
Assert.assertEquals(0, report.getFailedCase().size());
assertEquals(0, report.getFailedCase().size());
new HdfsCompatTool(conf).printReport(report, System.out);
} finally {
cluster.shutdown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package org.apache.hadoop.fs.compat.common;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.apache.hadoop.fs.compat.HdfsCompatTool;
import org.apache.hadoop.fs.compat.hdfs.HdfsCompatMiniCluster;
Expand All @@ -25,8 +26,7 @@
import org.apache.hadoop.fs.compat.cases.HdfsCompatMkdirTestCases;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.lang.reflect.Field;
Expand All @@ -47,8 +47,8 @@ public void testDfsCompatibility() throws Exception {
HdfsCompatCommand cmd = new TestCommand(uri, suite, conf);
cmd.initialize();
HdfsCompatReport report = cmd.apply();
Assert.assertEquals(7, report.getPassedCase().size());
Assert.assertEquals(0, report.getFailedCase().size());
assertEquals(7, report.getPassedCase().size());
assertEquals(0, report.getFailedCase().size());
show(conf, report);
} finally {
if (cluster != null) {
Expand All @@ -65,8 +65,8 @@ public void testLocalFsCompatibility() throws Exception {
HdfsCompatCommand cmd = new TestCommand(uri, suite, conf);
cmd.initialize();
HdfsCompatReport report = cmd.apply();
Assert.assertEquals(1, report.getPassedCase().size());
Assert.assertEquals(6, report.getFailedCase().size());
assertEquals(1, report.getPassedCase().size());
assertEquals(6, report.getFailedCase().size());
show(conf, report);
cleanup(cmd, conf);
}
Expand All @@ -79,8 +79,8 @@ public void testFsCompatibilityWithSuite() throws Exception {
HdfsCompatCommand cmd = new TestCommand(uri, suite, conf);
cmd.initialize();
HdfsCompatReport report = cmd.apply();
Assert.assertEquals(0, report.getPassedCase().size());
Assert.assertEquals(6, report.getFailedCase().size());
assertEquals(0, report.getPassedCase().size());
assertEquals(6, report.getFailedCase().size());
show(conf, report);
cleanup(cmd, conf);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@
*/
package org.apache.hadoop.fs.compat.common;

import static org.junit.jupiter.api.Assertions.assertTrue;

import org.apache.hadoop.fs.compat.cases.HdfsCompatBasics;
import org.apache.hadoop.fs.FileSystem;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Disabled;

import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.Set;

public class TestHdfsCompatInterfaceCoverage {
@Test
@Ignore
@Disabled
public void testFsCompatibility() {
Set<String> publicMethods = getPublicInterfaces(FileSystem.class);
Set<String> targets = getTargets(HdfsCompatBasics.class);
for (String publicMethod : publicMethods) {
Assert.assertTrue("Method not tested: " + publicMethod,
targets.contains(publicMethod));
assertTrue(targets.contains(publicMethod),
"Method not tested: " + publicMethod);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
*/
package org.apache.hadoop.fs.compat.common;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.apache.commons.io.FileUtils;
import org.apache.hadoop.fs.compat.HdfsCompatTool;
import org.apache.hadoop.fs.compat.hdfs.HdfsCompatMiniCluster;
import org.apache.hadoop.fs.compat.hdfs.HdfsCompatTestCommand;
import org.apache.hadoop.fs.compat.hdfs.HdfsCompatTestShellScope;
import org.apache.hadoop.conf.Configuration;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;
Expand All @@ -36,13 +36,13 @@
public class TestHdfsCompatShellCommand {
private HdfsCompatMiniCluster cluster;

@Before
@BeforeEach
public void runCluster() throws IOException {
this.cluster = new HdfsCompatMiniCluster();
this.cluster.start();
}

@After
@AfterEach
public void shutdownCluster() {
this.cluster.shutdown();
this.cluster = null;
Expand All @@ -55,8 +55,8 @@ public void testDfsCompatibility() throws Exception {
HdfsCompatCommand cmd = new TestCommand(uri, conf);
cmd.initialize();
HdfsCompatReport report = cmd.apply();
Assert.assertEquals(3, report.getPassedCase().size());
Assert.assertEquals(0, report.getFailedCase().size());
assertEquals(3, report.getPassedCase().size());
assertEquals(0, report.getFailedCase().size());
show(conf, report);
}

Expand All @@ -67,8 +67,8 @@ public void testSkipCompatibility() throws Exception {
HdfsCompatCommand cmd = new TestSkipCommand(uri, conf);
cmd.initialize();
HdfsCompatReport report = cmd.apply();
Assert.assertEquals(2, report.getPassedCase().size());
Assert.assertEquals(0, report.getFailedCase().size());
assertEquals(2, report.getPassedCase().size());
assertEquals(0, report.getFailedCase().size());
show(conf, report);
}

Expand Down