Skip to content

MINOR: Speed up Streams integration test restarts - #23564

Open
liuliuOD wants to merge 4 commits into
apache:trunkfrom
liuliuOD:fix/streams-leave-group-optimization
Open

liuliuOD wants to merge 4 commits into
apache:trunkfrom
liuliuOD:fix/streams-leave-group-optimization

Conversation

@liuliuOD

@liuliuOD liuliuOD commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Some Kafka Streams integration tests closed and immediately restarted a Streams instance with the same application ID. With the default shutdown behavior, the consumer could remain in the group until session.timeout.ms expired, causing unnecessary waiting before the next instance could start or continue the test scenario.

This change explicitly uses LEAVE_GROUP for clean shutdown paths followed by state deletion, restoration, offset manipulation, or application restart. Final teardown paths remain unchanged when group membership removal is not required.

Test time (JUnit XML execution time, excluding Gradle build and compilation):

Case Before After
LagFetchIntegrationTest 56.571s 12.830s
RestoreIntegrationTest 232.285s 141.425s
SelfManagedOffsetLifecycleIntegrationTest 102.714s 51.617s
SlidingWindowedKStreamIntegrationTest 504.080s 62.447s
Total targeted scope (81 tests) 16m04.97s 5m41.29s

Test-only change. No production code, public APIs, test inputs, or assertions are affected.

Reviewers: Murali Basani muralidhar.basani@aiven.io, Ken Huang s7133700@gmail.com

@github-actions github-actions Bot added streams tests Test fixes (including flaky tests) small Small PRs triage PRs from the community labels Sep 23, 2026

// wipe out state store to trigger restore process on restart
streams.close();
streams.close(CloseOptions.groupMembershipOperation(CloseOptions.GroupMembershipOperation.LEAVE_GROUP));

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.

I think leave group is by default in new protocol and this test uses new protocol.
Would this be redundant in this case ?

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.

This test covers both protocols, so explicitly setting LEAVE_GROUP seems totally fine to me.

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

Labels

ci-approved small Small PRs streams tests Test fixes (including flaky tests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants