Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix unit test for OIDC #918

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void run() throws Throwable {
@Test
public void getCredentialsTest() throws ClientException {
String filePath = OIDCCredentialsProviderTest.class.getClassLoader().getResource("oidctoken").getPath();
final AlibabaCloudCredentialsProvider provider = new OIDCCredentialsProvider("roleArn", "providerArn", filePath, null, null);
final AlibabaCloudCredentialsProvider provider = new OIDCCredentialsProvider("roleArn", "providerArn", filePath, null, "us-west-1");
Assert.assertNotNull(provider);
ClientException ex = Assert.assertThrows(ClientException.class, new ThrowingRunnable() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ public void withRoleSessionDurationSecondsSmallerThan900Seconds() {
STSAssumeRoleSessionCredentialsProvider provider = new STSAssumeRoleSessionCredentialsProvider(credentials,
roleArn, clientProfile);
provider.withRoleSessionDurationSeconds(duration);

}

@Test
Expand All @@ -137,7 +136,6 @@ public void withRoleSessionDurationSecondsLargerThan3600Seconds() {
STSAssumeRoleSessionCredentialsProvider provider = new STSAssumeRoleSessionCredentialsProvider(credentials,
roleArn, clientProfile);
provider.withRoleSessionDurationSeconds(duration);

}

@Test
Expand Down Expand Up @@ -193,6 +191,5 @@ public void getCredentialsReturnPreviousCredentials() throws ClientException {

AlibabaCloudCredentials credentials3 = provider.getCredentials();
Assert.assertEquals(credentials2, credentials3);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,25 @@ public void testGetSetHttpProxy() {
Assert.assertNull(EnvironmentUtils.getHttpProxy());
EnvironmentUtils.setHttpProxy("http://www.aliyun.com");
Assert.assertEquals("http://www.aliyun.com", EnvironmentUtils.getHttpProxy());
// reset http proxy
EnvironmentUtils.setHttpProxy(null);
}

@Test
public void testGetSetHttpsProxy() {
Assert.assertNull(EnvironmentUtils.getHttpsProxy());
EnvironmentUtils.setHttpsProxy("https://www.aliyun.com");
Assert.assertEquals("https://www.aliyun.com", EnvironmentUtils.getHttpsProxy());
// reset https proxy
EnvironmentUtils.setHttpsProxy(null);
}

@Test
public void testGetSetNoProxy() {
Assert.assertNull(EnvironmentUtils.getNoProxy());
EnvironmentUtils.setNoProxy("https://www.aliyun.com");
Assert.assertEquals("https://www.aliyun.com", EnvironmentUtils.getNoProxy());
// reset no proxy
EnvironmentUtils.setNoProxy(null);
}
}
Loading