Skip to content

Commit c33d868

Browse files
HADOOP-19210. S3A: Speed up some slow unit tests (apache#6907)
Speed up slow tests * TestS3AAWSCredentialsProvider: decrease thread pool shutdown time * TestS3AInputStreamRetry: reduce retry limit and intervals Contributed by Steve Loughran
1 parent 134dcf1 commit c33d868

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/AbstractS3AMockTest.java

+9
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ public Configuration createConfiguration() {
8080
conf.setInt(ASYNC_DRAIN_THRESHOLD, Integer.MAX_VALUE);
8181
// set the region to avoid the getBucketLocation on FS init.
8282
conf.set(AWS_REGION, "eu-west-1");
83+
84+
// tight retry logic as all failures are simulated
85+
final String interval = "1ms";
86+
final int limit = 3;
87+
conf.set(RETRY_THROTTLE_INTERVAL, interval);
88+
conf.setInt(RETRY_THROTTLE_LIMIT, limit);
89+
conf.set(RETRY_INTERVAL, interval);
90+
conf.setInt(RETRY_LIMIT, limit);
91+
8392
return conf;
8493
}
8594

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AAWSCredentialsProvider.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ public class TestS3AAWSCredentialsProvider extends AbstractS3ATestBase {
8686

8787
private static final Logger LOG = LoggerFactory.getLogger(TestS3AAWSCredentialsProvider.class);
8888

89+
public static final int TERMINATION_TIMEOUT = 3;
90+
8991
@Test
9092
public void testProviderWrongClass() throws Exception {
9193
expectProviderInstantiationFailure(this.getClass(),
@@ -579,7 +581,7 @@ protected AwsCredentials createCredentials(Configuration config) throws IOExcept
579581
}
580582
}
581583

582-
private static final int CONCURRENT_THREADS = 10;
584+
private static final int CONCURRENT_THREADS = 4;
583585

584586
@Test
585587
public void testConcurrentAuthentication() throws Throwable {
@@ -619,7 +621,7 @@ public void testConcurrentAuthentication() throws Throwable {
619621
"expectedSecret", credentials.secretAccessKey());
620622
}
621623
} finally {
622-
pool.awaitTermination(10, TimeUnit.SECONDS);
624+
pool.awaitTermination(TERMINATION_TIMEOUT, TimeUnit.SECONDS);
623625
pool.shutdown();
624626
}
625627

@@ -685,7 +687,7 @@ public void testConcurrentAuthenticationError() throws Throwable {
685687
);
686688
}
687689
} finally {
688-
pool.awaitTermination(10, TimeUnit.SECONDS);
690+
pool.awaitTermination(TERMINATION_TIMEOUT, TimeUnit.SECONDS);
689691
pool.shutdown();
690692
}
691693

0 commit comments

Comments
 (0)