HDFS-16527. Add global timeout rule for TestRouterDistCpProcedure (#4129)

Reviewed-by: Inigo Goiri <inigoiri@apache.org>
Reviewed-by: Ayush Saxena <ayushsaxena@apache.org>
Signed-off-by: Akira Ajisaka <aajisaka@apache.org>
This commit is contained in:
litao 2022-04-06 13:34:24 +08:00 committed by GitHub
parent 4ef1d3eef9
commit 966b773a7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,7 +33,9 @@
import org.apache.hadoop.tools.fedbalance.procedure.BalanceProcedureScheduler;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.Timeout;
import java.io.IOException;
import java.io.OutputStream;
@ -44,6 +46,7 @@
import java.io.ByteArrayInputStream;
import java.net.URI;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import static junit.framework.TestCase.assertTrue;
import static org.apache.hadoop.tools.fedbalance.FedBalanceConfigs.SCHEDULER_JOURNAL_URI;
@ -74,6 +77,11 @@ public class TestDistCpProcedure {
new FileEntry(SRCDAT + "/b/c", false)};
private static String nnUri;
@Rule
// There are multiple unit tests with different timeouts that fail multiple times because of
// DataStreamer#waitAndQueuePacket, so we set a larger global timeout.
public Timeout globalTimeout = new Timeout(180000, TimeUnit.MILLISECONDS);
@BeforeClass
public static void beforeClass() throws IOException {
DistCpProcedure.enableForTest();
@ -98,7 +106,7 @@ public static void afterClass() {
}
}
@Test(timeout = 90000)
@Test
public void testSuccessfulDistCpProcedure() throws Exception {
String testRoot = nnUri + "/user/foo/testdir." + getMethodName();
DistributedFileSystem fs =
@ -140,7 +148,7 @@ public void testSuccessfulDistCpProcedure() throws Exception {
cleanup(fs, new Path(testRoot));
}
@Test(timeout = 30000)
@Test
public void testInitDistCp() throws Exception {
String testRoot = nnUri + "/user/foo/testdir." + getMethodName();
DistributedFileSystem fs =
@ -198,7 +206,7 @@ public void testDiffThreshold() throws Exception {
cleanup(fs, new Path(testRoot));
}
@Test(timeout = 30000)
@Test
public void testDiffDistCp() throws Exception {
String testRoot = nnUri + "/user/foo/testdir." + getMethodName();
DistributedFileSystem fs =
@ -235,7 +243,7 @@ public void testDiffDistCp() throws Exception {
cleanup(fs, new Path(testRoot));
}
@Test(timeout = 30000)
@Test
public void testStageFinalDistCp() throws Exception {
String testRoot = nnUri + "/user/foo/testdir." + getMethodName();
DistributedFileSystem fs =
@ -260,7 +268,7 @@ public void testStageFinalDistCp() throws Exception {
cleanup(fs, new Path(testRoot));
}
@Test(timeout = 30000)
@Test
public void testStageFinish() throws Exception {
String testRoot = nnUri + "/user/foo/testdir." + getMethodName();
DistributedFileSystem fs =
@ -293,7 +301,7 @@ public void testStageFinish() throws Exception {
cleanup(fs, new Path(testRoot));
}
@Test(timeout = 30000)
@Test
public void testRecoveryByStage() throws Exception {
String testRoot = nnUri + "/user/foo/testdir." + getMethodName();
DistributedFileSystem fs =
@ -334,7 +342,7 @@ public void testRecoveryByStage() throws Exception {
cleanup(fs, new Path(testRoot));
}
@Test(timeout = 30000)
@Test
public void testShutdown() throws Exception {
String testRoot = nnUri + "/user/foo/testdir." + getMethodName();
DistributedFileSystem fs =
@ -359,7 +367,7 @@ public void testShutdown() throws Exception {
cleanup(fs, new Path(testRoot));
}
@Test(timeout = 30000)
@Test
public void testDisableWrite() throws Exception {
String testRoot = nnUri + "/user/foo/testdir." + getMethodName();
DistributedFileSystem fs =