test: Refactor test utilities, fix conformance (#476)

# Refactor test utilities, fix conformance

- 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)

## Motivation and Context
Reuse test infrastructure code, resurrect conformance tests

## How Has This Been Tested?
CI, locally

## Breaking Changes
No

## Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [x] Tests update

## Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply. -->
- [x] I have read the [MCP
Documentation](https://modelcontextprotocol.io)
- [x] My code follows the repository's style guidelines
- [x] New and existing tests pass locally
- [ ] I have added appropriate error handling
- [ ] I have added or updated documentation as needed
This commit is contained in:
Konstantin Pavlov 2026-01-10 16:51:15 +02:00 • committed by GitHub
commit 29d34b8e48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 243 additions and 39 deletions

View file

@ -7,6 +7,7 @@ plugins {
dependencies {
testImplementation(project(":kotlin-sdk"))
testImplementation(kotlin("test"))
testImplementation(project(":test-utils"))
testImplementation(libs.kotlin.logging)
testImplementation(libs.ktor.client.cio)
testImplementation(libs.ktor.server.cio)

View file

@ -17,6 +17,8 @@ import kotlin.properties.Delegates
private val logger = KotlinLogging.logger {}
private const val CONFORMANCE_VERSION = "0.1.8"
enum class TransportType {
SSE,
WEBSOCKET,
@ -215,7 +217,7 @@ class ConformanceTest {
val serverUrl = "http://127.0.0.1:$serverPort/mcp"
ProcessBuilder(
"npx",
"@modelcontextprotocol/conformance",
"@modelcontextprotocol/conformance@$CONFORMANCE_VERSION",
"server",
"--url",
serverUrl,
@ -230,7 +232,7 @@ class ConformanceTest {
val serverUrl = "ws://127.0.0.1:$serverPort/ws"
ProcessBuilder(
"npx",
"@modelcontextprotocol/conformance",
"@modelcontextprotocol/conformance@$CONFORMANCE_VERSION",
"server",
"--url",
serverUrl,
@ -274,7 +276,7 @@ class ConformanceTest {
val processBuilder = ProcessBuilder(
"npx",
"@modelcontextprotocol/conformance",
"@modelcontextprotocol/conformance@$CONFORMANCE_VERSION",
"client",
"--command",
clientCommand.joinToString(" "),