From 170668b994d4b9bc74b814b7b7f8096daabba12a Mon Sep 17 00:00:00 2001 From: slfan1989 <55643692+slfan1989@users.noreply.github.com> Date: Sat, 11 Jun 2022 05:11:21 -0700 Subject: [PATCH] HDFS-16609. Fix Flakes Junit Tests that often report timeouts. (#4382). Contributed by fanshilun. --- .../src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java | 2 +- .../test/java/org/apache/hadoop/hdfs/TestFileCreation.java | 4 ++-- .../hdfs/server/sps/TestExternalStoragePolicySatisfier.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java index 44c06e39ea..a00f21ecc9 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java @@ -1410,7 +1410,7 @@ private void confirmOwner(String owner, String group, } } - @Test (timeout = 30000) + @Test (timeout = 60000) public void testFilePermissions() throws IOException { Configuration conf = new HdfsConfiguration(); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestFileCreation.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestFileCreation.java index 406e1e6699..2c41c410ca 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestFileCreation.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestFileCreation.java @@ -273,7 +273,7 @@ public void testServerDefaultsWithMinimalCaching() throws Exception { defaults.getDefaultStoragePolicyId()); doReturn(newDefaults).when(spyNamesystem).getServerDefaults(); - // Verify that the value is updated correctly. Wait for 3 seconds. + // Verify that the value is updated correctly. Wait for 6 seconds. GenericTestUtils.waitFor(()->{ try { FsServerDefaults currDef = dfsClient.getServerDefaults(); @@ -282,7 +282,7 @@ public void testServerDefaultsWithMinimalCaching() throws Exception { // do nothing; return false; } - }, 1, 3000); + }, 1, 6000); } finally { cluster.shutdown(); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/sps/TestExternalStoragePolicySatisfier.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/sps/TestExternalStoragePolicySatisfier.java index 8012f30134..58d72f14d7 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/sps/TestExternalStoragePolicySatisfier.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/sps/TestExternalStoragePolicySatisfier.java @@ -1351,7 +1351,7 @@ public void testSPSWhenFileHasLowRedundancyBlocks() throws Exception { * 4. Set policy and call satisfyStoragePolicy for file. * 5. Block should be moved successfully. */ - @Test(timeout = 300000) + @Test(timeout = 600000) public void testSPSWhenFileHasExcessRedundancyBlocks() throws Exception { try { config.set(DFSConfigKeys