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
Unit test for CustomClusterController #373
Conversation
✅ Deploy Preview for kurator-dev canceled.
|
for the DCO failure: run |
Signed-off-by: LiZhenCheng9527 <lizhencheng6@huawei.com>
Signed-off-by: LiZhenCheng9527 <lizhencheng6@huawei.com>
run |
Signed-off-by: LiZhenCheng9527 <lizhencheng6@huawei.com> Signed-off-by: LiZhenCheng9527 <lizhencheng6@huawei.com>
} | ||
|
||
func generateCluster(clusterName string) *clusterv1.Cluster { | ||
cluster := &clusterv1.Cluster{ |
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.
cluster := &clusterv1.Cluster{ | |
return &clusterv1.Cluster{ |
}, | ||
}, | ||
{ | ||
name: "CustomManchine 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.
nit: s/CustomManchine/CustomMachine
args args | ||
}{ | ||
{ | ||
name: "Not CustomMachine Error", |
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.
nit: recommend all using small 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.
good work
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hzxuzhonghu 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 |
|
||
patches := gomonkey.ApplyPrivateMethod(reflect.TypeOf(r), "ensureWorkerPodDeleted", | ||
func(_ *CustomClusterController, ctx context.Context, customCluster *v1alpha1.CustomCluster, manageAction customClusterManageAction) error { | ||
err := errors.New("failede to delete Pod") |
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.
nit: s/failede/failed
Signed-off-by: LiZhenCheng9527 <lizhencheng6@huawei.com>
/label tide/merge-method-squash |
please set a new PR name that includes more information, such as "Unit test for CustomClusterController" |
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
What type of PR is this?
What this PR does / why we need it:
This PR do unit test for customcluster controller. Here is the Coverage
customcluster_controller.go:317: reconcileProvision 100.0%
customcluster_controller.go:380: reconcileDelete 95.2%
customcluster_controller.go:420: deleteWorkerPods 63.6%
customcluster_controller.go:445: deleteResource 60.0%
customcluster_controller.go:484: ensureFinalizerAndOwnerRef 77.8%
customcluster_controller.go:516: WorkerToCustomClusterMapFunc 85.7%
customcluster_controller.go:530: CustomMachineToCustomClusterMapFunc 100.0%
customcluster_controller.go:548: ClusterToCustomClusterMapFunc 85.7%
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: