-
Notifications
You must be signed in to change notification settings - Fork 629
[Feat][RayCluster] Use a new RayClusterReplicaFailure condition to reflect the result of reconcilePods #2259
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
Changes from all commits
8482a25
41462a9
0b78fb2
07811b3
f08fa29
5000630
416d0bf
000cda4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ package utils | |
|
||
import ( | ||
"context" | ||
"errors" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
@@ -523,3 +524,12 @@ env_vars: | |
}) | ||
} | ||
} | ||
|
||
func TestErrRayClusterReplicaFailureReason(t *testing.T) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we test the case that the error is not a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. I will add a test that the RayClusterReplicaFailureReason() should return an empty string for a random error. |
||
assert.Equal(t, RayClusterReplicaFailureReason(ErrFailedDeleteAllPods), "FailedDeleteAllPods") | ||
assert.Equal(t, RayClusterReplicaFailureReason(ErrFailedDeleteHeadPod), "FailedDeleteHeadPod") | ||
assert.Equal(t, RayClusterReplicaFailureReason(ErrFailedCreateHeadPod), "FailedCreateHeadPod") | ||
assert.Equal(t, RayClusterReplicaFailureReason(ErrFailedDeleteWorkerPod), "FailedDeleteWorkerPod") | ||
assert.Equal(t, RayClusterReplicaFailureReason(ErrFailedCreateWorkerPod), "FailedCreateWorkerPod") | ||
assert.Equal(t, RayClusterReplicaFailureReason(errors.New("other 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.
err.(interface{ Unwrap() []error }).Unwrap()
is the only special trick to unwrap a joined error.https://cs.opensource.google/go/go/+/refs/tags/go1.22.5:src/errors/join.go;l=60-62