-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HDFS-12431. [JDK17] Upgrade JUnit from 4 to 5 in hadoop-hdfs Part11. #7864
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
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,19 +31,20 @@ | |
import org.apache.hadoop.hdfs.protocol.DirectoryListing; | ||
import org.apache.hadoop.hdfs.protocol.HdfsFileStatus; | ||
import org.apache.hadoop.util.ExitUtil; | ||
import org.junit.After; | ||
import org.junit.Assert; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.Timeout; | ||
|
||
public class TestNNThroughputBenchmark { | ||
|
||
@BeforeClass | ||
public static void setUp() { | ||
@BeforeAll | ||
public static void setUp() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check style issue. |
||
ExitUtil.disableSystemExit(); | ||
} | ||
|
||
@After | ||
@AfterEach | ||
public void cleanUp() { | ||
FileUtil.fullyDeleteContents(new File(MiniDFSCluster.getBaseDirectory())); | ||
} | ||
|
@@ -66,7 +67,8 @@ public void testNNThroughput() throws Exception { | |
* This test runs all benchmarks defined in {@link NNThroughputBenchmark}, | ||
* with explicit local -fs option. | ||
*/ | ||
@Test(timeout = 120000) | ||
@Test | ||
@Timeout(value = 120) | ||
public void testNNThroughputWithFsOption() throws Exception { | ||
Configuration conf = new HdfsConfiguration(); | ||
conf.setInt(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, 16); | ||
|
@@ -81,7 +83,8 @@ public void testNNThroughputWithFsOption() throws Exception { | |
/** | ||
* This test runs {@link NNThroughputBenchmark} against a mini DFS cluster. | ||
*/ | ||
@Test(timeout = 120000) | ||
@Test | ||
@Timeout(value = 120) | ||
public void testNNThroughputAgainstRemoteNN() throws Exception { | ||
final Configuration conf = new HdfsConfiguration(); | ||
conf.setInt(DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY, 16); | ||
|
@@ -106,7 +109,8 @@ public void testNNThroughputAgainstRemoteNN() throws Exception { | |
* Ranger since only super user e.g. hdfs can enter/exit safemode | ||
* but any request from super user is not sent for authorization). | ||
*/ | ||
@Test(timeout = 120000) | ||
@Test | ||
@Timeout(value = 120) | ||
public void testNNThroughputAgainstRemoteNNNonSuperUser() throws Exception { | ||
final Configuration conf = new HdfsConfiguration(); | ||
conf.setInt(DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY, 16); | ||
|
@@ -128,7 +132,8 @@ public void testNNThroughputAgainstRemoteNNNonSuperUser() throws Exception { | |
* This test runs {@link NNThroughputBenchmark} against a mini DFS cluster | ||
* with explicit -fs option. | ||
*/ | ||
@Test(timeout = 120000) | ||
@Test | ||
@Timeout(value = 120) | ||
public void testNNThroughputRemoteAgainstNNWithFsOption() throws Exception { | ||
final Configuration conf = new HdfsConfiguration(); | ||
conf.setInt(DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY, 16); | ||
|
@@ -153,7 +158,8 @@ public void testNNThroughputRemoteAgainstNNWithFsOption() throws Exception { | |
* This test runs {@link NNThroughputBenchmark} against a mini DFS cluster | ||
* for append operation. | ||
*/ | ||
@Test(timeout = 120000) | ||
@Test | ||
@Timeout(value = 120) | ||
public void testNNThroughputForAppendOp() throws Exception { | ||
final Configuration conf = new HdfsConfiguration(); | ||
conf.setInt(DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY, 16); | ||
|
@@ -178,10 +184,10 @@ public void testNNThroughputForAppendOp() throws Exception { | |
listing = fsNamesystem.getListing("/", HdfsFileStatus.EMPTY_NAME, false); | ||
HdfsFileStatus[] partialListingAfter = listing.getPartialListing(); | ||
|
||
Assert.assertEquals(partialListing.length, partialListingAfter.length); | ||
Assertions.assertEquals(partialListing.length, partialListingAfter.length); | ||
for (int i = 0; i < partialListing.length; i++) { | ||
//Check the modification time after append operation | ||
Assert.assertNotEquals(partialListing[i].getModificationTime(), | ||
Assertions.assertNotEquals(partialListing[i].getModificationTime(), | ||
partialListingAfter[i].getModificationTime()); | ||
} | ||
|
||
|
@@ -196,7 +202,8 @@ public void testNNThroughputForAppendOp() throws Exception { | |
* This test runs {@link NNThroughputBenchmark} against a mini DFS cluster | ||
* for block report operation. | ||
*/ | ||
@Test(timeout = 120000) | ||
@Test | ||
@Timeout(value = 120) | ||
public void testNNThroughputForBlockReportOp() throws Exception { | ||
final Configuration conf = new HdfsConfiguration(); | ||
conf.setInt(DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY, 16); | ||
|
@@ -217,7 +224,8 @@ public void testNNThroughputForBlockReportOp() throws Exception { | |
* This test runs {@link NNThroughputBenchmark} against a mini DFS cluster | ||
* with explicit -baseDirName option. | ||
*/ | ||
@Test(timeout = 120000) | ||
@Test | ||
@Timeout(value = 120) | ||
public void testNNThroughputWithBaseDir() throws Exception { | ||
final Configuration conf = new HdfsConfiguration(); | ||
conf.setInt(DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY, 16); | ||
|
@@ -233,13 +241,13 @@ public void testNNThroughputWithBaseDir() throws Exception { | |
NNThroughputBenchmark.runBenchmark(benchConf, | ||
new String[] {"-op", "create", "-keepResults", "-files", "3", "-baseDirName", | ||
"/nnThroughputBenchmark1", "-close"}); | ||
Assert.assertTrue(fs.exists(new Path("/nnThroughputBenchmark1"))); | ||
Assert.assertFalse(fs.exists(new Path("/nnThroughputBenchmark"))); | ||
Assertions.assertTrue(fs.exists(new Path("/nnThroughputBenchmark1"))); | ||
Assertions.assertFalse(fs.exists(new Path("/nnThroughputBenchmark"))); | ||
|
||
NNThroughputBenchmark.runBenchmark(benchConf, | ||
new String[] {"-op", "all", "-baseDirName", "/nnThroughputBenchmark1"}); | ||
Assert.assertTrue(fs.exists(new Path("/nnThroughputBenchmark1"))); | ||
Assert.assertFalse(fs.exists(new Path("/nnThroughputBenchmark"))); | ||
Assertions.assertTrue(fs.exists(new Path("/nnThroughputBenchmark1"))); | ||
Assertions.assertFalse(fs.exists(new Path("/nnThroughputBenchmark"))); | ||
} finally { | ||
if (cluster != null) { | ||
cluster.shutdown(); | ||
|
@@ -251,7 +259,8 @@ public void testNNThroughputWithBaseDir() throws Exception { | |
* This test runs {@link NNThroughputBenchmark} against a mini DFS cluster | ||
* for blockSize with letter suffix. | ||
*/ | ||
@Test(timeout = 120000) | ||
@Test | ||
@Timeout(value = 120) | ||
public void testNNThroughputForBlockSizeWithLetterSuffix() throws Exception { | ||
final Configuration conf = new HdfsConfiguration(); | ||
conf.setInt(DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY, 16); | ||
|
@@ -271,7 +280,8 @@ public void testNNThroughputForBlockSizeWithLetterSuffix() throws Exception { | |
* This test runs {@link NNThroughputBenchmark} against a mini DFS cluster | ||
* with explicit -blockSize option. | ||
*/ | ||
@Test(timeout = 120000) | ||
@Test | ||
@Timeout(value = 120) | ||
public void testNNThroughputWithBlockSize() throws Exception { | ||
final Configuration conf = new HdfsConfiguration(); | ||
conf.setInt(DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY, 16); | ||
|
@@ -290,7 +300,8 @@ public void testNNThroughputWithBlockSize() throws Exception { | |
* This test runs {@link NNThroughputBenchmark} against a mini DFS cluster | ||
* with explicit -blockSize option like 1m. | ||
*/ | ||
@Test(timeout = 120000) | ||
@Test | ||
@Timeout(value = 120) | ||
public void testNNThroughputBlockSizeArgWithLetterSuffix() throws Exception { | ||
final Configuration conf = new HdfsConfiguration(); | ||
conf.setInt(DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY, 16); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract to
import