Skip to content

KAFKA-14589 ConsumerGroupServiceTest rewritten in java#15248

Merged
jolshan merged 31 commits into
apache:trunkfrom
nizhikov:KAFKA-14589_test1
Jan 26, 2024
Merged

KAFKA-14589 ConsumerGroupServiceTest rewritten in java#15248
jolshan merged 31 commits into
apache:trunkfrom
nizhikov:KAFKA-14589_test1

Conversation

@nizhikov

@nizhikov nizhikov commented Jan 23, 2024

Copy link
Copy Markdown
Contributor

This PR is part of #14471
Is contains single test rewritten in java.
Intention of separate PR is to reduce changes and simplify review.

Committer Checklist (excluded from commit message)

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

@nizhikov nizhikov changed the title KAFKA-14589 [WIP] KAFKA-14589 ConsumerGroupServiceTest rewritten in java Jan 23, 2024
@nizhikov

Copy link
Copy Markdown
Contributor Author

Hello @mimaison , @jolshan

I prepared second PR for KAFKA-14589.
It contains ConsumerGroupServiceTest rewritten in java.
Please, take a look.

@nizhikov

Copy link
Copy Markdown
Contributor Author

@tledkov can you, please, take a look?

@nizhikov

nizhikov commented Jan 24, 2024

Copy link
Copy Markdown
Contributor Author

CI are OK.

@nizhikov

Copy link
Copy Markdown
Contributor Author

Hello @showuon

Can you, please, take a look?

when(admin.listOffsets(offsetsArgMatcher(), any()))
.thenReturn(listOffsetsResult());

Tuple2<Option<String>, Option<Seq<ConsumerGroupCommand.PartitionAssignmentState>>> res = groupService.collectGroupOffsets(GROUP);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is there a way we could say what the tuple contains? like stateAndAssignments

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Renamed

TopicPartition testTopicPartition4 = new TopicPartition("testTopic2", 1);
TopicPartition testTopicPartition5 = new TopicPartition("testTopic2", 2);

// Some topic's partitions gets valid OffsetAndMetadata values, other gets nulls values (negative integers) and others aren't defined

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this comment correct? Or the test? I don't see the negative values

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Actually, I just copied it from the scala version of test.
Removed mention about negative values.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The test is called testAdminRequestsForDescribeNegativeOffsets so we might want to figure out if that's the original intention.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Looked in git log and this comment here from the moment test added - so I think we want to keep it as is, because we just move them to java - d95c191#diff-fcf6c81f0d8445b938d80a9d1f5ef838f731807d27b3f22a2cfefe2762b3001eR78

@jolshan jolshan Jan 24, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh I see -- at this point the negative value is already converted to null. The comment in this test was confusing.

See https://github.com/apache/kafka/pull/8057/files or

// Negative offset indicates that the group has no committed offset for this partition

private ListConsumerGroupOffsetsResult listGroupOffsetsResult(String groupId) {
Map<TopicPartition, OffsetAndMetadata> offsets = TOPIC_PARTITIONS.stream().collect(Collectors.toMap(
Function.identity(),
tp -> new OffsetAndMetadata(100)));

@jolshan jolshan Jan 24, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we don't actually need the tp here right? Just a name for the argument we don't use. Ditto to some of the usages below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

renamed to unused

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think there are a few places in code we use __ to signify an unused argument. Note there are two underscores and not one like in scala.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OK. renamed to __

@nizhikov

Copy link
Copy Markdown
Contributor Author

Hello @jolshan
Do you have any other questions regarding this PR?

@jolshan

jolshan commented Jan 26, 2024

Copy link
Copy Markdown
Member

Sorry I meant to check this one yesterday but accidentally looked at your other PR. I thought I was waiting on build issues there, but should have been looking here. Looking now.

@jolshan jolshan merged commit 13c0c5e into apache:trunk Jan 26, 2024
yyu1993 pushed a commit to yyu1993/kafka that referenced this pull request Feb 15, 2024
This PR is part of apache#14471
Is contains single test rewritten in java.
Intention of separate PR is to reduce changes and simplify review.

Reviewers: Justine Olshan <jolshan@confluent.io>
clolov pushed a commit to clolov/kafka that referenced this pull request Apr 5, 2024
This PR is part of apache#14471
Is contains single test rewritten in java.
Intention of separate PR is to reduce changes and simplify review.

Reviewers: Justine Olshan <jolshan@confluent.io>
Phuc-Hong-Tran pushed a commit to Phuc-Hong-Tran/kafka that referenced this pull request Jun 6, 2024
This PR is part of apache#14471
Is contains single test rewritten in java.
Intention of separate PR is to reduce changes and simplify review.

Reviewers: Justine Olshan <jolshan@confluent.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants