Skip to content

Commit

Permalink
KTOR-6411 resolve connectors in the test engine (#3798)
Browse files Browse the repository at this point in the history
  • Loading branch information
akotynski authored and e5l committed Nov 3, 2023
1 parent d55a1ff commit d599b54
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class TestApplicationEngine(
environment.start()
cancellationDeferred = stopServerOnCancellation()
applicationStarting.complete()
resolvedConnectors.complete(runBlocking { resolvedConnectors() })
state.value = State.Started
}
if (state.value == State.Starting) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,17 @@ class TestApplicationTest {
assertEquals("8081", response8081.bodyAsText())
}

@Test
fun testStartupJobsCompletion() = testApplication {
startApplication()
val childrenJobsSize = engine.application.coroutineContext.job.children.toList().size
assertEquals(
expected = 0,
actual = childrenJobsSize,
message = "all the children jobs should be completed",
)
}

@Test
fun testCanPassCoroutineContextFromOutside() = runBlocking(MyElement("test")) {
testApplication(coroutineContext) {
Expand Down

0 comments on commit d599b54

Please sign in to comment.