Skip to content

Reduce duplication in MockConsumer* test classes #40

@astubbs

Description

@astubbs

Context

The file-similarity tool on PR #34 flagged MockConsumerTestWithCommitTimeoutException and MockConsumerTestWithEarlyClose at 70.7% similarity (up from 65.1% after applying the same daemon-thread cleanup pattern to both).

More broadly, the test codebase has several standalone test classes (MockConsumerTest*, ProducerManagerTest) that duplicate infrastructure that could be shared.

Scope

  1. MockConsumer tests*: Extract common setup (mock consumer creation, record-adder daemon thread, PC lifecycle, cleanup) into a shared base class or helper. Each test overrides only the failure behaviour and assertion.

  2. General test deduplication audit: Review the file-similarity report for other high-similarity pairs in src/test/ and src/test-integration/ and refactor where the duplication is structural (not just "similar test shape").

Not blocking

The 70.7% is within the fail_above: 80 threshold. This is cleanup work, not urgent.

Surfaced during PR #34 CI reliability work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions