soisyourface commented on code in PR #197:
URL:
https://github.com/apache/flink-connector-aws/pull/197#discussion_r2060710873
##########
flink-connector-aws-base/src/test/java/org/apache/flink/connector/aws/util/AWSGeneralUtilTest.java:
##########
@@ -952,4 +958,41 @@ void
testNewInstanceOfDefaultCredentialsProviderCreatedForEachClient() {
return builder;
}
+
+ @Test
+ void testGetCredentialsProviderReturnsSsoProviderForSsoProfile() throws
IOException {
+ String profileName = "my-sso-profile";
+ String ssoStartUrl = "https://my-dummy-sso-portal.awsapps.com/start";
+ String ssoRegion = "us-east-1";
+ String ssoAccountId = "123456789012";
+ String ssoRoleName = "MyTestRole";
+
+ String configFileContent =
+ "[profile " + profileName + "]\n"
+ + "sso_start_url = " + ssoStartUrl + "\n"
+ + "sso_region = " + ssoRegion + "\n"
+ + "sso_account_id = " + ssoAccountId + "\n"
+ + "sso_role_name = " + ssoRoleName + "\n"
+ + "region = " + ssoRegion + "\n";
+
+ ProfileFile profileFile = ProfileFile.builder()
+ .content(new StringInputStream(configFileContent))
+ .type(ProfileFile.Type.CONFIGURATION)
+ .build();
+
+ Profile profile = profileFile.profile(profileName).orElseThrow();
+
+ ProfileProviderCredentialsContext context =
ProfileProviderCredentialsContext.builder()
+ .profile(profile)
+ .profileFile(profileFile)
+ .build();
+
+ SsoProfileCredentialsProviderFactory factory = new
SsoProfileCredentialsProviderFactory();
+
+ assertThatThrownBy(() -> factory.create(context))
+ .isInstanceOf(java.io.UncheckedIOException.class)
+ .hasRootCauseInstanceOf(java.nio.file.NoSuchFileException.class)
+ .hasMessageContaining(".aws/sso/cache/");
+ }
Review Comment:
this looks like a duplicate question/comment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]