Skip to content

Commit cd7fb4b

Browse files
committed
update TestScope
1 parent 72e7805 commit cd7fb4b

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

plugins/toolkit/jetbrains-core/tst/software/aws/toolkits/jetbrains/services/apprunner/actions/DeployActionTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import com.intellij.testFramework.DisposableRule
1010
import com.intellij.testFramework.runInEdtAndWait
1111
import kotlinx.coroutines.ExperimentalCoroutinesApi
1212
import kotlinx.coroutines.runBlocking
13-
import kotlinx.coroutines.test.runBlockingTest
13+
import kotlinx.coroutines.test.runTest
1414
import org.assertj.core.api.Assertions.assertThat
1515
import org.junit.After
1616
import org.junit.Before
@@ -85,7 +85,7 @@ class DeployActionTest : BaseCoroutineTest(30) {
8585
on { startDeployment(any<StartDeploymentRequest>()) } doAnswer { throw RuntimeException("Failed to start deployment") }
8686
}
8787

88-
runBlockingTest {
88+
runTest {
8989
action.deploy(
9090
AppRunnerServiceNode(projectRule.project, ServiceSummary.builder().serviceName(aString()).serviceArn(aString()).build()),
9191
appRunnerClient,
@@ -114,7 +114,7 @@ class DeployActionTest : BaseCoroutineTest(30) {
114114
on { describeLogStreams(any<DescribeLogStreamsRequest>()) } doAnswer { throw RuntimeException("broke") }
115115
}
116116

117-
runBlockingTest {
117+
runTest {
118118
action.deploy(
119119
AppRunnerServiceNode(projectRule.project, ServiceSummary.builder().serviceName(aString()).serviceArn(aString()).build()),
120120
appRunnerClient,

plugins/toolkit/jetbrains-core/tst/software/aws/toolkits/jetbrains/services/cloudwatch/logs/insights/QueryActorTest.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import com.intellij.util.ui.ListTableModel
88
import kotlinx.coroutines.ExperimentalCoroutinesApi
99
import kotlinx.coroutines.delay
1010
import kotlinx.coroutines.runBlocking
11-
import kotlinx.coroutines.test.runBlockingTest
11+
import kotlinx.coroutines.test.runTest
1212
import org.assertj.core.api.Assertions.assertThat
1313
import org.junit.After
1414
import org.junit.Before
@@ -75,7 +75,7 @@ class QueryActorTest : BaseCoroutineTest() {
7575
GetQueryResultsResponse.builder().status(QueryStatus.COMPLETE).results(sampleResults).build()
7676
)
7777

78-
runBlockingTest {
78+
runTest {
7979
queryactor.channel.send(InsightsQueryResultsActor.Message.StartLoadingAll)
8080
tableModel.waitForModelToBeAtLeast(1)
8181
}
@@ -103,7 +103,7 @@ class QueryActorTest : BaseCoroutineTest() {
103103
.thenReturn(
104104
GetQueryResultsResponse.builder().status(QueryStatus.COMPLETE).results(firstSampleResultList, secondSampleResultList).build()
105105
)
106-
runBlockingTest {
106+
runTest {
107107
queryactor.channel.send(InsightsQueryResultsActor.Message.StartLoadingAll)
108108
tableModel.waitForModelToBeAtLeast(2)
109109
}
@@ -133,7 +133,7 @@ class QueryActorTest : BaseCoroutineTest() {
133133
CloudWatchLogsException::class.java
134134
)
135135

136-
runBlockingTest {
136+
runTest {
137137
queryactor.channel.send(InsightsQueryResultsActor.Message.StartLoadingAll)
138138
while (!queryactor.channel.isClosedForSend) {
139139
delay(10)
@@ -150,7 +150,7 @@ class QueryActorTest : BaseCoroutineTest() {
150150
.thenReturn(
151151
GetQueryResultsResponse.builder().status(QueryStatus.COMPLETE).build()
152152
)
153-
runBlockingTest {
153+
runTest {
154154
queryactor.channel.send(InsightsQueryResultsActor.Message.StartLoadingAll)
155155
waitForTrue { table.emptyText.text == message("cloudwatch.logs.no_results_found") }
156156
}
@@ -201,7 +201,7 @@ class QueryActorTest : BaseCoroutineTest() {
201201
latch.countDown()
202202
}
203203

204-
runBlockingTest {
204+
runTest {
205205
queryactor.channel.send(InsightsQueryResultsActor.Message.StartLoadingAll)
206206
tableModel.waitForModelToBeAtLeast(1)
207207
queryactor.channel.send(InsightsQueryResultsActor.Message.StopLoading)

plugins/toolkit/jetbrains-core/tst/software/aws/toolkits/jetbrains/utils/BaseCoroutineTest.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ package software.aws.toolkits.jetbrains.utils
55

66
import com.intellij.testFramework.ProjectRule
77
import kotlinx.coroutines.ExperimentalCoroutinesApi
8-
import kotlinx.coroutines.test.TestCoroutineScope
9-
import org.junit.After
8+
import kotlinx.coroutines.test.TestScope
109
import org.junit.Rule
1110
import software.aws.toolkits.jetbrains.core.MockClientManagerRule
1211

@@ -29,10 +28,5 @@ abstract class BaseCoroutineTest(@Suppress("UnusedPrivateMember") timeoutSeconds
2928
// @Rule
3029
// val timeout = CoroutinesTimeout.seconds(timeoutSeconds)
3130

32-
val testCoroutineScope: TestCoroutineScope = TestCoroutineScope()
33-
34-
@After
35-
fun after() {
36-
testCoroutineScope.cleanupTestCoroutines()
37-
}
31+
val testCoroutineScope: TestScope = TestScope()
3832
}

0 commit comments

Comments
 (0)