-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KTOR-8043 Retry server tests one time by default
- Loading branch information
Showing
12 changed files
with
123 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
ktor-server/ktor-server-test-base/common/test/io/ktor/server/test/base/BaseTestTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package io.ktor.server.test.base | ||
|
||
import io.ktor.util.* | ||
import kotlinx.coroutines.test.TestResult | ||
import kotlin.test.Test | ||
import kotlin.test.fail | ||
|
||
class BaseTestTest : BaseTest() { | ||
|
||
@Test | ||
fun `runTest - retry test by default on non-JVM platform`(): TestResult { | ||
var retryCount = 0 | ||
return runTest { | ||
if (!PlatformUtils.IS_JVM && retryCount++ < 1) fail("This test should be retried") | ||
} | ||
} | ||
|
||
@Test | ||
fun `runTest - don't retry test by default on JVM platform`(): TestResult { | ||
var retryCount = 0 | ||
return runTest { | ||
if (PlatformUtils.IS_JVM && retryCount++ > 0) fail("This test should not be retried") | ||
} | ||
} | ||
|
||
@Test | ||
fun `runTest - more than one retry`(): TestResult { | ||
var retryCount = 0 | ||
return runTest(retries = 3) { | ||
if (retryCount++ < 3) fail("This test should be retried") | ||
} | ||
} | ||
|
||
@Test | ||
fun `runTest - retry should work collected exceptions`(): TestResult { | ||
var retryCount = 0 | ||
return runTest(retries = 1) { | ||
if (retryCount++ < 1) collectUnhandledException(Exception("This test should be retried")) | ||
} | ||
} | ||
} |
52 changes: 0 additions & 52 deletions
52
...server-test-base/jsAndWasmShared/src/io/ktor/server/test/base/BaseTest.jsAndWasmShared.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
ktor-shared/ktor-test-base/jvm/src/io/ktor/test/junit/ErrorCollector.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters