Skip to content

Commit

Permalink
Added ECS credentials provider test for local full URI
Browse files Browse the repository at this point in the history
  • Loading branch information
0marperez committed Jan 23, 2024
1 parent 49ab259 commit 654e453
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,26 @@ class EcsCredentialsProviderTest {
}.message.shouldContain("The container credentials full URI (http://amazonaws.com/full) is specified via a hostname whose IP address(es) do not resolve to the loopback device.")
}

@Test
fun testLocalFullUri() = runTest {
val uri = "http://localhost"
val engine = buildTestConnection {
expect(
ecsRequest(uri),
ecsResponse(),
)
}

val testPlatform = TestPlatformProvider(
env = mapOf(AwsSdkSetting.AwsContainerCredentialsFullUri.envVar to uri),
)

val provider = EcsCredentialsProvider(testPlatform, engine)
val actual = provider.resolve()
assertEquals(expectedCredentials, actual)
engine.assertRequests()
}

@Test
fun testNonexistentFullUri() = runTest {
val uri = "http://amazonaws.net/full"
Expand Down

0 comments on commit 654e453

Please sign in to comment.