@@ -19,8 +19,6 @@ package odh
1919import (
2020 "bytes"
2121 "fmt"
22- "log"
23- "os/exec"
2422 "testing"
2523 "time"
2624
@@ -35,22 +33,22 @@ import (
3533)
3634
3735func TestMnistRayCpu (t * testing.T ) {
38- mnistDefaultRayImage (t , 0 )
36+ mnistRay (t , 0 )
3937}
4038
4139func TestMnistRayGpu (t * testing.T ) {
42- mnistDefaultRayImage (t , 1 )
40+ mnistRay (t , 1 )
4341}
4442
4543func TestMnistCustomRayImageCpu (t * testing.T ) {
46- mnistCustomRayImage (t , 0 )
44+ mnistRay (t , 0 )
4745}
4846
4947func TestMnistCustomRayImageGpu (t * testing.T ) {
50- mnistCustomRayImage (t , 1 )
48+ mnistRay (t , 1 )
5149}
5250
53- func mnistDefaultRayImage (t * testing.T , numGpus int ) {
51+ func mnistRay (t * testing.T , numGpus int ) {
5452 test := With (t )
5553
5654 // Create a namespace
@@ -59,26 +57,6 @@ func mnistDefaultRayImage(t *testing.T, numGpus int) {
5957 // Get ray image
6058 rayImage := GetRayImage ()
6159
62- mnistRay (test , numGpus , namespace , rayImage )
63- }
64-
65- func mnistCustomRayImage (t * testing.T , numGpus int ) {
66- test := With (t )
67-
68- // Create a namespace
69- namespace := test .NewTestNamespace ()
70-
71- // Build and Push custom ray image
72- image := "ray-torch-cuda"
73- buildAndPushRayImage (test , namespace .Name , image )
74-
75- // Get custom ray image
76- rayImage := getCustomRayImage (test , namespace .Name , image )
77-
78- mnistRay (test , numGpus , namespace , rayImage )
79- }
80-
81- func mnistRay (test Test , numGpus int , namespace * corev1.Namespace , rayImage string ) {
8260 // Create Kueue resources
8361 resourceFlavor := CreateKueueResourceFlavor (test , v1beta1.ResourceFlavorSpec {})
8462 defer test .Client ().Kueue ().KueueV1beta1 ().ResourceFlavors ().Delete (test .Ctx (), resourceFlavor .Name , metav1.DeleteOptions {})
@@ -248,25 +226,3 @@ func readMnistScriptTemplate(test Test, filePath string) []byte {
248226
249227 return ParseTemplate (test , template , props )
250228}
251-
252- func buildAndPushRayImage (test Test , namespace string , image string ) {
253- cmd := exec .Command ("resources/custom_image.sh" , namespace , image , "-c" , "echo stdout; echo 1>&2 stderr" )
254-
255- stdoutStderr , err := cmd .CombinedOutput ()
256- if err != nil {
257- log .Fatal ("Error executing custom_image script :" , err )
258- }
259- test .Expect (err ).NotTo (HaveOccurred ())
260-
261- fmt .Printf ("Logs of build and custom ray image . . .\n %s" , stdoutStderr )
262- }
263-
264- func getCustomRayImage (test Test , namespace string , image string ) string {
265- tag := "latest"
266- name := image + ":" + tag
267-
268- imageStreamTag := GetImageStreamTag (test , namespace , name )
269- imageReference := imageStreamTag .Image .DockerImageReference
270-
271- return imageReference
272- }
0 commit comments