Skip to content

Commit 8742514

Browse files
JacksonTianyndu13
authored andcommitted
fix unit test for OIDC
1 parent 82dafe3 commit 8742514

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

aliyun-java-sdk-core/src/test/java/com/aliyuncs/auth/OIDCCredentialsProviderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void run() throws Throwable {
6666
@Test
6767
public void getCredentialsTest() throws ClientException {
6868
String filePath = OIDCCredentialsProviderTest.class.getClassLoader().getResource("oidctoken").getPath();
69-
final AlibabaCloudCredentialsProvider provider = new OIDCCredentialsProvider("roleArn", "providerArn", filePath, null, null);
69+
final AlibabaCloudCredentialsProvider provider = new OIDCCredentialsProvider("roleArn", "providerArn", filePath, null, "us-west-1");
7070
Assert.assertNotNull(provider);
7171
ClientException ex = Assert.assertThrows(ClientException.class, new ThrowingRunnable() {
7272
@Override

aliyun-java-sdk-core/src/test/java/com/aliyuncs/auth/STSAssumeRoleSessionCredentialsProviderTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ public void withRoleSessionDurationSecondsSmallerThan900Seconds() {
124124
STSAssumeRoleSessionCredentialsProvider provider = new STSAssumeRoleSessionCredentialsProvider(credentials,
125125
roleArn, clientProfile);
126126
provider.withRoleSessionDurationSeconds(duration);
127-
128127
}
129128

130129
@Test
@@ -137,7 +136,6 @@ public void withRoleSessionDurationSecondsLargerThan3600Seconds() {
137136
STSAssumeRoleSessionCredentialsProvider provider = new STSAssumeRoleSessionCredentialsProvider(credentials,
138137
roleArn, clientProfile);
139138
provider.withRoleSessionDurationSeconds(duration);
140-
141139
}
142140

143141
@Test
@@ -193,6 +191,5 @@ public void getCredentialsReturnPreviousCredentials() throws ClientException {
193191

194192
AlibabaCloudCredentials credentials3 = provider.getCredentials();
195193
Assert.assertEquals(credentials2, credentials3);
196-
197194
}
198195
}

aliyun-java-sdk-core/src/test/java/com/aliyuncs/utils/EnvironmentUtilsTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,25 @@ public void testGetSetHttpProxy() {
1515
Assert.assertNull(EnvironmentUtils.getHttpProxy());
1616
EnvironmentUtils.setHttpProxy("http://www.aliyun.com");
1717
Assert.assertEquals("http://www.aliyun.com", EnvironmentUtils.getHttpProxy());
18+
// reset http proxy
19+
EnvironmentUtils.setHttpProxy(null);
1820
}
1921

2022
@Test
2123
public void testGetSetHttpsProxy() {
2224
Assert.assertNull(EnvironmentUtils.getHttpsProxy());
2325
EnvironmentUtils.setHttpsProxy("https://www.aliyun.com");
2426
Assert.assertEquals("https://www.aliyun.com", EnvironmentUtils.getHttpsProxy());
27+
// reset https proxy
28+
EnvironmentUtils.setHttpsProxy(null);
2529
}
2630

2731
@Test
2832
public void testGetSetNoProxy() {
2933
Assert.assertNull(EnvironmentUtils.getNoProxy());
3034
EnvironmentUtils.setNoProxy("https://www.aliyun.com");
3135
Assert.assertEquals("https://www.aliyun.com", EnvironmentUtils.getNoProxy());
36+
// reset no proxy
37+
EnvironmentUtils.setNoProxy(null);
3238
}
3339
}

0 commit comments

Comments
 (0)