Skip to content

[improve][test] Re-enable broker-dependent Kafka Connect Adaptor tests (sink/source at 0% coverage) #118

Description

@david-streamlio

Summary

Five Kafka Connect Adaptor test files are excluded from compilation in kafka-connect-adaptor/build.gradle.kts, so the adaptor's core sink/source/offset paths have 0% executed test coverage. This is a tracking issue to re-enable them.

Background

Introduced in #31 ("Fix loading offset issues in Kafka Adaptor"), which noted the adaptor tests do not compile against the pinned Pulsar artifacts and left this exclusion in place:

// 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<JavaCompile>("compileTestJava") { exclude(brokerDependentTestSources) }

The excluded suites are comprehensive (~62 @Test methods total, e.g. KafkaConnectSinkTest has 45) and are ProducerConsumerBase-based integration tests against an in-process Pulsar broker. They are written — just switched off.

Impact — measured coverage

A JaCoCo run of the module's currently-executing tests (PulsarSchemaToKafkaSchemaTest, KafkaConnectOffsetConverterTest only):

  • Module: 8.7% lines, 7.2% branches, 9.3% methods.
Class Line coverage
PulsarSchemaToKafkaSchema 73.2%
KafkaConnectData 11.4%
AbstractKafkaConnectSource 3.7%
KafkaConnectSink (+ resolver) 0% (0/282)
KafkaConnectSource (+ record) 0% (0/160)
PulsarOffsetBackingStore 0% (0/135)
PulsarKafkaSinkTaskContext 0% (0/115)
KafkaSchemaWrappedSchema, PulsarKafkaSinkContext, PulsarIOSourceTaskContext, sink config 0%

So the connector's two most important classes — the sink and the source — currently have no running test coverage in CI.

Proposed resolution

  1. Determine the exact Pulsar artifact/API gap the excluded tests need against the pinned pulsar = 4.2.0 (broker tests classifier / ProducerConsumerBase API).
  2. Either:
    • bump to a Pulsar release whose published pulsar-broker (+ tests jar) satisfies the tests, or
    • adapt the excluded tests to the released 4.2.0 broker test API.
  3. Remove the brokerDependentTestSources exclusion and confirm the suites compile and pass in CI.
  4. Add JaCoCo (module or aggregated) so this regression is visible going forward.

Acceptance

  • brokerDependentTestSources exclusion removed.
  • KafkaConnectSinkTest / KafkaConnectSourceTest / PulsarOffsetBackingStoreTest / source-error tests compile and run in CI.
  • KafkaConnectSink and KafkaConnectSource show non-trivial executed coverage.

Related: #30, #31.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions