Skip to content
Open
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
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<cmake.osx_arch>-DOSX_ARCH_DUMMY=1</cmake.osx_arch>
<cmake.min_osx_version>-DOSX_DEPLOYMENT_TARGET_DUMMY=1</cmake.min_osx_version>
<cmake.crt_fips>OFF</cmake.crt_fips>
<maven-surefire-plugin.version>2.21.0</maven-surefire-plugin.version>
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
</properties>

<profiles>
Expand Down Expand Up @@ -498,7 +498,7 @@
<shutdown>kill</shutdown>
<argLine>-Daws.crt.memory.tracing=2 -Xcheck:jni</argLine>
<runOrder>alphabetical</runOrder>
<useFile>false</useFile>
<useFile>true</useFile>
<reuseForks>false</reuseForks>
<forkCount>0</forkCount>
<testFailureIgnore>false</testFailureIgnore>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import java.util.List;
import java.util.concurrent.*;

import software.amazon.awssdk.crt.Log;

import static org.junit.Assert.*;
import static org.junit.Assert.fail;

Expand Down Expand Up @@ -289,6 +291,7 @@ public void testCreateDestroyProfile_InvalidProfile() throws IOException {

@Test
public void testCreateDestroyProfile_MissingCreds() throws ExecutionException, InterruptedException, IOException {
Log.initLoggingToStderr(Log.LogLevel.Trace);
Path confPath = Files.createTempFile("testCreateDestroyProfile_ValidProfile_conf_", "");
Path credsPath = Files.createTempFile("testCreateDestroyProfile_ValidProfile_creds_", "");
Files.write(credsPath, Arrays.asList("[default]")); // Contains a section header but no actual credentials
Expand All @@ -297,18 +300,18 @@ public void testCreateDestroyProfile_MissingCreds() throws ExecutionException, I
.withConfigFileNameOverride(confPath.toString()).withCredentialsFileNameOverride(credsPath.toString());

try (ProfileCredentialsProvider provider = builder.build()) {
assertNotNull(provider);
assertNotNull("provider is null", provider);
assertTrue(provider.getNativeHandle() != 0);

try {
provider.getCredentials().join();
fail("Expected credential fetching to throw an exception since creds are missing from profile");
} catch (CompletionException e) {
assertNotNull(e.getCause());
assertNotNull("exception is null", e.getCause());
Throwable innerException = e.getCause();

// Check that the right exception type caused the completion error in the future
assertTrue(innerException.getMessage().contains("Parser encountered an error"));
assertEquals(innerException.getMessage(), "Valid credentials could not be sourced by a profile provider");
assertEquals(CrtRuntimeException.class, innerException.getClass());
}
} finally {
Expand Down
Loading