-
Notifications
You must be signed in to change notification settings - Fork 509
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
HDDS-10917. Refactoring more tests from TestContainerBalancerTask #6734
Conversation
…TestContainerBalancerDatanodeNodeLimit using MockedSCM
@siddhantsangwan, take a look please |
@siddhantsangwan , take a look please |
@afilpp @sarvekshayr @sumitagrawl @Tejaskriya can you please help review this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch @Montura. Are you also planning to move the other tests in TestContainerBalancerTask to TestContainerBalancerDatanodeNodeLimit with new PRs?
int nodeCount = mockedSCM.getCluster().getNodeCount(); | ||
if (nodeCount < DATANODE_COUNT_LIMIT_FOR_SMALL_CLUSTER) { | ||
config.setMaxDatanodesPercentageToInvolvePerIteration(100); | ||
} | ||
config.setIterations(1); | ||
config.setThreshold(10); | ||
config.setMaxSizeToMovePerIteration(50 * STORAGE_UNIT); | ||
config.setMaxSizeEnteringTarget(50 * STORAGE_UNIT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be a part of most of the tests in this class, causing a lot of code duplication. Can we move this to the setup? Any test that required different values, it can be set again in the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reviewing.
Actually, in the first version I hid this config settings in the class. But @siddhantsangwan told that is better to have config setup in each test. At least for lines 341-343.
I agree with you that all this config setup shouldn't be duplicated. I'm ready to fix this in next PR with next refactored tests.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we can move the default configs to the setup, any specific ones can be added in each test. In many other tests also we follow the same pattern
Sure, I have plans to finish it in one or two PRs (@siddhantsangwan has told first time that too many lines per one PR). I'd like to finish in one PR of course. |
Splitting it into many PRs will make it easy for reviews, it makes sense. |
@adoroszlai , could you merge please? Or I have to do something else? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Montura for working on this patch. The changes LGTM.
Thanks @Montura for the patch, @sarvekshayr, @Tejaskriya for the review. |
In PR for HDDS-9889 we discussed with Siddhant Sangwan that tests form
org.apache.hadoop.hdds.scm.container.balancer.TestContainerBalancerTask
could be refactored usingMockedSCM
class (introduced in HDDS-9889)Some work has been already done in:
What changes were proposed in this pull request?
org.apache.hadoop.hdds.scm.container.balancer.TestContainerBalancerTask
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-10917
How was this patch tested?
Use standalone tests