Skip to content

HDDS-10917. Refactoring more tests from TestContainerBalancerTask - #6734

Merged
adoroszlai merged 1 commit into
apache:masterfrom
unisonteam:test_refatoring
Aug 1, 2024
Merged

HDDS-10917. Refactoring more tests from TestContainerBalancerTask#6734
adoroszlai merged 1 commit into
apache:masterfrom
unisonteam:test_refatoring

Conversation

@Montura

@MonturaMontura commented May 28, 2024

Copy link
Copy Markdown
Contributor

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

…TestContainerBalancerDatanodeNodeLimit using MockedSCM
@MonturaMontura changed the title HDDS-10917: Refactoring more tests from TestContainerBalancerTaskHDDS-10917. Refactoring more tests from TestContainerBalancerTaskMay 30, 2024
@Montura

Copy link
Copy Markdown
ContributorAuthor

@siddhantsangwan, take a look please

@Montura

Copy link
Copy Markdown
ContributorAuthor

@siddhantsangwan , take a look please

@adoroszlai

Copy link
Copy Markdown
Contributor

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

@TejaskriyaTejaskriya left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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 @siddhantsangwantold 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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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

@sarvekshayrsarvekshayr left a comment

Copy link
Copy Markdown
Contributor

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:masterAug 1, 2024
@adoroszlai

Copy link
Copy Markdown
Contributor

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

Sign up for freeto 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

@Montura@adoroszlai@Tejaskriya@sarvekshayr