Skip to content

Commit

Permalink
fix unit test for OIDC
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonTian committed Jul 22, 2024
1 parent 0a35f47 commit b7de2b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ jobs:
distribution: 'zulu'
java-version: ${{ matrix.java }}
- name: Test with Maven
run: mvn test -B -f ./aliyun-java-sdk-core/pom.xml
run: |
java -version
mvn test -B -f ./aliyun-java-sdk-core/pom.xml
- name: Upload Coverage Report
uses: codecov/codecov-action@v4
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,15 @@ 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
public void run() throws Throwable {
provider.getCredentials();
}
});
ex.printStackTrace();
String message = ex.getMessage();
Assert.assertTrue(message.contains("Parameter OIDCProviderArn is not valid"));
}
Expand Down

0 comments on commit b7de2b0

Please sign in to comment.