Skip to content
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

Refactor the testIsTaskCurrent test case to improve the test experience #12512

Closed
wants to merge 2 commits into from

Conversation

Codegass
Copy link
Contributor

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 tests testIsTaskCurrentTaskFromStorage(), testIsTaskCurrentTaskFromStorageMismatchedDataSchema(), testIsTaskCurrentTaskFromStorageMismatchedTuningConfig(), testIsTaskCurrentTaskFromStorageMismatchedPartitionsWithTaskGroup(), and one setup function isCurrentSetup().


Key changed/added class in this PR
  • KinesisSupervisorTest

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

minMessageTime,
maxMessageTime,
dataSchema
);
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link

This pull request has been marked as stale due to 60 days of inactivity.
It will be closed in 4 weeks if no further activity occurs. If you think
that's incorrect or this pull request should instead be reviewed, please simply
write any comment. Even if closed, you can still revive the PR at any time or
discuss it on the dev@druid.apache.org list.
Thank you for your contributions.

@github-actions github-actions bot added the stale label Dec 16, 2023
Copy link

This pull request/issue has been closed due to lack of activity. If you think that
is incorrect, or the pull request requires review, you can revive the PR at any time.

@github-actions github-actions bot closed this Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor the testIsTaskCurrent test case to improve the test experience
3 participants