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

HDDS-10917. Refactoring more tests from TestContainerBalancerTask #6734

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

Montura
Copy link
Contributor

@Montura Montura commented May 28, 2024

In PR for HDDS-9889 we discussed with Siddhant Sangwan that tests form org.apache.hadoop.hdds.scm.container.balancer.TestContainerBalancerTask could be refactored using MockedSCM class (introduced in HDDS-9889)

Some work has been already done in:

  1. HDDS-9889. Refactor tests related to dynamical adaptation for datanode limits in ContainerBalancer #5758
  2. HDDS-10699. Refactor ContainerBalancerTask and tests in TestContainerBalancerTask #6537

What changes were proposed in this pull request?

  1. Refactor some tests from 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

@Montura Montura force-pushed the test_refatoring branch from 8954375 to 6c449f4 Compare May 28, 2024 08:22
…TestContainerBalancerDatanodeNodeLimit using MockedSCM
@Montura Montura force-pushed the test_refatoring branch from 6c449f4 to 7db6724 Compare May 28, 2024 10:28
@Montura Montura changed the title HDDS-10917: Refactoring more tests from TestContainerBalancerTask HDDS-10917. Refactoring more tests from TestContainerBalancerTask May 30, 2024
@Montura
Copy link
Contributor Author

Montura commented May 31, 2024

@siddhantsangwan, take a look please

@Montura
Copy link
Contributor Author

Montura commented Jun 27, 2024

@siddhantsangwan , take a look please

@adoroszlai
Copy link
Contributor

@afilpp @sarvekshayr @sumitagrawl @Tejaskriya can you please help review this?

Copy link
Contributor

@Tejaskriya Tejaskriya left a 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?

Comment on lines +340 to +347
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);
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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

@Montura
Copy link
Contributor Author

Montura commented Jul 25, 2024

Thanks for the patch @Montura. Are you also planning to move the other tests in TestContainerBalancerTask to TestContainerBalancerDatanodeNodeLimit with new PRs?

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.

@Tejaskriya
Copy link
Contributor

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.
Thanks for addressing the comments, LGTM

@Montura
Copy link
Contributor Author

Montura commented Jul 31, 2024

@adoroszlai , could you merge please? Or I have to do something else?

Copy link
Contributor

@sarvekshayr sarvekshayr left a 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.

@adoroszlai adoroszlai merged commit a3f987f into apache:master Aug 1, 2024
28 of 29 checks passed
@adoroszlai
Copy link
Contributor

Thanks @Montura for the patch, @sarvekshayr, @Tejaskriya for the review.

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