Skip to content

KAFKA-20627: Add broker integration tests for topology description plugin#22775

Open
aliehsaeedii wants to merge 8 commits into
apache:trunkfrom
aliehsaeedii:KAFKA-20627
Open

KAFKA-20627: Add broker integration tests for topology description plugin#22775
aliehsaeedii wants to merge 8 commits into
apache:trunkfrom
aliehsaeedii:KAFKA-20627

Conversation

@aliehsaeedii

@aliehsaeedii aliehsaeedii commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Adds the integration test coverage for the streams group topology
description plugin (KIP-1331) requested in
KAFKA-20627:

Broker-level RPC tests (core)

  • StreamsGroupTopologyDescriptionRequestTest (plugin configured
    with InMemoryTopologyDescriptionPlugin):
    • heartbeat solicits the push via TopologyDescriptionRequired, the
      push → describe lifecycle returns AVAILABLE with the stored topology,
      and there is no re-solicitation once stored
    • validation errors: empty group/member id → INVALID_REQUEST,
      unknown group → GROUP_ID_NOT_FOUND, unknown member →
      UNKNOWN_MEMBER_ID, stale topology epoch → INVALID_REQUEST
    • DeleteGroups succeeds on a group with a stored description and the
      group is gone afterwards
  • StreamsGroupTopologyDescriptionNoPluginRequestTest (no plugin
    configured): the push RPC returns UNSUPPORTED_VERSION, heartbeats
    never solicit a push, and describe reports NOT_STORED
  • GroupCoordinatorBaseRequestTest: new
    streamsGroupTopologyDescriptionUpdate helper and
    IncludeTopologyDescription support on streamsGroupDescribe

End-to-end tests with real KafkaStreams clients

(streams/integration-tests)

  • TopologyDescriptionPluginIntegrationTest — 4 tests covering the
    core push lifecycle on a live cluster:
    • topology description reaches the plugin after join
    • two-member group deduplicates: only one push happens
    • permanent plugin failure ratchets the failed epoch and stops
      re-solicitation (call count stays at one, the application keeps running,
      describe reports NOT_STORED)
    • explicit DeleteGroups triggers plugin.deleteTopology
  • TopologyDescriptionPluginExpirationIntegrationTest — 2 tests
    covering natural group expiry:
    • group with stored topology: the cleanup cycle calls
      plugin.deleteTopology and clears the stored epoch before the
      expiration sweep tombstones the group
    • group whose push permanently failed (stored epoch -1): the
      tombstone fires directly without any deleteTopology call
  • TopologyDescriptionNoPluginIntegrationTest — 1 test keeping the
    plugin-less production default exercised end-to-end at the streams
    level: a real KafkaStreams client joins and runs normally against a
    broker without a plugin (no push is ever solicited), and describe with
    includeTopologyDescription reports NOT_STORED
  • The plugin-configured tests observe the broker through a new
    TrackingTopologyDescriptionPlugin test plugin (extends
    InMemoryTopologyDescriptionPlugin, records per-group
    setTopology/deleteTopology calls in static state and can inject
    permanent failures) — the embedded brokers run in the test JVM

CLI and Admin API

  • DescribeStreamsGroupTest#testDescribeStreamsGroupWithTopologyOption:
    exercises kafka-streams-groups.sh --describe --topology end-to-end,
    waiting until the output contains Topologies: and the source topic
    name

PlaintextAdminIntegrationTest#testDescribeStreamsGroupsWithTopologyDescription:
DescribeStreamsGroupsOptions.includeTopologyDescription wiring
(NOT_REQUESTED / NOT_STORED on a plugin-less cluster; the
AVAILABLE path is covered via the Admin API in
TopologyDescriptionPluginIntegrationTest)

Infrastructure

  • EmbeddedKafkaCluster.addDefaultBrokerPropsIfAbsent now configures
    InMemoryTopologyDescriptionPlugin via putIfAbsent, so all streams
    integration tests exercise the topology description path and catch
    regressions without per-test changes. An explicitly empty value for
    group.streams.topology.description.plugin.class opts out and runs the
    broker with the plugin-less production default (a Properties cannot
    carry null and an empty class name would fail config parsing)
  • streams:integration-tests gains a group-coordinator-api test
    dependency; import-control allows org.apache.kafka.server.streams in
    streams integration tests

Testing

All 15 new tests pass locally, plus checkstyle on the touched modules.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

🤖 Generated with Claude Code

…ugin

Add integration test coverage for the streams group topology description
plugin (KIP-1331):

- StreamsGroupTopologyDescriptionRequestTest: broker-level RPC tests with
  the InMemoryTopologyDescriptionPlugin configured, covering heartbeat
  solicitation, the push-describe lifecycle, validation errors
  (INVALID_REQUEST / GROUP_ID_NOT_FOUND / UNKNOWN_MEMBER_ID / stale epoch),
  and DeleteGroups with a stored description.
- StreamsGroupTopologyDescriptionNoPluginRequestTest: UNSUPPORTED_VERSION
  for the push RPC, no heartbeat solicitation, and NOT_STORED on describe
  when no plugin is configured.
- TopologyDescriptionPluginIntegrationTest: end-to-end push lifecycle with
  real KafkaStreams clients — push after join, two-member dedup (exactly
  one setTopology call), permanent plugin failure stops re-solicitation,
  and DeleteGroups invokes plugin.deleteTopology.
- TopologyDescriptionPluginExpirationIntegrationTest: natural group expiry —
  the cleanup cycle calls deleteTopology and clears the stored epoch before
  the group is tombstoned; a group whose push permanently failed is
  tombstoned without any deleteTopology call.
- DescribeStreamsGroupTest#testDescribeStreamsGroupWithTopologyOption:
  kafka-streams-groups.sh --describe --topology end-to-end.
- PlaintextAdminIntegrationTest#testDescribeStreamsGroupsWithTopologyDescription:
  Admin API includeTopologyDescription option (NOT_REQUESTED / NOT_STORED).
- EmbeddedKafkaCluster now configures InMemoryTopologyDescriptionPlugin by
  default so all streams integration tests exercise the topology
  description path.
- GroupCoordinatorBaseRequestTest: new streamsGroupTopologyDescriptionUpdate
  helper and IncludeTopologyDescription support on streamsGroupDescribe.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions github-actions Bot added triage PRs from the community streams core Kafka Broker tools build Gradle build or GitHub Actions labels Jul 7, 2026
aliehsaeedii and others added 7 commits July 7, 2026 13:41
The 2s observation window is shorter than the 30s initial re-solicitation
back-off, so the assertion cannot distinguish the permanent-failure ratchet
from an armed back-off; note that the classification is covered at the unit
level so a future reader does not over-trust it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A retriable send failure (e.g. a disconnect after the broker already
processed the push) makes the client retry, which would produce a second
setTopology call at the same epoch and fail the exactly-one assertion.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…stone

Folding every ExecutionException into 'group not yet deleted' masked real
failures such as admin timeouts; waitForCondition retries a throwing
condition and rethrows the last exception at timeout, so rethrowing keeps
the retry behavior while preserving the diagnostics.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…msGroupTest

testDescribeStreamsGroupWithTopologyOption silently depended on
EmbeddedKafkaCluster's default plugin from another module's test util; a
change to that default would have failed the test as an opaque timeout.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…n opt-out

- pin offsets.retention.check.interval.ms very high in
  TopologyDescriptionPluginIntegrationTest so the explicit DeleteGroups call
  is the only delete path; a slow run crossing the default 10-minute interval
  could otherwise expire the empty, offset-less group first
- expose EmbeddedKafkaCluster.NO_TOPOLOGY_DESCRIPTION_PLUGIN as a documented
  constant for opting out of the default in-memory plugin, replacing the
  magic empty string, and use it in TopologyDescriptionNoPluginIntegrationTest

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@frankvicky frankvicky left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks
LGTM

@github-actions github-actions Bot removed the triage PRs from the community label Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Gradle build or GitHub Actions ci-approved core Kafka Broker streams tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants