Skip to content

KAFKA-19285: Added more tests in SharePartitionManagerTest #19778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

chirag-wadhwa5
Copy link
Contributor

This PR includes more unit tests in the file SharePartitionManagerTest to improve the coverage

@github-actions github-actions bot added triage PRs from the community core Kafka Broker tests Test fixes (including flaky tests) KIP-932 Queues for Kafka labels May 21, 2025
@apoorvmittal10 apoorvmittal10 added ci-approved and removed triage PRs from the community labels May 21, 2025
Copy link
Member

@AndrewJSchofield AndrewJSchofield left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I have left some comments because the tests don't quite seem to be doing what is suggested.

assertInstanceOf(ShareSessionContext.class, context1);
assertFalse(((ShareSessionContext) context1).isSubsequent());

// The expected epoch from the share session should be 1, but we are passing 2. This should throw an exception.
Copy link
Member

Choose a reason for hiding this comment

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

Aren't we passing FINAL_EPOCH?

// The expected epoch from the share session should be 1, but we are passing 2. This should throw an exception.
assertDoesNotThrow(
() -> sharePartitionManager.acknowledgeSessionUpdate("grp",
new ShareRequestMetadata(memberId, ShareRequestMetadata.nextEpoch(ShareRequestMetadata.INITIAL_EPOCH))));
Copy link
Member

Choose a reason for hiding this comment

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

Aren't we passing 1? The next epoch after the initial epoch is 1, isn't it?

assertInstanceOf(ShareSessionContext.class, context1);
assertFalse(((ShareSessionContext) context1).isSubsequent());

// The expected epoch from the share session should be 1, but we are passing 2. This should throw an exception.
Copy link
Member

Choose a reason for hiding this comment

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

Aren't we passing 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review. I understand the other places I forgot to update the log, but I believe in this referred place it is fine. The code does the following ->
ShareRequestMetadata.nextEpoch(ShareRequestMetadata.nextEpoch(ShareRequestMetadata.INITIAL_EPOCH))

ShareRequestMetadata.nextEpoch() is called twice, thereby increasing epoch from 0 to 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-approved core Kafka Broker KIP-932 Queues for Kafka tests Test fixes (including flaky tests)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants