@@ -40,9 +40,6 @@ func TestMNISTRayClusterSDK(t *testing.T) {
4040 test := With (t )
4141 test .T ().Parallel ()
4242
43- // Currently blocked by https://github.com/project-codeflare/codeflare-sdk/pull/251 , remove the skip once SDK with the PR is released
44- test .T ().Skip ("Requires https://github.com/project-codeflare/codeflare-sdk/pull/251" )
45-
4643 // Create a namespace
4744 namespace := test .NewTestNamespace ()
4845
@@ -109,6 +106,11 @@ func TestMNISTRayClusterSDK(t *testing.T) {
109106 APIGroups : []string {"route.openshift.io" },
110107 Resources : []string {"routes" },
111108 },
109+ {
110+ Verbs : []string {"get" , "list" },
111+ APIGroups : []string {"networking.k8s.io" },
112+ Resources : []string {"ingresses" },
113+ },
112114 },
113115 }
114116 role , err = test .Client ().Core ().RbacV1 ().Roles (namespace .Name ).Create (test .Ctx (), role , metav1.CreateOptions {})
@@ -163,7 +165,7 @@ func TestMNISTRayClusterSDK(t *testing.T) {
163165 Env : []corev1.EnvVar {
164166 corev1.EnvVar {Name : "PYTHONUSERBASE" , Value : "/workdir" },
165167 },
166- Command : []string {"/bin/sh" , "-c" , "pip install codeflare-sdk==" + GetCodeFlareSDKVersion () + " && cp /test/* . && python mnist_raycluster_sdk.py" + " " + namespace .Name },
168+ Command : []string {"/bin/sh" , "-c" , "pip install codeflare-sdk==0.11.0 && cp /test/* . && python mnist_raycluster_sdk.py" + " " + namespace .Name },
167169 VolumeMounts : []corev1.VolumeMount {
168170 {
169171 Name : "test" ,
@@ -211,6 +213,24 @@ func TestMNISTRayClusterSDK(t *testing.T) {
211213 },
212214 },
213215 }
216+ if GetClusterType (test ) == KindCluster {
217+ // Take first KinD node and redirect pod hostname requests there
218+ node := GetNodes (test )[0 ]
219+ hostname := GetClusterHostname (test )
220+ IP := GetNodeInternalIP (test , node )
221+
222+ test .T ().Logf ("Setting KinD cluster hostname '%s' to node IP '%s' for SDK pod" , hostname , IP )
223+ job .Spec .Template .Spec .HostAliases = []corev1.HostAlias {
224+ {
225+ IP : IP ,
226+ Hostnames : []string {hostname },
227+ },
228+ }
229+
230+ hostnameEnvVar := corev1.EnvVar {Name : "CLUSTER_HOSTNAME" , Value : hostname }
231+ job .Spec .Template .Spec .Containers [0 ].Env = append (job .Spec .Template .Spec .Containers [0 ].Env , hostnameEnvVar )
232+ }
233+
214234 job , err = test .Client ().Core ().BatchV1 ().Jobs (namespace .Name ).Create (test .Ctx (), job , metav1.CreateOptions {})
215235 test .Expect (err ).NotTo (HaveOccurred ())
216236 test .T ().Logf ("Created Job %s/%s successfully" , job .Namespace , job .Name )
0 commit comments