@@ -107,11 +107,10 @@ class DefaultS3ExpressCredentialsProviderTest {
107107 provider.resolve(attributes)
108108
109109 // allow the async refresh to initiate before closing the provider
110- runBlocking { delay(50 .milliseconds) }
110+ runBlocking { delay(500 .milliseconds) }
111111
112- // close the provider, make sure all async refreshes are complete...
113112 provider.close()
114- runBlocking { delay( 50 .milliseconds) }
113+ provider.coroutineContext.job.join()
115114
116115 assertEquals(1 , testClient.numCreateSession)
117116 }
@@ -147,11 +146,10 @@ class DefaultS3ExpressCredentialsProviderTest {
147146 calls.awaitAll()
148147
149148 // allow the async refresh to initiate before closing the provider
150- runBlocking { delay(50 .milliseconds) }
149+ runBlocking { delay(500 .milliseconds) }
151150
152- // close the provider, make sure all async refreshes are complete...
153151 provider.close()
154- runBlocking { delay( 50 .milliseconds) }
152+ provider.coroutineContext.job.join()
155153
156154 assertEquals(1 , testClient.numCreateSession)
157155 }
@@ -190,11 +188,10 @@ class DefaultS3ExpressCredentialsProviderTest {
190188 provider.resolve(attributes)
191189
192190 // allow the async refresh to initiate before closing the provider
193- runBlocking { delay(50 .milliseconds) }
191+ runBlocking { delay(500 .milliseconds) }
194192
195- // close the provider, make sure all async refreshes are complete...
196193 provider.close()
197- runBlocking { delay( 50 .milliseconds) }
194+ provider.coroutineContext.job.join()
198195
199196 assertEquals(2 , testClient.numCreateSession)
200197 }
0 commit comments