Skip to content

Commit

Permalink
HADOOP-19210. S3A: Speed up some slow unit tests (apache#6907)
Browse files Browse the repository at this point in the history

Speed up slow tests
* TestS3AAWSCredentialsProvider: decrease thread pool shutdown time
* TestS3AInputStreamRetry: reduce retry limit and intervals

Contributed by Steve Loughran
  • Loading branch information
steveloughran authored Jul 2, 2024
1 parent 134dcf1 commit c33d868
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ public Configuration createConfiguration() {
conf.setInt(ASYNC_DRAIN_THRESHOLD, Integer.MAX_VALUE);
// set the region to avoid the getBucketLocation on FS init.
conf.set(AWS_REGION, "eu-west-1");

// tight retry logic as all failures are simulated
final String interval = "1ms";
final int limit = 3;
conf.set(RETRY_THROTTLE_INTERVAL, interval);
conf.setInt(RETRY_THROTTLE_LIMIT, limit);
conf.set(RETRY_INTERVAL, interval);
conf.setInt(RETRY_LIMIT, limit);

return conf;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ public class TestS3AAWSCredentialsProvider extends AbstractS3ATestBase {

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

public static final int TERMINATION_TIMEOUT = 3;

@Test
public void testProviderWrongClass() throws Exception {
expectProviderInstantiationFailure(this.getClass(),
Expand Down Expand Up @@ -579,7 +581,7 @@ protected AwsCredentials createCredentials(Configuration config) throws IOExcept
}
}

private static final int CONCURRENT_THREADS = 10;
private static final int CONCURRENT_THREADS = 4;

@Test
public void testConcurrentAuthentication() throws Throwable {
Expand Down Expand Up @@ -619,7 +621,7 @@ public void testConcurrentAuthentication() throws Throwable {
"expectedSecret", credentials.secretAccessKey());
}
} finally {
pool.awaitTermination(10, TimeUnit.SECONDS);
pool.awaitTermination(TERMINATION_TIMEOUT, TimeUnit.SECONDS);
pool.shutdown();
}

Expand Down Expand Up @@ -685,7 +687,7 @@ public void testConcurrentAuthenticationError() throws Throwable {
);
}
} finally {
pool.awaitTermination(10, TimeUnit.SECONDS);
pool.awaitTermination(TERMINATION_TIMEOUT, TimeUnit.SECONDS);
pool.shutdown();
}

Expand Down

0 comments on commit c33d868

Please sign in to comment.