-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
Unit tests for usage of incorrect RPCs / group type pairs #18383
base: kip1071
Are you sure you want to change the base?
Conversation
In the GroupMetadataManager, we may call an RPC on an incorrect group type. This adds unit tests to validate the behavior when an RPC is used on an incorrect group type.
@@ -741,6 +741,7 @@ public List<StreamsGroupDescribeResponseData.DescribedGroup> streamsGroupDescrib | |||
describedGroups.add(new StreamsGroupDescribeResponseData.DescribedGroup() | |||
.setGroupId(groupId) | |||
.setErrorCode(Errors.GROUP_ID_NOT_FOUND.code()) | |||
.setErrorMessage(exception.getMessage()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was actually inconsistent to other group types
@@ -18,6 +18,7 @@ | |||
package org.apache.kafka.coordinator.group.taskassignor; | |||
|
|||
import org.apache.kafka.coordinator.group.GroupCoordinatorConfig; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spotlessApply
@@ -9373,7 +9375,8 @@ public void testStreamsGroupDescribeBeforeAndAfterCommittingOffset() { | |||
List<StreamsGroupDescribeResponseData.DescribedGroup> actual = context.groupMetadataManager.streamsGroupDescribe(Collections.singletonList(streamsGroupId), context.lastCommittedOffset); | |||
StreamsGroupDescribeResponseData.DescribedGroup describedGroup = new StreamsGroupDescribeResponseData.DescribedGroup() | |||
.setGroupId(streamsGroupId) | |||
.setErrorCode(Errors.GROUP_ID_NOT_FOUND.code()); | |||
.setErrorCode(Errors.GROUP_ID_NOT_FOUND.code()) | |||
.setErrorMessage("Group " + streamsGroupId + " not found."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updates behavior according to the above change to production code.
@@ -15673,6 +15676,349 @@ public void testReplayStreamsGroupTopologyTombstone() { | |||
assertThrows(GroupIdNotFoundException.class, () -> context.groupMetadataManager.streamsGroup("bar")); | |||
} | |||
|
|||
@Test | |||
public void testConsumerGroupHeartbeatOnStreamsGroup() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test are pretty repetitive - like the ones for the other group types. I considered saving some LOC (by using private helper methods, and parametrized tests), but kept them at way, since it's going to be easier to refactor if each test is self-contained.
In the GroupMetadataManager, we may call an RPC on an incorrect group type. This adds unit tests to validate the behavior when an RPC is used on an incorrect group type.
Committer Checklist (excluded from commit message)