Add StreamableHttpClientTest with test infrastructure setup and dependencies (#316)

Add `StreamableHttpClientTest` with test infrastructure setup and
dependencies

<!-- Provide a brief summary of your changes -->

## Motivation and Context

To test Streaming HTTP Transport

## How Has This Been Tested?

Integration test added

## Breaking Changes
No, only tests

## Types of changes
<!-- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update
- [x] Tests

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

## Additional context
<!-- Add any other context, implementation notes, or design decisions
-->
This commit is contained in:
Konstantin Pavlov 2025-10-17 16:03:52 +03:00 • committed by GitHub
commit d60e8b6fb2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 446 additions and 10 deletions

View file

@ -1,7 +1,9 @@
@file:OptIn(ExperimentalWasmDsl::class)
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
import org.jetbrains.kotlin.gradle.dsl.JvmDefaultMode
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
@ -11,11 +13,50 @@ plugins {
}
kotlin {
jvm {
compilerOptions.jvmTarget = JvmTarget.JVM_1_8
compilerOptions {
freeCompilerArgs =
listOf(
"-Wextra",
"-Xmulti-dollar-interpolation",
)
}
macosX64(); macosArm64()
linuxX64(); linuxArm64()
// coreLibrariesVersion = "2.0.10"
jvm {
compilerOptions {
jvmTarget = JvmTarget.JVM_1_8
javaParameters = true
jvmDefault = JvmDefaultMode.ENABLE
freeCompilerArgs.addAll(
"-Xdebug",
)
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
maxParallelForks = Runtime.getRuntime().availableProcessors()
forkEvery = 100
testLogging {
exceptionFormat = TestExceptionFormat.SHORT
showStandardStreams = true
events("failed")
}
systemProperty("kotest.output.ansi", "true")
reports {
junitXml.required.set(true)
junitXml.includeSystemOutLog.set(true)
junitXml.includeSystemErrLog.set(true)
}
}
}
macosX64()
macosArm64()
linuxX64()
linuxArm64()
mingwX64()
js { nodejs() }
wasmJs { nodejs() }

View file

@ -0,0 +1,61 @@
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
/**
* Netty convention plugin that adds platform-specific Netty native transport libraries
* to the jvmTest source set. This is similar to how Maven handles OS-specific dependencies
* with profile activation.
*
* This plugin should be applied to any module that uses Netty for testing.
*/
val nettyVersion = "4.2.7.Final"
plugins {
id("org.gradle.base")
}
// This plugin is applied to projects that already have the kotlin multiplatform plugin applied
// It adds the Netty native transport libraries to the jvmTest source set
afterEvaluate {
extensions.findByType<KotlinMultiplatformExtension>()?.apply {
sourceSets.findByName("jvmTest")?.apply {
dependencies {
// Netty native transport libraries for different platforms
val osName = System.getProperty("os.name").lowercase()
val osArch = System.getProperty("os.arch").lowercase()
// Add the base Netty platform
implementation(project.dependencies.platform("io.netty:netty-bom:$nettyVersion"))
when {
osName.contains("linux") -> {
val archClassifier =
if (osArch.contains("aarch64")) {
"linux-aarch_64"
} else {
"linux-x86_64"
}
runtimeOnly(
"io.netty:netty-transport-native-epoll:$nettyVersion:$archClassifier",
)
}
osName.contains("mac") -> {
val archClassifier =
if (osArch.contains("aarch64")) {
"osx-aarch_64"
} else {
"osx-x86_64"
}
runtimeOnly(
"io.netty:netty-transport-native-kqueue:$nettyVersion:$archClassifier",
)
runtimeOnly(
"io.netty:netty-resolver-dns-native-macos:$nettyVersion:$archClassifier",
)
}
}
}
}
}
}