diff --git a/test/e2e/install-codeflare-sdk.sh b/test/e2e/install-codeflare-sdk.sh new file mode 100755 index 000000000..e90f4071c --- /dev/null +++ b/test/e2e/install-codeflare-sdk.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# go to codeflare-sdk folder and install codeflare-sdk +cd .. + +# Install Poetry and configure virtualenvs +pip install poetry +poetry config virtualenvs.create false + +cd codeflare-sdk +# Clone the CodeFlare SDK repository +git clone --branch main https://github.com/project-codeflare/codeflare-sdk.git + +cd codeflare-sdk + +# Lock dependencies and install them +poetry lock --no-update +poetry install --with test,docs + +# Return to the workdir +cd ../.. +cd workdir diff --git a/test/e2e/mnist_raycluster_sdk_test.go b/test/e2e/mnist_raycluster_sdk_test.go index 015cbfc58..be6933f67 100644 --- a/test/e2e/mnist_raycluster_sdk_test.go +++ b/test/e2e/mnist_raycluster_sdk_test.go @@ -51,6 +51,8 @@ func TestMNISTRayClusterSDK(t *testing.T) { "requirements.txt": ReadFile(test, "mnist_pip_requirements.txt"), // MNIST training script "mnist.py": ReadFile(test, "mnist.py"), + // codeflare-sdk installation script + "install-codeflare-sdk.sh": ReadFile(test, "install-codeflare-sdk.sh"), }) // Create RBAC, retrieve token for user with limited rights @@ -119,12 +121,16 @@ func TestMNISTRayClusterSDK(t *testing.T) { {Name: "PYTHONUSERBASE", Value: "/workdir"}, {Name: "RAY_IMAGE", Value: GetRayImage()}, }, - Command: []string{"/bin/sh", "-c", "pip install codeflare-sdk==" + GetCodeFlareSDKVersion() + " && cp /test/* . && python mnist_raycluster_sdk.py" + " " + namespace.Name}, + Command: []string{"/bin/sh", "-c", "cp /test/* . && chmod +x install-codeflare-sdk.sh && ./install-codeflare-sdk.sh && python mnist_raycluster_sdk.py" + " " + namespace.Name}, VolumeMounts: []corev1.VolumeMount{ { Name: "test", MountPath: "/test", }, + { + Name: "codeflare-sdk", + MountPath: "/codeflare-sdk", + }, { Name: "workdir", MountPath: "/workdir", @@ -154,6 +160,12 @@ func TestMNISTRayClusterSDK(t *testing.T) { }, }, }, + { + Name: "codeflare-sdk", + VolumeSource: corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{}, + }, + }, { Name: "workdir", VolumeSource: corev1.VolumeSource{ diff --git a/test/e2e/support.go b/test/e2e/support.go index e91656880..8fc862957 100644 --- a/test/e2e/support.go +++ b/test/e2e/support.go @@ -23,7 +23,7 @@ import ( "github.com/project-codeflare/codeflare-common/support" ) -//go:embed *.py *.txt +//go:embed *.py *.txt *.sh var files embed.FS func ReadFile(t support.Test, fileName string) []byte {