Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions aws-crt-kotlin/api/aws-crt-kotlin.api
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ public final class aws/sdk/kotlin/crt/CRT {
public static final field INSTANCE Laws/sdk/kotlin/crt/CRT;
public final fun errorName (I)Ljava/lang/String;
public final fun errorString (I)Ljava/lang/String;
public final fun initRuntime (Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun initRuntime$default (Laws/sdk/kotlin/crt/CRT;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public final fun initRuntime (Lkotlin/jvm/functions/Function1;)V
public static synthetic fun initRuntime$default (Laws/sdk/kotlin/crt/CRT;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
public final fun isHttpErrorRetryable (I)Z
public final fun lastError ()I
public final fun nativeMemory ()J
Expand Down
6 changes: 6 additions & 0 deletions aws-crt-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ kotlin {
}
}

val commonTest by getting {
dependencies {
implementation(libs.kotlinx.coroutines.test)
}
}

val jvmMain by getting {
dependencies {
implementation(libs.crt.java)
Expand Down
16 changes: 0 additions & 16 deletions aws-crt-kotlin/common/test/aws/sdk/kotlin/crt/Utils.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import aws.sdk.kotlin.crt.CrtTest
import aws.sdk.kotlin.crt.io.ClientBootstrap
import aws.sdk.kotlin.crt.io.EventLoopGroup
import aws.sdk.kotlin.crt.io.HostResolver
import aws.sdk.kotlin.crt.runSuspendTest
import kotlinx.coroutines.test.runTest
import kotlin.test.Ignore
import kotlin.test.Test
import kotlin.test.assertEquals
Expand All @@ -19,7 +19,7 @@ class CredentialsProviderTest : CrtTest() {

@Ignore // FIXME Enable when Kotlin/Native implementation is complete
@Test
fun testStaticProvider() = runSuspendTest {
fun testStaticProvider() = runTest {
val provider = StaticCredentialsProvider.fromCredentials(EXPECTED_CREDENTIALS)
val actual = provider.getCredentials()
assertEquals(EXPECTED_CREDENTIALS, actual)
Expand All @@ -44,7 +44,7 @@ class CredentialsProviderTest : CrtTest() {

@Ignore // FIXME Enable when Kotlin/Native implementation is complete
@Test
fun testCacheStatic() = runSuspendTest {
fun testCacheStatic() = runTest {
val provider = CachedCredentialsProvider.build {
source = StaticCredentialsProvider.fromCredentials(EXPECTED_CREDENTIALS)
refreshTimeInMilliseconds = 900
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import aws.sdk.kotlin.crt.http.HttpRequest
import aws.sdk.kotlin.crt.http.HttpRequestBodyStream
import aws.sdk.kotlin.crt.http.headers
import aws.sdk.kotlin.crt.io.Uri
import kotlinx.coroutines.test.runTest
import kotlin.test.*

// ported over from crt-java
Expand Down Expand Up @@ -56,7 +57,7 @@ class SigningTest : CrtTest() {

@Ignore // FIXME Enable when Kotlin/Native implementation is complete
@Test
fun testSigningSuccess() = runSuspendTest {
fun testSigningSuccess() = runTest {
StaticCredentialsProvider.build {
accessKeyId = TEST_ACCESS_KEY_ID
secretAccessKey = TEST_SECRET_ACCESS_KEY
Expand All @@ -82,7 +83,7 @@ class SigningTest : CrtTest() {

@Ignore // FIXME Enable when Kotlin/Native implementation is complete
@Test
fun testQuerySigningSuccess() = runSuspendTest {
fun testQuerySigningSuccess() = runTest {
StaticCredentialsProvider.build {
accessKeyId = TEST_ACCESS_KEY_ID
secretAccessKey = TEST_SECRET_ACCESS_KEY
Expand Down Expand Up @@ -114,7 +115,7 @@ class SigningTest : CrtTest() {

@Ignore // FIXME Enable when Kotlin/Native implementation is complete
@Test
fun testSigningBasicSigV4() = runSuspendTest {
fun testSigningBasicSigV4() = runTest {
StaticCredentialsProvider.build {
accessKeyId = TEST_ACCESS_KEY_ID
secretAccessKey = TEST_SECRET_ACCESS_KEY
Expand Down Expand Up @@ -147,7 +148,7 @@ class SigningTest : CrtTest() {

@Ignore // FIXME Enable when Kotlin/Native implementation is complete
@Test
fun testSigningFailureBadRequest() = runSuspendTest {
fun testSigningFailureBadRequest() = runTest {
StaticCredentialsProvider.build {
accessKeyId = TEST_ACCESS_KEY_ID
secretAccessKey = TEST_SECRET_ACCESS_KEY
Expand All @@ -174,7 +175,7 @@ class SigningTest : CrtTest() {

@Ignore // FIXME Enable when Kotlin/Native implementation is complete
@Test
fun testSigningSigV4Asymmetric() = runSuspendTest {
fun testSigningSigV4Asymmetric() = runTest {
StaticCredentialsProvider.build {
accessKeyId = TEST_ACCESS_KEY_ID
secretAccessKey = TEST_SECRET_ACCESS_KEY
Expand Down Expand Up @@ -202,7 +203,7 @@ class SigningTest : CrtTest() {

@Ignore // FIXME Enable when Kotlin/Native implementation is complete
@Test
fun testSigningChunkTrailingHeaders() = runSuspendTest {
fun testSigningChunkTrailingHeaders() = runTest {
StaticCredentialsProvider.build {
accessKeyId = "AKID"
secretAccessKey = "SECRET"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ package aws.sdk.kotlin.crt.http

import aws.sdk.kotlin.crt.CrtTest
import aws.sdk.kotlin.crt.io.*
import aws.sdk.kotlin.crt.runSuspendTest
import aws.sdk.kotlin.crt.use
import kotlinx.coroutines.test.runTest
import kotlinx.coroutines.withTimeout
import kotlin.test.*
import kotlin.time.measureTime

class HttpClientConnectionTest : CrtTest() {
@Ignore // FIXME Enable when Kotlin/Native implementation is complete
@Test
fun testDefaults() = runSuspendTest {
fun testDefaults() = runTest {
val uri = Uri.parse("https://aws-crt-test-stuff.s3.amazonaws.com")
val socketOpts = SocketOptions()
val elg = EventLoopGroup()
Expand Down Expand Up @@ -56,7 +56,7 @@ class HttpClientConnectionTest : CrtTest() {

@Ignore // FIXME Enable when Kotlin/Native implementation is complete
@Test
fun testHttpConnection() = runSuspendTest {
fun testHttpConnection() = runTest {
// S3
assertConnect("https://aws-crt-test-stuff.s3.amazonaws.com")
assertConnect("http://aws-crt-test-stuff.s3.amazonaws.com")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
package aws.sdk.kotlin.crt.io

import aws.sdk.kotlin.crt.CrtTest
import aws.sdk.kotlin.crt.runSuspendTest
import kotlin.test.Ignore
import kotlinx.coroutines.test.runTest
import kotlin.test.Test

class ClientBootstrapTest : CrtTest() {
@Ignore // FIXME Enable when Kotlin/Native implementation is complete
@Test
fun createDestroy() = runSuspendTest {
fun createDestroy() = runTest {
val elg = EventLoopGroup()
val hr = HostResolver(elg)
val bootstrap = ClientBootstrap(elg, hr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
package aws.sdk.kotlin.crt.io

import aws.sdk.kotlin.crt.CrtTest
import aws.sdk.kotlin.crt.runSuspendTest
import kotlin.test.Ignore
import kotlinx.coroutines.test.runTest
import kotlin.test.Test

class EventLoopGroupTest : CrtTest() {
@Ignore // FIXME Enable when Kotlin/Native implementation is complete
@Test
fun createDestroy() = runSuspendTest {
fun createDestroy() = runTest {
val elg = EventLoopGroup()
elg.close()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
package aws.sdk.kotlin.crt.io

import aws.sdk.kotlin.crt.CrtTest
import aws.sdk.kotlin.crt.runSuspendTest
import aws.sdk.kotlin.crt.use
import kotlin.test.Ignore
import kotlinx.coroutines.test.runTest
import kotlin.test.Test

class HostResolverTest : CrtTest() {
@Ignore // FIXME Enable when Kotlin/Native implementation is complete
@Test
fun createDestroy() = runSuspendTest {
fun createDestroy() = runTest {
EventLoopGroup().use { elg ->
val hr = HostResolver(elg)
hr.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
package aws.sdk.kotlin.crt.io

import aws.sdk.kotlin.crt.CrtTest
import aws.sdk.kotlin.crt.runSuspendTest
import kotlin.test.Ignore
import kotlinx.coroutines.test.runTest
import kotlin.test.Test

class TlsContextTest : CrtTest() {
@Ignore // FIXME Enable when Kotlin/Native implementation is complete
@Test
fun createDestroy() = runSuspendTest {
fun createDestroy() = runTest {
val ctx = TlsContext()
ctx.close()
}
Expand Down
2 changes: 1 addition & 1 deletion aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/CRT.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public actual object CRT {
}
}
initialized = true
}
}
}
}

Expand Down
15 changes: 0 additions & 15 deletions aws-crt-kotlin/jvm/test/aws/sdk/kotlin/crt/UtilsJVM.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

package aws.sdk.kotlin.crt.http

import aws.sdk.kotlin.crt.runSuspendTest
import aws.sdk.kotlin.crt.util.Digest
import aws.sdk.kotlin.crt.util.encodeToHex
import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.TestInstance
Expand Down Expand Up @@ -65,49 +65,55 @@ class HttpRequestResponseTest : HttpClientTest() {
}
}

@Ignore // FIXME This test is broken since switching runSuspendingTest to runTest
@Test
fun testHttpGet() = runSuspendTest {
fun testHttpGet() = runTest {
testSimpleRequest("GET", "/get", 200)
testSimpleRequest("GET", "/post", 405)
testSimpleRequest("GET", "/put", 405)
testSimpleRequest("GET", "/delete", 405)
}

@Ignore // FIXME This test is broken since switching runSuspendingTest to runTest
@Test
fun testHttpPost() = runSuspendTest {
fun testHttpPost() = runTest {
testSimpleRequest("POST", "/get", 405)
testSimpleRequest("POST", "/post", 200)
testSimpleRequest("POST", "/put", 405)
testSimpleRequest("POST", "/delete", 405)
}

@Ignore // FIXME This test is broken since switching runSuspendingTest to runTest
@Test
fun testHttpPut() = runSuspendTest {
fun testHttpPut() = runTest {
testSimpleRequest("PUT", "/get", 405)
testSimpleRequest("PUT", "/post", 405)
testSimpleRequest("PUT", "/put", 200)
testSimpleRequest("PUT", "/delete", 405)
}

@Ignore // FIXME This test is broken since switching runSuspendingTest to runTest
@Test
fun testHttpDelete() = runSuspendTest {
fun testHttpDelete() = runTest {
testSimpleRequest("DELETE", "/get", 405)
testSimpleRequest("DELETE", "/post", 405)
testSimpleRequest("DELETE", "/put", 405)
testSimpleRequest("DELETE", "/delete", 200)
}

@Ignore // FIXME This test is broken since switching runSuspendingTest to runTest
@Test
fun testHttpDownload() = runSuspendTest {
fun testHttpDownload() = runTest {
val response = roundTrip(url = "https://aws-crt-test-stuff.s3.amazonaws.com/http_test_doc.txt", verb = "GET")
assertEquals(200, response.statusCode, "expected http status does not match")
assertNotNull(response.body)

assertEquals(TEST_DOC_SHA256, Digest.sha256(response.body).encodeToHex())
}

@Ignore // FIXME This test is broken since switching runSuspendingTest to runTest
@Test
fun testHttpUpload() = runSuspendTest {
fun testHttpUpload() = runTest {
val bodyToSend = TEST_DOC_LINE

// Set up mock server
Expand Down
1 change: 1 addition & 0 deletions aws-crt-kotlin/native/interop/crt.def
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ headerFilter = aws/common/* aws/io/* aws/http/* aws/compression/*

linkerOpts = -laws-c-common -laws-c-cal -laws-c-io -laws-c-http -laws-c-compression
linkerOpts.osx = -framework Security
linkerOpts.ios = -framework Security
linkerOpts.linux = -ls2n -lcrypto

---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public actual object CRT {
atexit(staticCFunction(::cleanup))

initialized = true
}
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/Logging.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ internal object Logging {
aws_logger_set(s_crt_kotlin_logger.ptr)

initialized = true
}
}
}
}
}
Loading