-
Notifications
You must be signed in to change notification settings - Fork 867
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 default interpreter for interpretHealth #2370
Conversation
return false, err | ||
} | ||
|
||
if replicaSet.Generation == replicaSet.Status.ObservedGeneration { |
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.
We can use guard code here, just like:
if replicaSet.Generation != replicaSet.Status.ObservedGeneration {
return false, nil
}
Same as bellow.
healthy := pvc.Status.Phase == corev1.ClaimBound | ||
return healthy, nil |
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.
How about this:
return pvc.Status.Phase == corev1.ClaimBound, nil
@@ -211,3 +212,314 @@ func Test_interpretStatefulSetHealth(t *testing.T) { | |||
}) | |||
} | |||
} | |||
|
|||
func Test_interpretReplicaSetHealth(t *testing.T) { |
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.
The case for determining the replicas is missing.
{ | ||
name: "failed convert to ReplicaSet object", | ||
object: &unstructured.Unstructured{ | ||
Object: map[string]interface{}{ | ||
"spec": "format error", | ||
"status": "format error", | ||
}, | ||
}, | ||
want: false, | ||
wantErr: true, | ||
}, |
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.
I see similar judgments in each test case. Is it possible to consider testing method ConvertToTypedObject
so that similar test cases can be omitted?
If this is feasible, you can submit a separate pr to test method ConvertToTypedObject
.
/assign |
Signed-off-by: zhuwint <zhuwentao15@huawei.com>
f5b38e7
to
989fb49
Compare
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~
/lgtm
/approve
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: RainbowMango, XiShanYongYe-Chang 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 |
/kind feature
What this PR does / why we need it:
add default resource interpreter for interpretHealth
Which issue(s) this PR fixes:
Part of #2354
Special notes for your reviewer:
The method for health check is referred to https://github.com/jessesuen/argo-cd/blob/37a58fb9f1a2d7e20fe8e37a93ffa2e66b0eb9c7/util/health/health.go
Does this PR introduce a user-facing change?:
NONE