From 3312374d39f7845cd542a1bacb750f2c7f91bb47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?= Date: Tue, 11 Aug 2026 17:36:06 +0200 Subject: [PATCH] test(driver-sync): Run the integration tests using reflection --- settings.gradle.kts | 1 + test-sync-reflection/build.gradle.kts | 38 +++++++++++++++++++ .../kotlin/SyncMongoClient.reflection.kt | 33 ++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 test-sync-reflection/build.gradle.kts create mode 100644 test-sync-reflection/src/jvmTest/kotlin/SyncMongoClient.reflection.kt diff --git a/settings.gradle.kts b/settings.gradle.kts index aaa74bda..6949c554 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -103,6 +103,7 @@ include( "test-coroutines-kotlinx", "test-coroutines-reflection", "test-sync-kotlinx", + "test-sync-reflection", "docs:website", "gradle:templates:template-app", diff --git a/test-sync-reflection/build.gradle.kts b/test-sync-reflection/build.gradle.kts new file mode 100644 index 00000000..c596a131 --- /dev/null +++ b/test-sync-reflection/build.gradle.kts @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024-2026, OpenSavvy and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + alias(opensavvyConventions.plugins.base) + alias(opensavvyConventions.plugins.kotlin.internal) + alias(libsCommon.plugins.kotlinx.serialization) + alias(libsCommon.plugins.testBalloon) + id("org.jetbrains.kotlinx.kover") +} + +kotlin { + jvm() + + sourceSets.commonMain.dependencies { + api(projects.test) + } + + sourceSets.jvmTest.dependencies { + implementation(projects.driverSync) + implementation(projects.driverSyncApiAdapter) + implementation(libs.mongodb.kotlin.reflection) + implementation(libsCommon.bundles.testBalloon) + } +} diff --git a/test-sync-reflection/src/jvmTest/kotlin/SyncMongoClient.reflection.kt b/test-sync-reflection/src/jvmTest/kotlin/SyncMongoClient.reflection.kt new file mode 100644 index 00000000..8770406c --- /dev/null +++ b/test-sync-reflection/src/jvmTest/kotlin/SyncMongoClient.reflection.kt @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2026, OpenSavvy and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package opensavvy.ktmongo.tests.sync.reflection + +import opensavvy.ktmongo.sync.SyncMongoClient +import opensavvy.ktmongo.sync.api.blocking.BlockingMongoClient +import opensavvy.ktmongo.tests.api.verifyClient +import opensavvy.prepared.runner.testballoon.preparedSuite + +val IntegrationTests by preparedSuite { + + verifyClient("SyncMongoClient (reflection-based)") { connectionString, _ -> + val client = SyncMongoClient(connectionString) + + // BlockingMongoClient is a wrapper that exposes SyncMongoClient with the unified coroutines API + BlockingMongoClient(client) + } + +} -- 2.51.2