Skip to content

Commit b1e0909

Browse files
committed
Fix failed test
1 parent e644134 commit b1e0909

1 file changed

Lines changed: 4 additions & 14 deletions

File tree

services/sts/src/test/java/software/amazon/awssdk/services/sts/auth/StsWebIdentityTokenCredentialProviderTest.java

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,6 @@ public void cleanUp(){
6060
ENVIRONMENT_VARIABLE_HELPER.reset();
6161
}
6262

63-
private void mockStsClientResponse(Instant expiration) {
64-
when(stsClient.assumeRoleWithWebIdentity(Mockito.any(AssumeRoleWithWebIdentityRequest.class)))
65-
.thenReturn(AssumeRoleWithWebIdentityResponse.builder()
66-
.credentials(Credentials.builder()
67-
.accessKeyId("key")
68-
.expiration(expiration)
69-
.sessionToken("session")
70-
.secretAccessKey("secret")
71-
.build())
72-
.build());
73-
}
74-
7563
@Test
7664
void createAssumeRoleWithWebIdentityTokenCredentialsProviderWithoutStsClient_throws_Exception() {
7765

@@ -100,9 +88,9 @@ void createAssumeRoleWithWebIdentityTokenCredentialsProviderStsClientBuilder() {
10088
StsWebIdentityTokenFileCredentialsProvider provider =
10189
StsWebIdentityTokenFileCredentialsProvider.builder().stsClient(stsClient)
10290
.refreshRequest(r -> r.build())
103-
.roleArn("someRole")
91+
.roleArn("someTestRole")
10492
.webIdentityTokenFile(Paths.get(webIdentityTokenPath))
105-
.roleSessionName("tempRoleSession")
93+
.roleSessionName("RoleSessionTemp")
10694
.build();
10795
when(stsClient.assumeRoleWithWebIdentity(Mockito.any(AssumeRoleWithWebIdentityRequest.class)))
10896
.thenReturn(AssumeRoleWithWebIdentityResponse.builder()
@@ -129,6 +117,8 @@ void createAssumeRoleWithWebIdentityTokenCredentialsProvider_raisesInResolveCred
129117

130118
@Test
131119
void customPrefetchTime_actuallyTriggersRefreshEarly() throws InterruptedException {
120+
Mockito.reset(stsClient);
121+
132122
Instant tokenExpiration = Instant.now().plusSeconds(8);
133123
Duration customPrefetchTime = Duration.ofSeconds(2);
134124
Duration customStaleTime = Duration.ofSeconds(1);

0 commit comments

Comments
 (0)