kafka icon indicating copy to clipboard operation
kafka copied to clipboard

KAFKA-14058: Migrate ExactlyOnceWorkerSourceTaskTest from EasyMock and PowerMock to Mockito

Open C0urante opened this issue 2 years ago • 3 comments

Jira

Some notes:

  1. Introduced new ConcurrencyUtils and MockitoUtils classes for reusable testing logic that will likely be used in the near future for KAFKA-14059 and KAFKA-14060.
  2. Refactored a lot of common logic into dedicated methods, which reduces test size and should make tests easier to write.
  3. Doubled the default record batch size from 1 to 2. This provides better coverage and, after all the refactoring from step 2, required no modifications to mocking, verification, or assertion logic anywhere in the test suite.
  4. Stopped inheriting from the ThreadedTest class as it does nothing (filed https://github.com/apache/kafka/pull/12410 to apply this change across the board).
  5. Once this looks good enough to merge, I'll begin applying the same changes to the WorkerSourceTaskTest and possibly AbstractWorkerSourceTaskTest test suites.

Committer Checklist (excluded from commit message)

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

C0urante avatar Jul 14 '22 23:07 C0urante

@clolov since you've been working on the JUnit migration for Streams, would you be interested in reviewing this?

C0urante avatar Jul 14 '22 23:07 C0urante

Oh, apologies, I didn't get a notification for this. Yep, I will review it shortly.

clolov avatar Jul 19 '22 16:07 clolov

I find this refactor quite readable. Looks good to me :)

clolov avatar Jul 20 '22 08:07 clolov

Rebased on latest trunk, test failures appear unrelated.

@showuon @mimaison would one of you be able to take a look at this?

C0urante avatar Oct 11 '22 14:10 C0urante

Thanks @mimaison. Test failures appear unrelated, going to merge.

C0urante avatar Nov 03 '22 16:11 C0urante