@@ -132,7 +132,56 @@ var _ = Describe("RayCluster", Ordered, func() {
132
132
})
133
133
})
134
134
135
- // TODO: add tests for RayJobs
135
+ var _ = Describe ("RayJob" , Ordered , func () {
136
+ It ("Create RayJob" , func () {
137
+ _ , err := rayClient .RayJobs ("default" ).Create (context .Background (), & rayv1.RayJob {
138
+ ObjectMeta : metav1.ObjectMeta {Name : "proxy-test-job" },
139
+ Spec : rayv1.RayJobSpec {
140
+ Entrypoint : "echo hello" ,
141
+ RayClusterSpec : & rayv1.RayClusterSpec {
142
+ HeadGroupSpec : rayv1.HeadGroupSpec {
143
+ RayStartParams : make (map [string ]string ),
144
+ Template : corev1.PodTemplateSpec {
145
+ Spec : corev1.PodSpec {
146
+ Containers : []corev1.Container {
147
+ {
148
+ Name : "test" ,
149
+ Image : "test" ,
150
+ },
151
+ },
152
+ },
153
+ },
154
+ },
155
+ },
156
+ },
157
+ }, metav1.CreateOptions {})
158
+ Expect (err ).ToNot (HaveOccurred ())
159
+ Expect (lastReq .Load ().Method ).To (Equal (http .MethodPost ))
160
+ Expect (lastReq .Load ().RequestURI ).To (Equal ("/apis/ray.io/v1/namespaces/default/rayjobs" ))
161
+ })
162
+ It ("Get RayJob" , func () {
163
+ job , err := rayClient .RayJobs ("default" ).Get (context .Background (), "proxy-test-job" , metav1.GetOptions {})
164
+ Expect (err ).ToNot (HaveOccurred ())
165
+ Expect (job .Name ).To (Equal ("proxy-test-job" ))
166
+ Expect (lastReq .Load ().Method ).To (Equal (http .MethodGet ))
167
+ Expect (lastReq .Load ().RequestURI ).To (Equal ("/apis/ray.io/v1/namespaces/default/rayjobs/proxy-test-job" ))
168
+ })
169
+ It ("List RayJob" , func () {
170
+ jobs , err := rayClient .RayJobs ("default" ).List (context .Background (), metav1.ListOptions {})
171
+ Expect (err ).ToNot (HaveOccurred ())
172
+ Expect (jobs .Items ).To (HaveLen (1 ))
173
+ Expect (jobs .Items [0 ].Name ).To (Equal ("proxy-test-job" ))
174
+ Expect (lastReq .Load ().Method ).To (Equal (http .MethodGet ))
175
+ Expect (lastReq .Load ().RequestURI ).To (Equal ("/apis/ray.io/v1/namespaces/default/rayjobs" ))
176
+ })
177
+ It ("Delete RayJob" , func () {
178
+ err := rayClient .RayJobs ("default" ).Delete (context .Background (), "proxy-test-job" , metav1.DeleteOptions {})
179
+ Expect (err ).ToNot (HaveOccurred ())
180
+ Expect (lastReq .Load ().Method ).To (Equal (http .MethodDelete ))
181
+ Expect (lastReq .Load ().RequestURI ).To (Equal ("/apis/ray.io/v1/namespaces/default/rayjobs/proxy-test-job" ))
182
+ })
183
+ })
184
+
136
185
// TODO: add tests for RayServices
137
186
138
187
var _ = Describe ("events" , Ordered , func () {
0 commit comments