Skip to content

Commit 82a0ab3

Browse files
committed
Adjust existing e2e tests to provide custom Pypi index URL
1 parent d85339b commit 82a0ab3

7 files changed

+30
-3
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,21 @@ The e2e tests can be executed locally by running the following commands:
8686
8787
Alternatively, You can run the e2e test(s) from your IDE / debugger.
8888
89+
#### Testing on disconnected cluster
90+
91+
To properly run e2e tests on disconnected cluster user has to provide additional environment variables to properly configure testing environment:
92+
93+
- `CODEFLARE_TEST_PYTORCH_IMAGE` - image tag for image used to run training job using MCAD
94+
- `CODEFLARE_TEST_RAY_IMAGE` - image tag for Ray cluster image
95+
- `MNIST_DATASET_URL` - URL where MNIST dataset is available
96+
- `PIP_INDEX_URL` - URL where PyPI server with needed dependencies is running
97+
- `PIP_TRUSTED_HOST` - PyPI server hostname
98+
99+
For ODH tests additional environment variables are needed:
100+
101+
- `NOTEBOOK_IMAGE_STREAM_NAME` - name of the ODH Notebook ImageStream to be used
102+
- `ODH_NAMESPACE` - namespace where ODH is installed
103+
89104
## Release
90105
91106
1. Invoke [project-codeflare-release.yaml](https://github.com/project-codeflare/codeflare-operator/actions/workflows/project-codeflare-release.yml)

test/e2e/mnist_pytorch_mcad_job_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ func TestMNISTPyTorchMCAD(t *testing.T) {
8181
Env: []corev1.EnvVar{
8282
{Name: "PYTHONUSERBASE", Value: "/workdir"},
8383
{Name: "MNIST_DATASET_URL", Value: GetMnistDatasetURL()},
84+
{Name: "PIP_INDEX_URL", Value: GetPipIndexURL()},
85+
{Name: "PIP_TRUSTED_HOST", Value: GetPipTrustedHost()},
8486
},
8587
Command: []string{"/bin/sh", "-c", "pip install -r /test/requirements.txt && torchrun /test/mnist.py"},
8688
VolumeMounts: []corev1.VolumeMount{

test/e2e/mnist_rayjob_mcad_raycluster_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ func TestMNISTRayJobMCADRayCluster(t *testing.T) {
229229
- torchvision==0.12.0
230230
env_vars:
231231
MNIST_DATASET_URL: "` + GetMnistDatasetURL() + `"
232+
PIP_INDEX_URL: "` + GetPipIndexURL() + `"
233+
PIP_TRUSTED_HOST: "` + GetPipTrustedHost() + `"
232234
`,
233235
ClusterSelector: map[string]string{
234236
RayJobDefaultClusterSelectorKey: rayCluster.Name,

test/odh/mcad_ray_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

test/odh/notebook.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type NotebookProps struct {
4444
OpenDataHubNamespace string
4545
ImageStreamName string
4646
ImageStreamTag string
47+
RayImage string
4748
NotebookConfigMapName string
4849
NotebookConfigMapFileName string
4950
NotebookPVC string
@@ -66,6 +67,7 @@ func createNotebook(test Test, namespace *corev1.Namespace, notebookToken, jupyt
6667
OpenDataHubNamespace: GetOpenDataHubNamespace(),
6768
ImageStreamName: GetNotebookImageStreamName(test),
6869
ImageStreamTag: recommendedTagName,
70+
RayImage: GetRayImage(),
6971
NotebookConfigMapName: jupyterNotebookConfigMapName,
7072
NotebookConfigMapFileName: jupyterNotebookConfigMapFileName,
7173
NotebookPVC: notebookPVC.Name,

test/odh/resources/custom-nb-small.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ spec:
5555
- name: OCP_TOKEN
5656
value: {{.KubernetesBearerToken}}
5757
image: image-registry.openshift-image-registry.svc:5000/{{.OpenDataHubNamespace}}/{{.ImageStreamName}}:{{.ImageStreamTag}}
58-
command: ["/bin/sh", "-c", "pip install papermill && oc login --token=${OCP_TOKEN} --server=${OCP_SERVER} --insecure-skip-tls-verify=true && papermill /opt/app-root/notebooks/{{.NotebookConfigMapFileName}} /opt/app-root/src/mcad-out.ipynb -p namespace {{.Namespace}} && sleep infinity"]
58+
command: ["/bin/sh", "-c", "pip install papermill && oc login --token=${OCP_TOKEN} --server=${OCP_SERVER} --insecure-skip-tls-verify=true && papermill /opt/app-root/notebooks/{{.NotebookConfigMapFileName}} /opt/app-root/src/mcad-out.ipynb -p namespace {{.Namespace}} -p ray_image {{.RayImage}} && sleep infinity"]
5959
# args: ["pip install papermill && oc login --token=${OCP_TOKEN} --server=${OCP_SERVER} --insecure-skip-tls-verify=true && papermill /opt/app-root/notebooks/mcad.ipynb /opt/app-root/src/mcad-out.ipynb" ]
6060
imagePullPolicy: Always
6161
# livenessProbe:

test/odh/resources/mnist_ray_mini.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"outputs": [],
2828
"source": [
2929
"#parameters\n",
30-
"namespace = \"default\""
30+
"namespace = \"default\"\n",
31+
"ray_image = \"has to be specified\""
3132
]
3233
},
3334
{
@@ -40,7 +41,7 @@
4041
"outputs": [],
4142
"source": [
4243
"# Create our cluster and submit appwrapper\n",
43-
"cluster = Cluster(ClusterConfiguration(namespace=namespace, name='mnisttest', head_cpus=1, head_memory=2, num_workers=1, min_cpus=1, max_cpus=1, min_memory=1, max_memory=2, num_gpus=0, instascale=False))"
44+
"cluster = Cluster(ClusterConfiguration(namespace=namespace, name='mnisttest', head_cpus=1, head_memory=2, num_workers=1, min_cpus=1, max_cpus=1, min_memory=1, max_memory=2, num_gpus=0, instascale=False, image=ray_image))"
4445
]
4546
},
4647
{

0 commit comments

Comments
 (0)