From 19f650a2f38cf66eec6a3653bd4e104253e282c3 Mon Sep 17 00:00:00 2001 From: david-streamlio <35466513+david-streamlio@users.noreply.github.com> Date: Wed, 15 Jul 2026 08:09:35 -0700 Subject: [PATCH 1/4] [improve][test] KCA: add pulsar-buildtools so broker tests compile (WIP) The 5 broker-dependent Kafka Connect Adaptor test files were excluded from compilation with a note that they were waiting for unreleased Pulsar artifacts. That is not the case: every class they need is already published in the pinned pulsar 4.2.0. The only gap was TestRetrySupport (the root of the ProducerConsumerBase -> MockedPulsarServiceBaseTest -> TestRetrySupport chain), which lives in org.apache.pulsar:buildtools and was not declared as a test dependency. Adding it makes all 5 files compile; every earlier error was a cascade from that missing supertype. Add testImplementation(libs.pulsar.buildtools) and remove the brokerDependentTestSources compile exclusion. WIP: the tests now COMPILE but do not yet EXECUTE - TestNG silently skips ProducerConsumerBase subclasses in this Gradle harness (reproduced with a minimal probe). That execution issue is tracked separately; see #118. Refs #118 --- kafka-connect-adaptor/build.gradle.kts | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/kafka-connect-adaptor/build.gradle.kts b/kafka-connect-adaptor/build.gradle.kts index ca1b7474ea..e9c71f7ea8 100644 --- a/kafka-connect-adaptor/build.gradle.kts +++ b/kafka-connect-adaptor/build.gradle.kts @@ -55,24 +55,12 @@ dependencies { testImplementation(libs.pulsar.broker) testImplementation(variantOf(libs.pulsar.broker) { classifier("tests") }) testImplementation(libs.pulsar.testmocks) + // Provides TestRetrySupport, the base class of MockedPulsarServiceBaseTest / + // ProducerConsumerBase used by the broker-backed tests below. + testImplementation(libs.pulsar.buildtools) testImplementation(libs.awaitility) testImplementation(libs.kafka.connect.file) testImplementation(libs.asynchttpclient) testImplementation(libs.bc.fips) testImplementation(libs.netty.reactive.streams) } - -// Some KCA tests depend on pulsar-broker internals that have changed since the -// last released version. Those tests will compile once matching pulsar artifacts -// are published; exclude only them for now so that self-contained unit tests -// still compile and run in CI. -val brokerDependentTestSources = listOf( - "**/KafkaConnectSinkTest.java", - "**/KafkaConnectSourceErrRecTest.java", - "**/KafkaConnectSourceErrTest.java", - "**/KafkaConnectSourceTest.java", - "**/PulsarOffsetBackingStoreTest.java", -) -tasks.named("compileTestJava") { - exclude(brokerDependentTestSources) -} From 56cd3dc3c570958ae4a447093e34b1a77c06feaa Mon Sep 17 00:00:00 2001 From: david-streamlio <35466513+david-streamlio@users.noreply.github.com> Date: Wed, 15 Jul 2026 09:34:10 -0700 Subject: [PATCH 2/4] [improve][test] KCA: add opentelemetry-sdk-testing so broker tests execute Adding pulsar-buildtools (previous commit) made the broker-dependent tests compile, but they still silently did not run: TestNG collected zero tests from every MockedPulsarServiceBaseTest subclass. Root cause: TestNG's test discovery calls Class.getDeclaredMethods() on each class in the hierarchy. MockedPulsarServiceBaseTest (from pulsar-broker:tests) has methods whose signatures reference io.opentelemetry.sdk.testing.assertj.* (e.g. LongSumAssert). That type lives in opentelemetry-sdk-testing, which pulsar-broker declares test-scoped, so it is not pulled transitively through the tests jar. getDeclaredMethods() therefore throws NoClassDefFoundError, which TestNG swallows during discovery, yielding zero test methods for the subclass (reproduced identically on macOS and Linux CI, and with raw org.testng.TestNG). Add opentelemetry-sdk-testing to the test classpath. Discovery then succeeds and the full suite runs: KafkaConnectSinkTest (45), KafkaConnectSourceTest (12), PulsarOffsetBackingStoreTest (5), and the source-error tests all execute and pass (99 tests total, 0 failures). Fixes #118 --- kafka-connect-adaptor/build.gradle.kts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kafka-connect-adaptor/build.gradle.kts b/kafka-connect-adaptor/build.gradle.kts index e9c71f7ea8..33b81b93b2 100644 --- a/kafka-connect-adaptor/build.gradle.kts +++ b/kafka-connect-adaptor/build.gradle.kts @@ -58,6 +58,11 @@ dependencies { // Provides TestRetrySupport, the base class of MockedPulsarServiceBaseTest / // ProducerConsumerBase used by the broker-backed tests below. testImplementation(libs.pulsar.buildtools) + // pulsar-broker's tests jar references io.opentelemetry.sdk.testing.assertj.* in method + // signatures; without this on the classpath, TestNG's getDeclaredMethods() call during test + // discovery throws NoClassDefFoundError and silently collects zero tests from every + // MockedPulsarServiceBaseTest subclass. + testImplementation("io.opentelemetry:opentelemetry-sdk-testing:1.56.0") testImplementation(libs.awaitility) testImplementation(libs.kafka.connect.file) testImplementation(libs.asynchttpclient) From aaf4c2e9a8bd46ca19a97e3b912bde4267d62488 Mon Sep 17 00:00:00 2001 From: David Kjerrumgaard <35466513+david-streamlio@users.noreply.github.com> Date: Wed, 15 Jul 2026 09:55:28 -0700 Subject: [PATCH 3/4] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- kafka-connect-adaptor/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kafka-connect-adaptor/build.gradle.kts b/kafka-connect-adaptor/build.gradle.kts index 33b81b93b2..d95095744d 100644 --- a/kafka-connect-adaptor/build.gradle.kts +++ b/kafka-connect-adaptor/build.gradle.kts @@ -62,7 +62,7 @@ dependencies { // signatures; without this on the classpath, TestNG's getDeclaredMethods() call during test // discovery throws NoClassDefFoundError and silently collects zero tests from every // MockedPulsarServiceBaseTest subclass. - testImplementation("io.opentelemetry:opentelemetry-sdk-testing:1.56.0") + testRuntimeOnly(libs.opentelemetry.sdk.testing) testImplementation(libs.awaitility) testImplementation(libs.kafka.connect.file) testImplementation(libs.asynchttpclient) From 5456a03450a8c01d88d3525ac7c77dc48d2c44bc Mon Sep 17 00:00:00 2001 From: david-streamlio <35466513+david-streamlio@users.noreply.github.com> Date: Wed, 15 Jul 2026 10:07:52 -0700 Subject: [PATCH 4/4] [improve][test] Reword buildtools comment (no longer references a list below) Address Copilot review on #119: the exclusion list this comment used to sit above was removed, so 'broker-backed tests below' was stale. Comment-only. --- kafka-connect-adaptor/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kafka-connect-adaptor/build.gradle.kts b/kafka-connect-adaptor/build.gradle.kts index d95095744d..65ceff19a4 100644 --- a/kafka-connect-adaptor/build.gradle.kts +++ b/kafka-connect-adaptor/build.gradle.kts @@ -56,7 +56,7 @@ dependencies { testImplementation(variantOf(libs.pulsar.broker) { classifier("tests") }) testImplementation(libs.pulsar.testmocks) // Provides TestRetrySupport, the base class of MockedPulsarServiceBaseTest / - // ProducerConsumerBase used by the broker-backed tests below. + // ProducerConsumerBase, which this module's broker-backed tests extend. testImplementation(libs.pulsar.buildtools) // pulsar-broker's tests jar references io.opentelemetry.sdk.testing.assertj.* in method // signatures; without this on the classpath, TestNG's getDeclaredMethods() call during test