@@ -12,15 +12,10 @@ import aws.smithy.kotlin.runtime.http.HttpStatusCode
1212import aws.smithy.kotlin.runtime.http.endpoints.Endpoint
1313import aws.smithy.kotlin.runtime.http.response.HttpResponse
1414import aws.smithy.kotlin.runtime.httptest.buildTestConnection
15- import aws.smithy.kotlin.runtime.testing.IgnoreWindows
16- import aws.smithy.kotlin.runtime.time.Instant
1715import aws.smithy.kotlin.runtime.time.ManualClock
18- import aws.smithy.kotlin.runtime.time.epochMilliseconds
1916import io.kotest.matchers.string.shouldContain
2017import kotlinx.coroutines.ExperimentalCoroutinesApi
21- import kotlinx.coroutines.runBlocking
2218import kotlinx.coroutines.test.runTest
23- import kotlinx.coroutines.withTimeout
2419import kotlinx.serialization.json.*
2520import kotlin.test.*
2621import kotlin.time.Duration.Companion.seconds
@@ -212,29 +207,6 @@ class ImdsClientTest {
212207 connection.assertRequests()
213208 }
214209
215- @IgnoreWindows(" DNS fails faster on windows and results in a different error: `socket connect failure, no route to host`" )
216- @Test
217- fun testHttpConnectTimeouts () = runBlocking {
218- // end-to-end real client times out after 1-second
219- val client = ImdsClient {
220- // will never resolve
221- endpointConfiguration = EndpointConfiguration .Custom (" http://240.0.0.0" .toEndpoint())
222- }
223-
224- val start = Instant .now()
225- val ex = assertFails {
226- withTimeout(3000 ) {
227- client.get(" /latest/metadata" )
228- }
229- }
230-
231- // this message is asserted against whatever the default HTTP client engine throws for an exception...
232- assertTrue(ex.message!! .lowercase().contains(" timeout has expired" ), " message `${ex.message} `" )
233- val elapsed = Instant .now().epochMilliseconds - start.epochMilliseconds
234- assertTrue(elapsed >= 1000 , " expected elapsed ms to be greater than 1000; actual = $elapsed " )
235- assertTrue(elapsed < 2000 , " expected elapsed ms to be less than 2000; actual = $elapsed " )
236- }
237-
238210 data class ImdsConfigTest (
239211 val name : String ,
240212 val env : Map <String , String >,
0 commit comments