Skip to content

KAFKA-14595 ReassignPartitionsIntegrationTest rewritten in java#14456

Merged
jolshan merged 15 commits intoapache:trunkfrom
nizhikov:KAFKA-14595_integration_test
Oct 2, 2023
Merged

KAFKA-14595 ReassignPartitionsIntegrationTest rewritten in java#14456
jolshan merged 15 commits intoapache:trunkfrom
nizhikov:KAFKA-14595_integration_test

Conversation

@nizhikov
Copy link
Copy Markdown
Contributor

This PR is part of #13247
It contains ReassignPartitionsIntegrationTest rewritten in java.
Goal of PR is reduce changes size in main PR.

Committer Checklist (excluded from commit message)

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

@nizhikov
Copy link
Copy Markdown
Contributor Author

Hello, @showuon
This PR is part of #13247
This is last test of ReassignPartitionCommand in scala.
If you have some time, please, join the review.

@nizhikov
Copy link
Copy Markdown
Contributor Author

Hello @tledkov can you, please, take a look?

Copy link
Copy Markdown

@tledkov tledkov left a comment

Choose a reason for hiding this comment

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

The patch is OK with me.
New java-test looks similar to the removed scala-test.

It would be nice to draw the community's attention to the fact that the functionality of ClusterTestExtensions is insufficient. The @BeforeEach cannot use with a started cluster. And there is not similar fucntionality. In this test, for example, this is the reason for copying the call of the method createTopics in each test.


private Admin adminClient;

@ClusterTemplate("zkAndKRaft")
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.

Can we keep with the @ParameterizedTest format we use for other tests? I think it is good to keep things consistent.

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.

Also let me know if this was decided for the Java migrations and I missed that. 😅

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.

Hello, @jolshan

For now, I know the following ways to setup integration test

  • Use scala QuorumTestHarness - see existing ReassignPartitionsIntegrationTest.scala.
  • Use java annotation @ClusterTestDefaults - see DeleteRecordsCommandTest.
  • Use @ClusterTemplate - like I did in ReassignPartitionsIntegrationTest.java for now.

I don't know what is the correct way to implement test.
AFAICU you suggesting to use QuorumTestHarness with ParametrizedTest annotation.
Is this correct?

I had such version of ReassignPartitionsIntegrationTest.java but replace it with the current version. So it's will be easy to revert to earlier version :)

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 was suggesting the QuorumTestHarness approach, but I wasn't sure if there was a unified/preferred way to do the conversions. Unless there are any issues with the QuorumTestHarness approach or there are benefits with the ClusterTemplate one, I think it makes sense to stick with it.

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.

I reverted new ReassignPartitionsIntegrationTest to use QuorumTestHarness so now it's structure is very similary to the scala version. Please, take a look.

Copy link
Copy Markdown
Member

@jolshan jolshan left a comment

Choose a reason for hiding this comment

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

Thanks @nizhikov. A few comments


@SuppressWarnings({"deprecation", "unchecked"})
private static <T> scala.collection.mutable.Set<T> mutableSet(final T...set) {
return JavaConverters.asScalaSet(new HashSet<>(Arrays.asList(set)));
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 thought we had some non-deprecated methods to do this in the code. Is this no longer the case?

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.

Is this no longer the case?

I spend some time to find one during implementation of #14355 , actually.
All methods I found either don't exists in scala 2.12 or deprecated in scala 2.13.

Do you know the way to convert collections scala <-> java that will work both in scala 2.12 and scala 2.13 and will not be deprecated in scala 2.13?

Anyway, these methods will be removed in #13247 .

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.

Hmm. I think I saw some examples of scala.collection.JavaConverters that didn't have deprecation warnings on them. I did a search of asScala in the java files and looked if the files had deprecation warnings. There were a few that seemed to not.

If we remove these, then maybe it's ok. We should file a JIRA to clean them up though.

Copy link
Copy Markdown
Contributor Author

@nizhikov nizhikov Sep 30, 2023

Choose a reason for hiding this comment

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

We should file a JIRA to clean them up though

Jira not required - because in #13247 I will remove ReassignPartitionCommand.scala therefore all POJO inside it.
So all tests will forcefully use java versions of clasees.

The goal of this PR is to simplify review of the single test conversion and reduce changes in #13247

}
}

private ReassignPartitionsCommand.VerifyAssignmentResult asScala(VerifyAssignmentResult res) {
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'm not sure how I feel about these asScala methods. I'm wondering if there is any way to give a better name or make this cleaner.

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.

Will these also be removed in the other PR you mentioned?

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.

Yes. asScala methods will be removed in #13247

@nizhikov
Copy link
Copy Markdown
Contributor Author

@jolshan Thanks for the review. I resolve all your comments. Please, take a look one more time.

@nizhikov
Copy link
Copy Markdown
Contributor Author

@jolshan I answered all your question. Take a look, please.

@nizhikov
Copy link
Copy Markdown
Contributor Author

nizhikov commented Oct 2, 2023

CI is OK after code review changes.
@jolshan do you have other comments?

@jolshan
Copy link
Copy Markdown
Member

jolshan commented Oct 2, 2023

Hey sorry. I was off for the weekend. I can take another look.

Copy link
Copy Markdown
Member

@jolshan jolshan left a comment

Choose a reason for hiding this comment

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

Thanks Nikolay!

@jolshan jolshan merged commit 8f8dbad into apache:trunk Oct 2, 2023
@nizhikov
Copy link
Copy Markdown
Contributor Author

nizhikov commented Oct 2, 2023

@jolshan Thank you very much for the review and merge. Appreciate it.

Comment thread build.gradle
testImplementation project(':connect:api')
testImplementation project(':connect:runtime')
testImplementation project(':connect:runtime').sourceSets.test.output
testImplementation project(':storage:api').sourceSets.main.output
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.

@nizhikov
This gradle change is breaking trunk builds for me locally, should this be :storage:storage-api instead?

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 see builds fail on jenkins similarly -
https://lists.apache.org/thread/qnscvw8nb3dscrkm43r7g5224067jzc6

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.

Hello.

Please, take a look at jenkins build of trunk after this merged - https://ci-builds.apache.org/blue/organizations/jenkins/Kafka%2Fkafka/detail/trunk/2248/pipeline

Looks like it builds successfully.
Can you, please, clarify, how you trying to build trunk and what exactly fails?

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.

It seems like 7553d3f breaks compilation.

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.

I will provide fix in the nearest time.

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.

Fix - #14475

Copy link
Copy Markdown
Contributor Author

@nizhikov nizhikov Oct 3, 2023

Choose a reason for hiding this comment

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

@msn-tldr Fix merged e90f82b

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 was worried for a moment since I definitely checked the build on this 😅 Glad it was sorted.

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.

@nizhikov i can see its fixed in trunk, thanks.

k-wall pushed a commit to k-wall/kafka that referenced this pull request Nov 21, 2023
…he#14456)

This PR is part of apache#13247
It contains ReassignPartitionsIntegrationTest rewritten in java.
Goal of PR is reduce changes size in main PR.

Reviewers: Taras Ledkov  <tledkov@apache.org>, Justine Olshan <jolshan@confluent.io>
AnatolyPopov pushed a commit to aiven/kafka that referenced this pull request Feb 16, 2024
…he#14456)

This PR is part of apache#13247
It contains ReassignPartitionsIntegrationTest rewritten in java.
Goal of PR is reduce changes size in main PR.

Reviewers: Taras Ledkov  <tledkov@apache.org>, 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.

4 participants