Skip to content

Commit e9ac904

Browse files
authored
Make test more reliable (#6396)
- Increase timeouts across the board to better ensure things are propagated - Separately wait for new credentials to become valid before moving on.
1 parent 4d13d77 commit e9ac904

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

services/sts/src/it/java/software/amazon/awssdk/services/sts/AssumeRoleIntegrationTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public static void setup() {
109109
Waiter.run(() -> iam.createRole(r -> r.roleName(ROLE_NAME)
110110
.assumeRolePolicyDocument(rolePolicyDoc)))
111111
.ignoringException(MalformedPolicyDocumentException.class)
112-
.orFailAfter(Duration.ofMinutes(2));
112+
.orFailAfter(Duration.ofMinutes(4));
113113
} catch (EntityAlreadyExistsException e) {
114114
// Role already exists - awesome.
115115
}
@@ -129,11 +129,17 @@ public static void setup() {
129129
StsClient userCredentialSts = StsClient.builder()
130130
.credentialsProvider(() -> userCredentials)
131131
.build();
132+
133+
// Ensure the new credentials have propagated and are valid.
134+
Waiter.run(userCredentialSts::getCallerIdentity)
135+
.ignoringException(StsException.class)
136+
.orFailAfter(Duration.ofMinutes(2));
137+
132138
Waiter.run(() -> userCredentialSts.assumeRole(r -> r.durationSeconds(SESSION_DURATION)
133139
.roleArn(ROLE_ARN)
134140
.roleSessionName("Test")))
135141
.ignoringException(StsException.class)
136-
.orFailAfter(Duration.ofMinutes(5));
142+
.orFailAfter(Duration.ofMinutes(8));
137143
}
138144

139145
@AfterClass

0 commit comments

Comments
 (0)