mirror of
https://github.com/hanzo-ml/kuberay.git
synced 2026-10-30 19:48:47 +00:00
This PR adds e2e test following up #1539 and leverages #1575. It also factorises configuration across the RayJob e2e tests.
30 lines
817 B
Go
30 lines
817 B
Go
package support
|
|
|
|
import (
|
|
"github.com/onsi/gomega"
|
|
|
|
batchv1 "k8s.io/api/batch/v1"
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
)
|
|
|
|
func Jobs(t Test, namespace string) func(g gomega.Gomega) []batchv1.Job {
|
|
return func(g gomega.Gomega) []batchv1.Job {
|
|
jobs, err := t.Client().Core().BatchV1().Jobs(namespace).List(t.Ctx(), metav1.ListOptions{})
|
|
g.Expect(err).NotTo(gomega.HaveOccurred())
|
|
return jobs.Items
|
|
}
|
|
}
|
|
|
|
func Job(t Test, namespace, name string) func(g gomega.Gomega) *batchv1.Job {
|
|
return func(g gomega.Gomega) *batchv1.Job {
|
|
job, err := t.Client().Core().BatchV1().Jobs(namespace).Get(t.Ctx(), name, metav1.GetOptions{})
|
|
g.Expect(err).NotTo(gomega.HaveOccurred())
|
|
return job
|
|
}
|
|
}
|
|
|
|
func GetJob(t Test, namespace, name string) *batchv1.Job {
|
|
t.T().Helper()
|
|
return Job(t, namespace, name)(t)
|
|
}
|