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

Add additional test cases to scale down budget tests. #6055

Merged
merged 1 commit into from
Aug 29, 2023

Conversation

hbostan
Copy link
Contributor

@hbostan hbostan commented Aug 23, 2023

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Tests were missing cases where the empty and drain nodes are from the same atomic group.

Which issue(s) this PR fixes:

Special notes for your reviewer:

This is a follow-up pr addressing this comment: https://github.com/kubernetes/autoscaler/pull/6034/files#r1291199619

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 23, 2023
@k8s-ci-robot k8s-ci-robot requested review from feiskyer and x13n August 23, 2023 14:42
@k8s-ci-robot k8s-ci-robot added area/cluster-autoscaler size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 23, 2023
@hbostan
Copy link
Contributor Author

hbostan commented Aug 23, 2023

cc @aleksandra-malinowska

@@ -298,6 +362,62 @@ func TestCropNodesToBudgets(t *testing.T) {
wantEmpty: generateNodeGroupViewList(testNg, 0, 4),
wantDrain: generateNodeGroupViewList(testNg, 0, 2),
},
"empty&drain atomic nodes with deletions in progress, overall budget exceeded, both empty&drain nodes fit": {
Copy link
Contributor

Choose a reason for hiding this comment

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

both empty&drain nodes fit

nit: it looks like only empty nodes fit in this test case? Unless I'm misunderstanding something :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, fixed it :)

wantEmpty: generateNodeGroupViewList(atomic5, 0, 1),
wantDrain: generateNodeGroupViewList(atomic5, 1, 5),
},
"empty&drain regular and atomic nodes with deletions in progress, overall budget exceeded, only atomic is drained": {
Copy link
Contributor

Choose a reason for hiding this comment

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

only atomic is drained

nit: it seems that in this test case nothing is drained, only the entirely empty atomic group is removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed the test case name

@aleksandra-malinowska
Copy link
Contributor

Wow, that's a lot of test cases! Thank you very much, @hbostan!

Left some nits, in general I think the descriptions could be a bit more detailed to make it easier to understand what is the expected behavior. But I don't think that's blocking.

@MaciekPytel I hope this addresses your concerns about unit test coverage?

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 24, 2023
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 24, 2023
},
"empty&drain regular and multiple atomic nodes in same group exceeding drain limit, no deletions in progress": {
empty: append(append(generateNodeGroupViewList(testNg, 0, 5), generateNodeGroupViewList(atomic8, 0, 5)...), generateNodeGroupViewList(atomic11, 0, 8)...),
drain: append(generateNodeGroupViewList(atomic11, 8, 3), generateNodeGroupViewList(atomic8, 5, 8)...),
Copy link
Contributor

Choose a reason for hiding this comment

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

generateNodeGroupViewList(atomic11, 8, 3) - shouldn't from < to? Now this returns no nodes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch! It should be correct now.

wantDrain: generateNodeGroupViewList(atomic8, 5, 8),
},
"empty&drain multiple atomic nodes in same group exceeding overall limit, no deletions in progress": {
empty: append(append(generateNodeGroupViewList(atomic3, 0, 3), generateNodeGroupViewList(atomic4, 0, 2)...), generateNodeGroupViewList(atomic11, 0, 8)...),
Copy link
Contributor

Choose a reason for hiding this comment

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

atomic11 has 8 nodes, I think it should have 11.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Tests were missing cases where the empty and drain nodes are from the
same atomic group.
@BigDarkClown
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 29, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BigDarkClown, hbostan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 29, 2023
@k8s-ci-robot k8s-ci-robot merged commit c6d72f2 into kubernetes:master Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/cluster-autoscaler cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants