|
| 1 | +/* |
| 2 | +Copyright 2025 Feast Community. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +// Package e2erhoai provides end-to-end (E2E) test coverage for Feast integration with |
| 18 | +// Red Hat OpenShift AI (RHOAI) environments. This specific test validates the functionality |
| 19 | +// of executing a Feast Jupyter notebook with Ray offline store within a fully configured OpenShift namespace |
| 20 | +package e2erhoai |
| 21 | + |
| 22 | +import ( |
| 23 | + "fmt" |
| 24 | + "os/exec" |
| 25 | + |
| 26 | + utils "github.com/feast-dev/feast/infra/feast-operator/test/utils" |
| 27 | + . "github.com/onsi/ginkgo/v2" |
| 28 | + . "github.com/onsi/gomega" |
| 29 | +) |
| 30 | + |
| 31 | +var _ = Describe("Feast Jupyter Notebook Testing with Ray Offline Store", Ordered, func() { |
| 32 | + const ( |
| 33 | + namespace = "test-ns-feast-wb-ray" |
| 34 | + configMapName = "feast-wb-ray-cm" |
| 35 | + rolebindingName = "rb-feast-ray-test" |
| 36 | + notebookFile = "test/e2e_rhoai/resources/feast-wb-ray-test.ipynb" |
| 37 | + pvcFile = "test/e2e_rhoai/resources/pvc.yaml" |
| 38 | + kueueResourcesFile = "test/e2e_rhoai/resources/kueue_resources_setup.yaml" |
| 39 | + notebookPVC = "jupyterhub-nb-kube-3aadmin-pvc" |
| 40 | + testDir = "/test/e2e_rhoai" |
| 41 | + notebookName = "feast-wb-ray-test.ipynb" |
| 42 | + feastRayTest = "TestFeastRayOfflineStoreNotebook" |
| 43 | + ) |
| 44 | + |
| 45 | + BeforeAll(func() { |
| 46 | + By(fmt.Sprintf("Creating test namespace: %s", namespace)) |
| 47 | + Expect(utils.CreateNamespace(namespace, testDir)).To(Succeed()) |
| 48 | + fmt.Printf("Namespace %s created successfully\n", namespace) |
| 49 | + |
| 50 | + By("Applying Kueue resources setup") |
| 51 | + // Apply with namespace flag - cluster-scoped resources (ResourceFlavor, ClusterQueue) will be applied at cluster level, |
| 52 | + // and namespace-scoped resources (LocalQueue) will be applied in the specified namespace |
| 53 | + cmd := exec.Command("kubectl", "apply", "-f", kueueResourcesFile, "-n", namespace) |
| 54 | + output, err := utils.Run(cmd, testDir) |
| 55 | + Expect(err).ToNot(HaveOccurred(), fmt.Sprintf("Failed to apply Kueue resources: %v\nOutput: %s", err, output)) |
| 56 | + fmt.Printf("Kueue resources applied successfully\n") |
| 57 | + }) |
| 58 | + |
| 59 | + AfterAll(func() { |
| 60 | + By("Deleting Kueue resources") |
| 61 | + // Delete with namespace flag - will delete namespace-scoped resources from the namespace |
| 62 | + // and cluster-scoped resources from the cluster |
| 63 | + cmd := exec.Command("kubectl", "delete", "-f", kueueResourcesFile, "-n", namespace, "--ignore-not-found=true") |
| 64 | + _, _ = utils.Run(cmd, testDir) |
| 65 | + fmt.Printf("Kueue resources cleanup completed\n") |
| 66 | + |
| 67 | + By(fmt.Sprintf("Deleting test namespace: %s", namespace)) |
| 68 | + Expect(utils.DeleteNamespace(namespace, testDir)).To(Succeed()) |
| 69 | + fmt.Printf("Namespace %s deleted successfully\n", namespace) |
| 70 | + }) |
| 71 | + |
| 72 | + Context("Feast Jupyter Notebook Test with Ray Offline store", func() { |
| 73 | + It("Should create and run a "+feastRayTest+" successfully", func() { |
| 74 | + utils.RunNotebookTest(namespace, configMapName, notebookFile, "test/e2e_rhoai/resources/feature_repo", pvcFile, rolebindingName, notebookPVC, notebookName, testDir) |
| 75 | + }) |
| 76 | + }) |
| 77 | +}) |
0 commit comments