@@ -38,8 +38,8 @@ func TestMCADRay(t *testing.T) {
3838 config := CreateConfigMap (test , namespace .Name , map [string ][]byte {
3939 // MNIST Ray Notebook
4040 jupyterNotebookConfigMapFileName : ReadFile (test , "resources/mnist_ray_mini.ipynb" ),
41- "mnist.py" : ReadFile (test , "resources/mnist.py" ),
42- "requirements.txt" : ReadFile (test , "resources/requirements.txt" ),
41+ "mnist.py" : readMnistPy (test ),
42+ "requirements.txt" : readRequirementsTxt (test ),
4343 })
4444
4545 // Create RBAC, retrieve token for user with limited rights
@@ -59,6 +59,11 @@ func TestMCADRay(t *testing.T) {
5959 APIGroups : []string {"route.openshift.io" },
6060 Resources : []string {"routes" },
6161 },
62+ {
63+ Verbs : []string {"get" , "list" },
64+ APIGroups : []string {"networking.k8s.io" },
65+ Resources : []string {"ingresses" },
66+ },
6267 }
6368
6469 // Create cluster wide RBAC, required for SDK OpenShift check
@@ -96,3 +101,36 @@ func TestMCADRay(t *testing.T) {
96101 test .Eventually (AppWrappers (test , namespace ), TestTimeoutLong ).
97102 Should (HaveLen (0 ))
98103}
104+
105+ func readRequirementsTxt (test Test ) []byte {
106+ // Read the requirements.txt from resources and perform replacements for custom values using go template
107+ props := struct {
108+ PipIndexUrl string
109+ PipTrustedHost string
110+ }{
111+ PipIndexUrl : "--index " + GetPipIndexURL (),
112+ }
113+
114+ // Provide trusted host only if defined
115+ if len (GetPipTrustedHost ()) > 0 {
116+ props .PipTrustedHost = "--trusted-host " + GetPipTrustedHost ()
117+ }
118+
119+ template , err := files .ReadFile ("resources/requirements.txt" )
120+ test .Expect (err ).NotTo (HaveOccurred ())
121+
122+ return ParseTemplate (test , template , props )
123+ }
124+
125+ func readMnistPy (test Test ) []byte {
126+ // Read the mnist.py from resources and perform replacements for custom values using go template
127+ props := struct {
128+ MnistDatasetURL string
129+ }{
130+ MnistDatasetURL : GetMnistDatasetURL (),
131+ }
132+ template , err := files .ReadFile ("resources/mnist.py" )
133+ test .Expect (err ).NotTo (HaveOccurred ())
134+
135+ return ParseTemplate (test , template , props )
136+ }
0 commit comments