Skip to content

Commit

Permalink
use latest coroutines and ktor
Browse files Browse the repository at this point in the history
  • Loading branch information
whyoleg committed Jul 31, 2023
1 parent 20604ee commit a7acd5a
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package dev.whyoleg.cryptography.providers.tests.compatibility.api

import dev.whyoleg.cryptography.*
import dev.whyoleg.cryptography.providers.tests.compatibility.*
import dev.whyoleg.cryptography.providers.tests.support.*
import kotlin.test.*

Expand All @@ -16,6 +17,7 @@ abstract class CompatibilityTest<A : CryptographyAlgorithm>(

@Test
fun generateStep() = runTest {
disableConsoleLogging()
runCompatibilityTestStep(
tag = "GENERATE",
api = { ServerApi(algorithmId.name, context, logger) },
Expand All @@ -25,6 +27,7 @@ abstract class CompatibilityTest<A : CryptographyAlgorithm>(

@Test
fun validateStep() = runTest {
disableConsoleLogging()
runCompatibilityTestStep(
tag = "VALIDATE",
api = { ServerApi(algorithmId.name, context, logger) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,5 @@ fun digest(name: String): CryptographyAlgorithmId<Digest> = when (name) {
SHA512.name -> SHA512
else -> error("Unknown digest: $name")
}

expect fun disableConsoleLogging()
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright (c) 2023 Oleg Yukhnevich. Use of this source code is governed by the Apache 2.0 license.
*/

package dev.whyoleg.cryptography.providers.tests.compatibility

actual fun disableConsoleLogging() {
eval("console.debug = function(){}")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright (c) 2023 Oleg Yukhnevich. Use of this source code is governed by the Apache 2.0 license.
*/

package dev.whyoleg.cryptography.providers.tests.compatibility

actual fun disableConsoleLogging() {
//no-op, needed only for JS
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package dev.whyoleg.cryptography.providers.tests.support

import dev.whyoleg.cryptography.*
import kotlinx.coroutines.test.*
import kotlin.time.Duration.Companion.minutes

private const val enableLogsGlobal = false

Expand All @@ -26,7 +27,7 @@ fun runTest(
rootTag: String? = null,
enableLogs: Boolean = enableLogsGlobal,
block: suspend TestScope.() -> Unit,
): TestResult = runTest(dispatchTimeoutMs = Long.MAX_VALUE) {
): TestResult = runTest(timeout = 10.minutes) {
val logger = TestLogger(enableLogs, rootTag)
logger.print("PLATFORM: $currentTestPlatform")
TestScope(logger).block()
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ android = "8.0.2"
# test dependencies

kotlinx-serialization = "1.5.1"
kotlinx-coroutines = "1.6.4"
kotlinx-coroutines = "1.7.3"

bouncycastle = "1.75"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ kotlin {
withWasm()
withNative()
}
group("nonJs") {
withJvm()
withWasm()
withNative()
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion testtool/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]

# don't update ktor because of issue with andoormous amount of logging
ktor = "2.2.2"
ktor = "2.3.2"
logback = "1.2.11"

[libraries]
Expand Down

0 comments on commit a7acd5a

Please sign in to comment.