-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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 tests kubelet default config #105116
Add tests kubelet default config #105116
Conversation
Welcome @shuheiktgw! |
Hi @shuheiktgw. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
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.
/ok-to-test
@@ -0,0 +1,216 @@ | |||
/* | |||
Copyright 2015 The Kubernetes Authors. |
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.
2021
MemoryThrottlingFactor: utilpointer.Float64Ptr(DefaultMemoryThrottlingFactor), | ||
}, | ||
}, | ||
} |
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.
To cover more code, I suggest we should have at least 3 cases:
- empty is neccessage
- all zero(0,"",0s,false) is a negative case
- all settings(1,"xxx",60s,true) is positive case.
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.
@pacoxu I added some more tests so would you review the PR again? 🙏
/priority backlog |
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.
/lgtm
the code coverage for default.go is now 99.3%
👍
/label tide/merge-method-squash |
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.
/label api-review
/cc @liggitt
/lgtm
}, | ||
}, | ||
{ | ||
"NodeStatusUpdateFrequency is not zero", |
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.
What's the rationale behind this case?
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.
Thank you for your review @ehashman! When NodeStatusReportFrequency is zero and NodeStatusUpdateFrequency is not zero, NodeStatusReportFrequency is equal to NodeStatusUpdateFrequency so I'd like to cover the case.
kubernetes/pkg/kubelet/apis/config/v1beta1/defaults.go
Lines 120 to 127 in f560a76
// For backward compatibility, NodeStatusReportFrequency's default value is | |
// set to NodeStatusUpdateFrequency if NodeStatusUpdateFrequency is set | |
// explicitly. | |
if obj.NodeStatusUpdateFrequency == zeroDuration { | |
obj.NodeStatusReportFrequency = metav1.Duration{Duration: 5 * time.Minute} | |
} else { | |
obj.NodeStatusReportFrequency = obj.NodeStatusUpdateFrequency | |
} |
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 test will end up needing to be updated for unrelated changes. Things get added rarely enough that this isn't a big deal, but this could have been a bit narrower to prevent knockon effects later. (non-blocking)
@@ -178,9 +178,9 @@ func SetDefaults_KubeletConfiguration(obj *kubeletconfigv1beta1.KubeletConfigura | |||
} | |||
// default nil or negative value to -1 (implies node allocatable pid limit) | |||
if obj.PodPidsLimit == nil || *obj.PodPidsLimit < int64(0) { | |||
temp := int64(-1) | |||
obj.PodPidsLimit = &temp | |||
obj.PodPidsLimit = utilpointer.Int64(-1) |
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 test and the review /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: liggitt, pacoxu, shuheiktgw 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 |
/test pull-kubernetes-node-e2e-containerd |
The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass. This bot retests PRs for certain kubernetes repos according to the following rules:
You can:
/retest |
1 similar comment
The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass. This bot retests PRs for certain kubernetes repos according to the following rules:
You can:
/retest |
What type of PR is this?
/sig node
/kind cleanup
/area test
What this PR does / why we need it:
I've added tests for pkg/kubelet/apis/config/v1beta1/defaults.go. Thank you for your review!
Which issue(s) this PR fixes:
Relates to #105029
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: