Skip to content

Commit 6913c33

Browse files
committed
test cleanup: use RayClusters helper from codeflare-common
1 parent 0e8eaae commit 6913c33

File tree

3 files changed

+6
-24
lines changed

3 files changed

+6
-24
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/openshift/api v0.0.0-20230823114715-5fdd7511b790
1111
github.com/openshift/client-go v0.0.0-20221019143426-16aed247da5c
1212
github.com/project-codeflare/appwrapper v0.8.1
13-
github.com/project-codeflare/codeflare-common v0.0.0-20240419154738-88e961b89d29
13+
github.com/project-codeflare/codeflare-common v0.0.0-20240422163521-380101642c8f
1414
github.com/ray-project/kuberay/ray-operator v1.1.0
1515
go.uber.org/zap v1.26.0
1616
golang.org/x/exp v0.0.0-20230905200255-921286631fa9

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
240240
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
241241
github.com/project-codeflare/appwrapper v0.8.1 h1:o3nbd5L7Zn7sorXQ3rOR2EW9ESq4XoAQlp+kDLPQ0Hc=
242242
github.com/project-codeflare/appwrapper v0.8.1/go.mod h1:FMQ2lI3fz6LakUVXgN1FTdpsc3BBkNIZZgtMmM9J5UM=
243-
github.com/project-codeflare/codeflare-common v0.0.0-20240419154738-88e961b89d29 h1:Hb98JXMOA15+kefHxH1V0EnvRqi7j7PL3vF9xzL7+4M=
244-
github.com/project-codeflare/codeflare-common v0.0.0-20240419154738-88e961b89d29/go.mod h1:LoZMDO3zgkl0OoPz0bDVI4WFC3wQ8xE23J2ncsvjy+g=
243+
github.com/project-codeflare/codeflare-common v0.0.0-20240422163521-380101642c8f h1:9Uron4ej4Tt5ULX5CMzjmPqIZu3q/m07d4jhbNSwdPY=
244+
github.com/project-codeflare/codeflare-common v0.0.0-20240422163521-380101642c8f/go.mod h1:tlPi2e1HZQuf7AAFc7keWdVUNcxV+Gfh6Ss4KAQs1O0=
245245
github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk=
246246
github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA=
247247
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=

test/odh/ray_test.go

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,13 @@ import (
2020
"testing"
2121

2222
. "github.com/onsi/gomega"
23-
gomega "github.com/onsi/gomega"
2423
. "github.com/project-codeflare/codeflare-common/support"
2524
rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1"
2625

27-
corev1 "k8s.io/api/core/v1"
2826
rbacv1 "k8s.io/api/rbac/v1"
29-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3027
)
3128

32-
func TestMCADRay(t *testing.T) {
29+
func TestRay(t *testing.T) {
3330
test := With(t)
3431

3532
// Create a namespace
@@ -85,7 +82,7 @@ func TestMCADRay(t *testing.T) {
8582
createNotebook(test, namespace, token, config.Name, jupyterNotebookConfigMapFileName)
8683

8784
// Make sure the RayCluster is created and running
88-
test.Eventually(rayClusters(test, namespace), TestTimeoutLong).
85+
test.Eventually(RayClusters(test, namespace.Name), TestTimeoutLong).
8986
Should(
9087
And(
9188
HaveLen(1),
@@ -94,7 +91,7 @@ func TestMCADRay(t *testing.T) {
9491
)
9592

9693
// Make sure the RayCluster finishes and is deleted
97-
test.Eventually(rayClusters(test, namespace), TestTimeoutLong).
94+
test.Eventually(RayClusters(test, namespace.Name), TestTimeoutLong).
9895
Should(HaveLen(0))
9996
}
10097

@@ -130,18 +127,3 @@ func readMnistPy(test Test) []byte {
130127

131128
return ParseTemplate(test, template, props)
132129
}
133-
134-
// TODO: This belongs on codeflare-common/support/ray.go
135-
func rayClusters(t Test, namespace *corev1.Namespace) func(g gomega.Gomega) []*rayv1.RayCluster {
136-
return func(g gomega.Gomega) []*rayv1.RayCluster {
137-
rcs, err := t.Client().Ray().RayV1().RayClusters(namespace.Name).List(t.Ctx(), metav1.ListOptions{})
138-
g.Expect(err).NotTo(gomega.HaveOccurred())
139-
140-
rcsp := []*rayv1.RayCluster{}
141-
for _, v := range rcs.Items {
142-
rcsp = append(rcsp, &v)
143-
}
144-
145-
return rcsp
146-
}
147-
}

0 commit comments

Comments
 (0)