Skip to content

Commit

Permalink
Fix AWS Acceptance test assertion (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
usmansaleem authored Mar 23, 2023
1 parent f3b0096 commit 54c49bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ public Optional<String> fetchSecret(final String secretName) {
} catch (final ResourceNotFoundException e) {
return Optional.empty();
} catch (final SecretsManagerException e) {
throw new RuntimeException("Failed to fetch secret from AWS Secrets Manager.", e);
throw new RuntimeException(
"Failed to fetch secret from AWS Secrets Manager: " + e.getMessage(), e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void fetchSecretWithInvalidCredentialsReturnsEmpty() {
final String key = secretsMap.keySet().stream().findAny().orElseThrow();
assertThatExceptionOfType(RuntimeException.class)
.isThrownBy(() -> awsSecretsManagerInvalidCredentials.fetchSecret(key))
.withMessageContaining("Failed to fetch secret from AWS Secrets Manager.");
.withMessageContaining("Failed to fetch secret from AWS Secrets Manager");
}

@Test
Expand Down Expand Up @@ -396,7 +396,10 @@ void throwsAwayObjectsThatFailMapper() {

assertThat(fetchedKeys).containsAll(expectedKeys);
assertThat(fetchedKeys).doesNotContain(expectedKey);
assertThat(mappedResults.getErrorCount()).isEqualTo(1);
// we don't know the exact error count since this test is loading all the secrets from our live
// secret manager and
// some values fails to load due to read-only user doesn't have authentication on them.
assertThat(mappedResults.getErrorCount()).isGreaterThanOrEqualTo(1);
}

@Test
Expand Down

0 comments on commit 54c49bf

Please sign in to comment.