@@ -38,8 +38,8 @@ func TestMCADRay(t *testing.T) {
38
38
config := CreateConfigMap (test , namespace .Name , map [string ][]byte {
39
39
// MNIST Ray Notebook
40
40
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 ),
43
43
})
44
44
45
45
// Create RBAC, retrieve token for user with limited rights
@@ -59,6 +59,11 @@ func TestMCADRay(t *testing.T) {
59
59
APIGroups : []string {"route.openshift.io" },
60
60
Resources : []string {"routes" },
61
61
},
62
+ {
63
+ Verbs : []string {"get" , "list" },
64
+ APIGroups : []string {"networking.k8s.io" },
65
+ Resources : []string {"ingresses" },
66
+ },
62
67
}
63
68
64
69
// Create cluster wide RBAC, required for SDK OpenShift check
@@ -96,3 +101,36 @@ func TestMCADRay(t *testing.T) {
96
101
test .Eventually (AppWrappers (test , namespace ), TestTimeoutLong ).
97
102
Should (HaveLen (0 ))
98
103
}
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