Refactor the testIsTaskCurrent test case to improve the test experience#12512
Refactor the testIsTaskCurrent test case to improve the test experience#12512Codegass wants to merge 2 commits intoapache:masterfrom
Conversation
…tup as one method for the four unit test.
| minMessageTime, | ||
| maxMessageTime, | ||
| dataSchema | ||
| ); |
There was a problem hiding this comment.
Nice improvement in general. A drawback of this change is the copy/past of the same block of lines. Suggestion, pull the material on lines 3916-3935 into a method, taking the id as a parameter. You need two values back: supervisor and taskStorage. This can be done using Druid's Pair class, or by creating an ad-hoc class. The ad-hoc class might be nice: the setup could be done in the constructor. Pick whatever solution you prefer, but let's try to avoid the redundancy.
There was a problem hiding this comment.
Thank you a lot for the suggestions! I am still new to the Druid project, this comment is really helpful for me!
I will try to update this part today with the Pair Class and avoid redundancy.
|
This pull request has been marked as stale due to 60 days of inactivity. |
|
This pull request/issue has been closed due to lack of activity. If you think that |
Fixes #12398 .
Description
The test case testIsTaskCurrent is testing the
supervisor.isTaskCurrent()with 4 different scenarios (taskFromStorage,taskFromStorageMismatchedDataSchema,taskFromStorageMismatchedTuningConfig,taskFromStorageMismatchedPartitionsWithTaskGroup) in one single test case. In my humble opinion, it could be beneficial to separate the four scenarios into four individual test cases. Each test case will focus on one scenario.So in this PR, based on the discussion in #12398 , the
testIsTaskCurrent()is replaced by four unit teststestIsTaskCurrentTaskFromStorage(),testIsTaskCurrentTaskFromStorageMismatchedDataSchema(),testIsTaskCurrentTaskFromStorageMismatchedTuningConfig(),testIsTaskCurrentTaskFromStorageMismatchedPartitionsWithTaskGroup(), and one setup functionisCurrentSetup().Key changed/added class in this PR
KinesisSupervisorTestThis PR has: