Skip to content

MINOR: Split GroupMetadataManagerTest into per-group-type files#22350

Open
sjhajharia wants to merge 2 commits into
apache:trunkfrom
sjhajharia:split-gmm-tests-file
Open

MINOR: Split GroupMetadataManagerTest into per-group-type files#22350
sjhajharia wants to merge 2 commits into
apache:trunkfrom
sjhajharia:split-gmm-tests-file

Conversation

@sjhajharia
Copy link
Copy Markdown
Collaborator

@sjhajharia sjhajharia commented May 22, 2026

Description:

GroupMetadataManagerTest.java had grown to 27,879 lines / 406
@Test methods
, testing four distinct group types (Classic,
Consumer/KIP-848, Share/KIP-932, Streams/KIP-1071) plus cross-cutting
concerns in a single file. This made the file slow to navigate, prone to
merge conflicts between teams, and left contributors with no clear rule
for where new tests should land.

What changed

The file is split, by group type, into five files in the same package:

  • GroupMetadataManagerTest (residual) | 39 tests |
    Group-type-agnostic: list/describe, metadata-image plumbing, dynamic
    config wiring, cross-type rejection
  • GroupMetadataManagerConsumerGroupTest | 129 tests | KIP-848
    consumer-group heartbeat/reconciliation/regex/replay, classic↔consumer
    migration paths
  • GroupMetadataManagerClassicGroupTest | 130 tests | Classic protocol
    join/sync/heartbeat/leave, static membership, rebalance/session timeouts
  • GroupMetadataManagerShareGroupTest | 41 tests | KIP-932 share-group
    heartbeat, init/delete, offset deletion, replay
  • GroupMetadataManagerStreamsGroupTest | 69 tests | KIP-1071
    streams-group heartbeat, topology, task assignment, replay

Each new class has a Javadoc stating its scope so future contributors
can pick a destination by reading one sentence: a test goes into the
file matching the group type whose operation it exercises
; genuinely
cross-cutting tests go in the residual GroupMetadataManagerTest.

The shared GroupMetadataManagerTestContext is unchanged. No production
code is changed. No tests are renamed, deleted, or modified — every
@Test is moved byte-identically into its new home. Helpers that were
only used by a single bucket move with their callers; nothing required
promotion to TestContext (verified via call-site analysis).

checkstyle/suppressions.xml was updated to add the four new file names
alongside the existing GroupMetadataManagerTest entry (the new files
inherit the same NPathComplexity, MethodLength,
ClassFanOutComplexity, ClassDataAbstractionCoupling, JavaNCSS
suppressions the original already had).

@github-actions github-actions Bot added triage PRs from the community group-coordinator labels May 22, 2026
Resolves conflict in GroupMetadataManagerTest.java caused by trunk
commit f7dbf0b (KAFKA-20570) adding two tests for malformed
ConsumerProtocol deserialization.

Both new tests exercise the classic->consumer migration code path
(testConsumerGroupHeartbeatWithStableClassicGroupFailsOnMalformedProtocol
and testClassicGroupJoinToConsumerGroupFailsOnMalformedSubscriptionMetadata),
so per the split's assignment rule they are placed in
GroupMetadataManagerConsumerGroupTest.java alongside the other
testClassicGroup*ToConsumerGroup* migration tests, not in the
residual GroupMetadataManagerTest.java.

Verified: ./gradlew :group-coordinator:test --rerun-tasks
- 1,758 tests, 0 failures, 0 errors, 0 skipped
- Both newly relocated tests pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant