Skip to content

Commit 1f64dc0

Browse files
committed
test: Refactor test utilities
- Add `test-utils` module to streamline test cases - Rename module `kotlin-sdk-test` -> `integration-test` - Move test utilities for managing processes, ports, and TypeScript execution logic - Make conformance tests work by specifying conformance package version (0.1.8)
1 parent 6fee82f commit 1f64dc0

87 files changed

Lines changed: 241 additions & 38 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies {
1212
kover(project(":kotlin-sdk-core"))
1313
kover(project(":kotlin-sdk-client"))
1414
kover(project(":kotlin-sdk-server"))
15-
kover(project(":kotlin-sdk-test"))
15+
"kover"(project(":integration-test"))
1616
}
1717

1818
subprojects {

conformance-test/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ plugins {
77
dependencies {
88
testImplementation(project(":kotlin-sdk"))
99
testImplementation(kotlin("test"))
10+
testImplementation(project(":test-utils"))
1011
testImplementation(libs.kotlin.logging)
1112
testImplementation(libs.ktor.client.cio)
1213
testImplementation(libs.ktor.server.cio)

conformance-test/src/test/kotlin/io/modelcontextprotocol/kotlin/sdk/conformance/ConformanceTest.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import kotlin.properties.Delegates
1717

1818
private val logger = KotlinLogging.logger {}
1919

20+
private const val CONFORMANCE_VERSION = "0.1.8"
21+
2022
enum class TransportType {
2123
SSE,
2224
WEBSOCKET,
@@ -215,7 +217,7 @@ class ConformanceTest {
215217
val serverUrl = "http://127.0.0.1:$serverPort/mcp"
216218
ProcessBuilder(
217219
"npx",
218-
"@modelcontextprotocol/conformance",
220+
"@modelcontextprotocol/conformance@$CONFORMANCE_VERSION",
219221
"server",
220222
"--url",
221223
serverUrl,
@@ -230,7 +232,7 @@ class ConformanceTest {
230232
val serverUrl = "ws://127.0.0.1:$serverPort/ws"
231233
ProcessBuilder(
232234
"npx",
233-
"@modelcontextprotocol/conformance",
235+
"@modelcontextprotocol/conformance@$CONFORMANCE_VERSION",
234236
"server",
235237
"--url",
236238
serverUrl,
@@ -274,7 +276,7 @@ class ConformanceTest {
274276

275277
val processBuilder = ProcessBuilder(
276278
"npx",
277-
"@modelcontextprotocol/conformance",
279+
"@modelcontextprotocol/conformance@$CONFORMANCE_VERSION",
278280
"client",
279281
"--command",
280282
clientCommand.joinToString(" "),
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ kotlin {
2525
}
2626
jvmTest {
2727
dependencies {
28-
implementation(libs.awaitility)
29-
implementation(libs.junit.jupiter.params)
30-
runtimeOnly(libs.slf4j.simple)
28+
implementation(project(":test-utils"))
3129
}
3230
}
3331
}

kotlin-sdk-test/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/ClientTest.kt renamed to integration-test/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/ClientTest.kt

File renamed without changes.

kotlin-sdk-test/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/OldSchemaClientTest.kt renamed to integration-test/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/OldSchemaClientTest.kt

File renamed without changes.

kotlin-sdk-test/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/OldSchemaSseTransportTest.kt renamed to integration-test/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/OldSchemaSseTransportTest.kt

File renamed without changes.

kotlin-sdk-test/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/SseTransportTest.kt renamed to integration-test/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/SseTransportTest.kt

File renamed without changes.

kotlin-sdk-test/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/WebSocketTransportTest.kt renamed to integration-test/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/WebSocketTransportTest.kt

File renamed without changes.

kotlin-sdk-test/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/integration/InMemoryTransportTest.kt renamed to integration-test/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/integration/InMemoryTransportTest.kt

File renamed without changes.

0 commit comments

Comments
 (0)