From 6f9a311ee3788fb59c73711c38c7b6a6c96bfe90 Mon Sep 17 00:00:00 2001 From: David Kornel Date: Mon, 6 May 2024 11:24:02 +0200 Subject: [PATCH] Delete kubernetes utils Signed-off-by: David Kornel --- src/main/java/io/odh/test/Environment.java | 5 - src/main/java/io/odh/test/TestUtils.java | 78 +++++++++++++++ .../listeners/OdhResourceCleaner.java | 4 +- .../resources/DataScienceClusterResource.java | 10 +- .../resources/InferenceServiceResource.java | 6 +- .../io/odh/test/install/BundleInstall.java | 5 +- .../java/io/odh/test/install/OlmInstall.java | 4 +- .../io/odh/test/platform/KubernetesUtils.java | 96 ------------------- .../e2e/continuous/DataScienceClusterST.java | 16 ++-- .../e2e/continuous/DataScienceProjectST.java | 6 +- .../odh/test/e2e/standard/DistributedST.java | 5 +- .../test/e2e/standard/PipelineServerST.java | 4 +- .../test/e2e/standard/PipelineV2ServerST.java | 4 +- .../io/odh/test/e2e/upgrade/OlmUpgradeST.java | 6 +- 14 files changed, 112 insertions(+), 137 deletions(-) delete mode 100644 src/main/java/io/odh/test/platform/KubernetesUtils.java diff --git a/src/main/java/io/odh/test/Environment.java b/src/main/java/io/odh/test/Environment.java index 1719a65f..6dc39fae 100644 --- a/src/main/java/io/odh/test/Environment.java +++ b/src/main/java/io/odh/test/Environment.java @@ -38,8 +38,6 @@ public class Environment { public static final String USER_PATH = System.getProperty("user.dir"); private static final String CONFIG_FILE_PATH_ENV = "ENV_FILE"; - private static final String TOKEN_ENV = "KUBE_TOKEN"; - private static final String URL_ENV = "KUBE_URL"; private static final String PRODUCT_ENV = "PRODUCT"; private static final String LOG_DIR_ENV = "LOG_DIR"; @@ -74,9 +72,6 @@ public class Environment { * Set values */ public static final String PRODUCT = getOrDefault(PRODUCT_ENV, PRODUCT_ODH); - public static final String RUN_USER = getOrDefault("USER", null); - public static final String KUBE_TOKEN = getOrDefault(TOKEN_ENV, null); - public static final String KUBE_URL = getOrDefault(URL_ENV, null); //Install public static final boolean SKIP_INSTALL_OPERATOR_DEPS = getOrDefault(SKIP_INSTALL_OPERATOR_DEPS_ENV, Boolean::valueOf, false); diff --git a/src/main/java/io/odh/test/TestUtils.java b/src/main/java/io/odh/test/TestUtils.java index 8a27e5cc..83ca92b0 100644 --- a/src/main/java/io/odh/test/TestUtils.java +++ b/src/main/java/io/odh/test/TestUtils.java @@ -7,6 +7,14 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.exc.InvalidFormatException; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; +import io.fabric8.kubernetes.api.model.EndpointSubset; +import io.fabric8.kubernetes.api.model.Endpoints; +import io.fabric8.kubernetes.client.KubernetesClientException; +import io.fabric8.kubernetes.client.dsl.Resource; +import io.fabric8.openshift.api.model.operatorhub.v1alpha1.InstallPlan; +import io.opendatahub.datasciencecluster.v1.datascienceclusterstatus.Conditions; +import io.skodjob.testframe.resources.KubeResourceManager; +import io.skodjob.testframe.utils.KubeUtils; import io.skodjob.testframe.wait.Wait; import org.junit.jupiter.api.TestInfo; import org.junit.jupiter.api.extension.ExtensionContext; @@ -22,6 +30,8 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.time.Duration; +import java.util.List; +import java.util.NoSuchElementException; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -157,4 +167,72 @@ public static T runUntilPass(int retry, Callable fn) { } throw new IllegalStateException(String.format("Command wasn't pass in %s attempts", retry)); } + + public static io.opendatahub.datasciencecluster.v1.datascienceclusterstatus.Conditions getDscConditionByType(List conditions, String type) { + return conditions.stream().filter(c -> c.getType().equals(type)).findFirst().orElseGet(null); + } + + public static org.kubeflow.v1.notebookstatus.Conditions getNotebookConditionByType(List conditions, String type) { + return conditions.stream().filter(c -> c.getType().equals(type)).findFirst().orElseGet(null); + } + + public static io.kserve.serving.v1beta1.inferenceservicestatus.Conditions getInferenceServiceConditionByType(List conditions, String type) { + return conditions.stream().filter(c -> c.getType().equals(type)).findFirst().orElseGet(null); + } + + public static void clearOdhRemainingResources() { + KubeResourceManager.getKubeClient().getClient().apiextensions().v1().customResourceDefinitions().list().getItems() + .stream().filter(crd -> crd.getMetadata().getName().contains("opendatahub.io")).toList() + .forEach(crd -> { + LOGGER.info("Deleting CRD {}", crd.getMetadata().getName()); + KubeResourceManager.getKubeClient().getClient().resource(crd).delete(); + }); + KubeResourceManager.getKubeClient().getClient().namespaces().withName("opendatahub").delete(); + } + + /** + * TODO - this should be removed when https://github.com/opendatahub-io/opendatahub-operator/issues/765 will be resolved + */ + public static void deleteDefaultDSCI() { + LOGGER.info("Clearing DSCI ..."); + KubeResourceManager.getKubeCmdClient().exec(false, true, Long.valueOf(GLOBAL_TIMEOUT).intValue(), "delete", "dsci", "--all"); + } + + public static void waitForInstallPlan(String namespace, String csvName) { + Wait.until(String.format("Install plan with new version: %s:%s", namespace, csvName), + GLOBAL_POLL_INTERVAL_SHORT, GLOBAL_TIMEOUT, () -> { + try { + InstallPlan ip = KubeUtils.getNonApprovedInstallPlan(namespace, csvName); + LOGGER.debug("Found InstallPlan {} - {}", ip.getMetadata().getName(), ip.getSpec().getClusterServiceVersionNames()); + return true; + } catch (NoSuchElementException ex) { + LOGGER.debug("No new install plan available. Checking again ..."); + return false; + } + }, () -> { }); + } + + public static void waitForEndpoints(String name, Resource endpoints) { + Wait.until("%s service endpoints to come up".formatted(name), GLOBAL_POLL_INTERVAL_SHORT, GLOBAL_TIMEOUT, () -> { + try { + Endpoints endpointset = endpoints.get(); + if (endpointset == null) { + return false; + } + List subsets = endpointset.getSubsets(); + if (subsets.isEmpty()) { + return false; + } + for (EndpointSubset subset : subsets) { + return !subset.getAddresses().isEmpty(); + } + } catch (KubernetesClientException e) { + if (e.getCode() == 404) { + return false; + } + throw e; + } + return false; + }); + } } diff --git a/src/main/java/io/odh/test/framework/listeners/OdhResourceCleaner.java b/src/main/java/io/odh/test/framework/listeners/OdhResourceCleaner.java index 710d9d20..fe9b487a 100644 --- a/src/main/java/io/odh/test/framework/listeners/OdhResourceCleaner.java +++ b/src/main/java/io/odh/test/framework/listeners/OdhResourceCleaner.java @@ -5,7 +5,7 @@ package io.odh.test.framework.listeners; import io.odh.test.Environment; -import io.odh.test.platform.KubernetesUtils; +import io.odh.test.TestUtils; import org.junit.jupiter.api.extension.AfterAllCallback; import org.junit.jupiter.api.extension.ExtensionContext; @@ -14,7 +14,7 @@ public class OdhResourceCleaner implements AfterAllCallback { @Override public void afterAll(ExtensionContext extensionContext) { if (!Environment.SKIP_INSTALL_OPERATOR && !Environment.SKIP_DEPLOY_DSCI_DSC) { - KubernetesUtils.clearOdhRemainingResources(); + TestUtils.clearOdhRemainingResources(); } } } diff --git a/src/main/java/io/odh/test/framework/manager/resources/DataScienceClusterResource.java b/src/main/java/io/odh/test/framework/manager/resources/DataScienceClusterResource.java index 1facc1b1..8b3e76e8 100644 --- a/src/main/java/io/odh/test/framework/manager/resources/DataScienceClusterResource.java +++ b/src/main/java/io/odh/test/framework/manager/resources/DataScienceClusterResource.java @@ -12,7 +12,7 @@ import io.fabric8.kubernetes.client.dsl.Resource; import io.odh.test.OdhConstants; import io.odh.test.TestConstants; -import io.odh.test.platform.KubernetesUtils; +import io.odh.test.TestUtils; import io.odh.test.utils.PodUtils; import io.opendatahub.datasciencecluster.v1.DataScienceCluster; import io.skodjob.testframe.interfaces.ResourceType; @@ -77,11 +77,11 @@ public boolean waitForReadiness(DataScienceCluster resource) { DataScienceCluster dsc = dataScienceCLusterClient().withName(resource.getMetadata().getName()).get(); - String dashboardStatus = KubernetesUtils.getDscConditionByType(dsc.getStatus().getConditions(), "dashboardReady").getStatus(); + String dashboardStatus = TestUtils.getDscConditionByType(dsc.getStatus().getConditions(), "dashboardReady").getStatus(); LOGGER.debug("DataScienceCluster {} Dashboard status: {}", resource.getMetadata().getName(), dashboardStatus); dscReady = dashboardStatus.equals("True"); - String workbenchesStatus = KubernetesUtils.getDscConditionByType(dsc.getStatus().getConditions(), "workbenchesReady").getStatus(); + String workbenchesStatus = TestUtils.getDscConditionByType(dsc.getStatus().getConditions(), "workbenchesReady").getStatus(); LOGGER.debug("DataScienceCluster {} Workbenches status: {}", resource.getMetadata().getName(), workbenchesStatus); dscReady = dscReady && workbenchesStatus.equals("True"); @@ -143,13 +143,13 @@ record ConditionExpectation(String conditionType, String expectedStatus) { for (ConditionExpectation conditionExpectation : conditionExpectations) { String conditionType = conditionExpectation.conditionType; String expectedStatus = conditionExpectation.expectedStatus; - String conditionStatus = KubernetesUtils.getDscConditionByType(dsc.getStatus().getConditions(), conditionType).getStatus(); + String conditionStatus = TestUtils.getDscConditionByType(dsc.getStatus().getConditions(), conditionType).getStatus(); LOGGER.debug("DataScienceCluster {} {} status: {}", resource.getMetadata().getName(), conditionType, conditionStatus); dscReady = dscReady && Objects.equals(conditionStatus, expectedStatus); } // Wait for ReconcileComplete condition (for the whole DSC) - String reconcileStatus = KubernetesUtils.getDscConditionByType(dsc.getStatus().getConditions(), "ReconcileComplete").getStatus(); + String reconcileStatus = TestUtils.getDscConditionByType(dsc.getStatus().getConditions(), "ReconcileComplete").getStatus(); LOGGER.debug("DataScienceCluster {} ReconcileComplete status: {}", resource.getMetadata().getName(), reconcileStatus); dscReady = dscReady && reconcileStatus.equals("True"); diff --git a/src/main/java/io/odh/test/framework/manager/resources/InferenceServiceResource.java b/src/main/java/io/odh/test/framework/manager/resources/InferenceServiceResource.java index 53cb2c2b..a064bc5f 100644 --- a/src/main/java/io/odh/test/framework/manager/resources/InferenceServiceResource.java +++ b/src/main/java/io/odh/test/framework/manager/resources/InferenceServiceResource.java @@ -9,7 +9,7 @@ import io.fabric8.kubernetes.client.dsl.Resource; import io.kserve.serving.v1beta1.InferenceService; import io.odh.test.TestConstants; -import io.odh.test.platform.KubernetesUtils; +import io.odh.test.TestUtils; import io.odh.test.utils.PodUtils; import io.skodjob.testframe.interfaces.NamespacedResourceType; import io.skodjob.testframe.resources.KubeResourceManager; @@ -62,11 +62,11 @@ public boolean waitForReadiness(InferenceService resource) { InferenceService inferenceService = get(resource.getMetadata().getNamespace(), resource.getMetadata().getName()); - String predictorReadyStatus = KubernetesUtils.getInferenceServiceConditionByType(inferenceService.getStatus().getConditions(), "PredictorReady").getStatus(); + String predictorReadyStatus = TestUtils.getInferenceServiceConditionByType(inferenceService.getStatus().getConditions(), "PredictorReady").getStatus(); LOGGER.debug("InferenceService {} PredictorReady status: {}", resource.getMetadata().getName(), predictorReadyStatus); isReady = predictorReadyStatus.equals("True"); - String readyStatus = KubernetesUtils.getInferenceServiceConditionByType(inferenceService.getStatus().getConditions(), "Ready").getStatus(); + String readyStatus = TestUtils.getInferenceServiceConditionByType(inferenceService.getStatus().getConditions(), "Ready").getStatus(); LOGGER.debug("InferenceService {} Ready status: {}", resource.getMetadata().getName(), readyStatus); isReady = isReady && readyStatus.equals("True"); diff --git a/src/main/java/io/odh/test/install/BundleInstall.java b/src/main/java/io/odh/test/install/BundleInstall.java index 360537b5..5d8a5faf 100644 --- a/src/main/java/io/odh/test/install/BundleInstall.java +++ b/src/main/java/io/odh/test/install/BundleInstall.java @@ -10,7 +10,6 @@ import io.odh.test.Environment; import io.odh.test.TestConstants; import io.odh.test.TestUtils; -import io.odh.test.platform.KubernetesUtils; import io.skodjob.testframe.resources.KubeResourceManager; import io.skodjob.testframe.resources.ResourceItem; import org.slf4j.Logger; @@ -90,7 +89,7 @@ private void modifyOperatorImage() { public void create() { modifyOperatorImage(); KubeResourceManager.getInstance().createOrUpdateResourceWithWait(resources.toArray(new HasMetadata[0])); - KubeResourceManager.getInstance().pushToStack(new ResourceItem<>(KubernetesUtils::deleteDefaultDSCI, null)); + KubeResourceManager.getInstance().pushToStack(new ResourceItem<>(TestUtils::deleteDefaultDSCI, null)); } public void createWithoutResourceManager() { @@ -99,7 +98,7 @@ public void createWithoutResourceManager() { } public void deleteWithoutResourceManager() { - KubernetesUtils.deleteDefaultDSCI(); + TestUtils.deleteDefaultDSCI(); KubeResourceManager.getKubeClient().delete(resources); } } diff --git a/src/main/java/io/odh/test/install/OlmInstall.java b/src/main/java/io/odh/test/install/OlmInstall.java index 19cb0f7f..7166e471 100644 --- a/src/main/java/io/odh/test/install/OlmInstall.java +++ b/src/main/java/io/odh/test/install/OlmInstall.java @@ -13,7 +13,7 @@ import io.odh.test.Environment; import io.odh.test.OdhConstants; import io.odh.test.TestConstants; -import io.odh.test.platform.KubernetesUtils; +import io.odh.test.TestUtils; import io.odh.test.utils.DeploymentUtils; import io.skodjob.testframe.resources.KubeResourceManager; import io.skodjob.testframe.resources.ResourceItem; @@ -97,7 +97,7 @@ private void createAndModifySubscription() { Subscription subscription = prepareSubscription(); KubeResourceManager.getInstance().createOrUpdateResourceWithWait(subscription); - KubeResourceManager.getInstance().pushToStack(new ResourceItem<>(KubernetesUtils::deleteDefaultDSCI, null)); + KubeResourceManager.getInstance().pushToStack(new ResourceItem<>(TestUtils::deleteDefaultDSCI, null)); } public void updateSubscription() { Subscription subscription = prepareSubscription(); diff --git a/src/main/java/io/odh/test/platform/KubernetesUtils.java b/src/main/java/io/odh/test/platform/KubernetesUtils.java deleted file mode 100644 index b226297f..00000000 --- a/src/main/java/io/odh/test/platform/KubernetesUtils.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright Skodjob authors. - * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). - */ -package io.odh.test.platform; - -import io.fabric8.kubernetes.api.model.EndpointSubset; -import io.fabric8.kubernetes.api.model.Endpoints; -import io.fabric8.kubernetes.client.KubernetesClientException; -import io.fabric8.kubernetes.client.dsl.Resource; -import io.fabric8.openshift.api.model.operatorhub.v1alpha1.InstallPlan; -import io.odh.test.TestConstants; -import io.skodjob.testframe.resources.KubeResourceManager; -import io.skodjob.testframe.utils.KubeUtils; -import io.skodjob.testframe.wait.Wait; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.List; -import java.util.NoSuchElementException; - -public class KubernetesUtils { - - static final Logger LOGGER = LoggerFactory.getLogger(KubernetesUtils.class); - - public static io.opendatahub.datasciencecluster.v1.datascienceclusterstatus.Conditions getDscConditionByType(List conditions, String type) { - return conditions.stream().filter(c -> c.getType().equals(type)).findFirst().orElseGet(null); - } - - public static org.kubeflow.v1.notebookstatus.Conditions getNotebookConditionByType(List conditions, String type) { - return conditions.stream().filter(c -> c.getType().equals(type)).findFirst().orElseGet(null); - } - - public static io.kserve.serving.v1beta1.inferenceservicestatus.Conditions getInferenceServiceConditionByType(List conditions, String type) { - return conditions.stream().filter(c -> c.getType().equals(type)).findFirst().orElseGet(null); - } - - public static void clearOdhRemainingResources() { - KubeResourceManager.getKubeClient().getClient().apiextensions().v1().customResourceDefinitions().list().getItems() - .stream().filter(crd -> crd.getMetadata().getName().contains("opendatahub.io")).toList() - .forEach(crd -> { - LOGGER.info("Deleting CRD {}", crd.getMetadata().getName()); - KubeResourceManager.getKubeClient().getClient().resource(crd).delete(); - }); - KubeResourceManager.getKubeClient().getClient().namespaces().withName("opendatahub").delete(); - } - - /** - * TODO - this should be removed when https://github.com/opendatahub-io/opendatahub-operator/issues/765 will be resolved - */ - public static void deleteDefaultDSCI() { - LOGGER.info("Clearing DSCI ..."); - KubeResourceManager.getKubeCmdClient().exec(false, true, Long.valueOf(TestConstants.GLOBAL_TIMEOUT).intValue(), "delete", "dsci", "--all"); - } - - public static void waitForInstallPlan(String namespace, String csvName) { - Wait.until(String.format("Install plan with new version: %s:%s", namespace, csvName), - TestConstants.GLOBAL_POLL_INTERVAL_SHORT, TestConstants.GLOBAL_TIMEOUT, () -> { - try { - InstallPlan ip = KubeUtils.getNonApprovedInstallPlan(namespace, csvName); - LOGGER.debug("Found InstallPlan {} - {}", ip.getMetadata().getName(), ip.getSpec().getClusterServiceVersionNames()); - return true; - } catch (NoSuchElementException ex) { - LOGGER.debug("No new install plan available. Checking again ..."); - return false; - } - }, () -> { }); - } - - private KubernetesUtils() { - } - - public static void waitForEndpoints(String name, Resource endpoints) { - Wait.until("%s service endpoints to come up".formatted(name), TestConstants.GLOBAL_POLL_INTERVAL_SHORT, TestConstants.GLOBAL_TIMEOUT, () -> { - try { - Endpoints endpointset = endpoints.get(); - if (endpointset == null) { - return false; - } - List subsets = endpointset.getSubsets(); - if (subsets.isEmpty()) { - return false; - } - for (EndpointSubset subset : subsets) { - return !subset.getAddresses().isEmpty(); - } - } catch (KubernetesClientException e) { - if (e.getCode() == 404) { - return false; - } - throw e; - } - return false; - }); - } -} diff --git a/src/test/java/io/odh/test/e2e/continuous/DataScienceClusterST.java b/src/test/java/io/odh/test/e2e/continuous/DataScienceClusterST.java index 2a1af2d1..c89b79cb 100644 --- a/src/test/java/io/odh/test/e2e/continuous/DataScienceClusterST.java +++ b/src/test/java/io/odh/test/e2e/continuous/DataScienceClusterST.java @@ -10,10 +10,10 @@ import io.odh.test.Environment; import io.odh.test.OdhConstants; import io.odh.test.TestSuite; +import io.odh.test.TestUtils; import io.odh.test.e2e.Abstract; import io.odh.test.framework.manager.resources.DataScienceClusterResource; import io.odh.test.install.InstallTypes; -import io.odh.test.platform.KubernetesUtils; import io.odh.test.utils.CsvUtils; import io.opendatahub.datasciencecluster.v1.DataScienceCluster; import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.Codeflare; @@ -81,13 +81,13 @@ void checkDataScienceClusterStatus() { assertEquals("Ready", cluster.getStatus().getPhase()); assertNull(cluster.getStatus().getErrorMessage()); - assertEquals("True", KubernetesUtils.getDscConditionByType(cluster.getStatus().getConditions(), "dashboardReady").getStatus()); - assertEquals("True", KubernetesUtils.getDscConditionByType(cluster.getStatus().getConditions(), "workbenchesReady").getStatus()); - assertEquals("True", KubernetesUtils.getDscConditionByType(cluster.getStatus().getConditions(), "data-science-pipelines-operatorReady").getStatus()); - assertEquals("True", KubernetesUtils.getDscConditionByType(cluster.getStatus().getConditions(), "kserveReady").getStatus()); - assertEquals("True", KubernetesUtils.getDscConditionByType(cluster.getStatus().getConditions(), "codeflareReady").getStatus()); - assertEquals("True", KubernetesUtils.getDscConditionByType(cluster.getStatus().getConditions(), "model-meshReady").getStatus()); - assertEquals("True", KubernetesUtils.getDscConditionByType(cluster.getStatus().getConditions(), "kueueReady").getStatus()); + assertEquals("True", TestUtils.getDscConditionByType(cluster.getStatus().getConditions(), "dashboardReady").getStatus()); + assertEquals("True", TestUtils.getDscConditionByType(cluster.getStatus().getConditions(), "workbenchesReady").getStatus()); + assertEquals("True", TestUtils.getDscConditionByType(cluster.getStatus().getConditions(), "data-science-pipelines-operatorReady").getStatus()); + assertEquals("True", TestUtils.getDscConditionByType(cluster.getStatus().getConditions(), "kserveReady").getStatus()); + assertEquals("True", TestUtils.getDscConditionByType(cluster.getStatus().getConditions(), "codeflareReady").getStatus()); + assertEquals("True", TestUtils.getDscConditionByType(cluster.getStatus().getConditions(), "model-meshReady").getStatus()); + assertEquals("True", TestUtils.getDscConditionByType(cluster.getStatus().getConditions(), "kueueReady").getStatus()); } @Test diff --git a/src/test/java/io/odh/test/e2e/continuous/DataScienceProjectST.java b/src/test/java/io/odh/test/e2e/continuous/DataScienceProjectST.java index 1ce1f2ab..d23456dd 100644 --- a/src/test/java/io/odh/test/e2e/continuous/DataScienceProjectST.java +++ b/src/test/java/io/odh/test/e2e/continuous/DataScienceProjectST.java @@ -8,9 +8,9 @@ import io.fabric8.kubernetes.client.dsl.MixedOperation; import io.fabric8.kubernetes.client.dsl.Resource; import io.odh.test.TestSuite; +import io.odh.test.TestUtils; import io.odh.test.e2e.Abstract; import io.odh.test.framework.manager.resources.NotebookResource; -import io.odh.test.platform.KubernetesUtils; import io.skodjob.testframe.annotations.ResourceManager; import io.skodjob.testframe.resources.KubeResourceManager; import org.junit.jupiter.api.BeforeAll; @@ -63,8 +63,8 @@ void checkDataScienceProjects(String dsProjectName) { assertEquals("true", notebook.getMetadata().getLabels().getOrDefault("opendatahub.io/odh-managed", "false")); - assertEquals("True", KubernetesUtils.getNotebookConditionByType(notebook.getStatus().getConditions(), "ContainersReady").getStatus()); - assertEquals("True", KubernetesUtils.getNotebookConditionByType(notebook.getStatus().getConditions(), "Ready").getStatus()); + assertEquals("True", TestUtils.getNotebookConditionByType(notebook.getStatus().getConditions(), "ContainersReady").getStatus()); + assertEquals("True", TestUtils.getNotebookConditionByType(notebook.getStatus().getConditions(), "Ready").getStatus()); }); } } diff --git a/src/test/java/io/odh/test/e2e/standard/DistributedST.java b/src/test/java/io/odh/test/e2e/standard/DistributedST.java index cca14e5f..38458e93 100644 --- a/src/test/java/io/odh/test/e2e/standard/DistributedST.java +++ b/src/test/java/io/odh/test/e2e/standard/DistributedST.java @@ -24,7 +24,6 @@ import io.odh.test.OdhAnnotationsLabels; import io.odh.test.TestUtils; import io.odh.test.install.InstallTypes; -import io.odh.test.platform.KubernetesUtils; import io.odh.test.platform.RayClient; import io.odh.test.platform.TlsUtils; import io.odh.test.utils.CsvUtils; @@ -150,7 +149,7 @@ void testDistributedWorkloadWithAppWrapper() throws Exception { Allure.step("Wait for Ray API endpoint"); Resource endpoints = kubeClient.endpoints().inNamespace(projectName).withName("koranteng-head-svc"); - KubernetesUtils.waitForEndpoints("ray", endpoints); + TestUtils.waitForEndpoints("ray", endpoints); Allure.step("Determine API route"); Route route = kubeClient.routes().inNamespace(projectName).withName("ray-dashboard-koranteng").get(); @@ -312,7 +311,7 @@ void testDistributedWorkloadWithKueue() throws Exception { Allure.step("Wait for Ray API endpoint"); Resource endpoints = kubeClient.endpoints().inNamespace(projectName).withName("koranteng-head-svc"); - KubernetesUtils.waitForEndpoints("ray", endpoints); + TestUtils.waitForEndpoints("ray", endpoints); Allure.step("Determine API route"); Route route = kubeClient.routes().inNamespace(projectName).withName("ray-dashboard-koranteng").get(); diff --git a/src/test/java/io/odh/test/e2e/standard/PipelineServerST.java b/src/test/java/io/odh/test/e2e/standard/PipelineServerST.java index c4af0ec7..338298a1 100644 --- a/src/test/java/io/odh/test/e2e/standard/PipelineServerST.java +++ b/src/test/java/io/odh/test/e2e/standard/PipelineServerST.java @@ -21,8 +21,8 @@ import io.fabric8.openshift.client.OpenShiftClient; import io.odh.test.Environment; import io.odh.test.OdhAnnotationsLabels; +import io.odh.test.TestUtils; import io.odh.test.platform.KFPv1Client; -import io.odh.test.platform.KubernetesUtils; import io.odh.test.utils.DscUtils; import io.opendatahub.datasciencecluster.v1.DataScienceCluster; import io.opendatahub.datasciencepipelinesapplications.v1alpha1.DataSciencePipelinesApplication; @@ -207,7 +207,7 @@ void testUserCanCreateRunAndDeleteADSPipelineFromDSProject() throws IOException // wait for pipeline api server to come up Resource endpoints = client.endpoints().inNamespace(prjTitle).withName("ds-pipeline-pipelines-definition"); - KubernetesUtils.waitForEndpoints("pipelines", endpoints); + TestUtils.waitForEndpoints("pipelines", endpoints); // connect to the api server we just created, route not available unless I enable oauth Resource route = ocClient.routes() diff --git a/src/test/java/io/odh/test/e2e/standard/PipelineV2ServerST.java b/src/test/java/io/odh/test/e2e/standard/PipelineV2ServerST.java index 5873e03b..06e69fa8 100644 --- a/src/test/java/io/odh/test/e2e/standard/PipelineV2ServerST.java +++ b/src/test/java/io/odh/test/e2e/standard/PipelineV2ServerST.java @@ -21,8 +21,8 @@ import io.fabric8.openshift.client.OpenShiftClient; import io.odh.test.Environment; import io.odh.test.OdhAnnotationsLabels; +import io.odh.test.TestUtils; import io.odh.test.platform.KFPv2Client; -import io.odh.test.platform.KubernetesUtils; import io.odh.test.utils.DscUtils; import io.opendatahub.datasciencecluster.v1.DataScienceCluster; import io.opendatahub.datasciencecluster.v1.DataScienceClusterBuilder; @@ -282,7 +282,7 @@ void testUserCanOperateDSv2PipelineFromDSProject() throws IOException { Allure.step("Wait for Pipeline API server to come up"); Resource endpoints = client.endpoints().inNamespace(prjTitle).withName("ds-pipeline-pipelines-definition"); - KubernetesUtils.waitForEndpoints("pipelines", endpoints); + TestUtils.waitForEndpoints("pipelines", endpoints); Allure.step("Connect to the API server"); Resource route = ocClient.routes() diff --git a/src/test/java/io/odh/test/e2e/upgrade/OlmUpgradeST.java b/src/test/java/io/odh/test/e2e/upgrade/OlmUpgradeST.java index c0e1f4e1..59e4e62d 100644 --- a/src/test/java/io/odh/test/e2e/upgrade/OlmUpgradeST.java +++ b/src/test/java/io/odh/test/e2e/upgrade/OlmUpgradeST.java @@ -10,8 +10,8 @@ import io.odh.test.Environment; import io.odh.test.OdhConstants; import io.odh.test.TestSuite; +import io.odh.test.TestUtils; import io.odh.test.install.OlmInstall; -import io.odh.test.platform.KubernetesUtils; import io.odh.test.utils.DeploymentUtils; import io.odh.test.utils.PodUtils; import io.odh.test.utils.UpgradeUtils; @@ -78,7 +78,7 @@ void testUpgradeOlm() throws IOException, InterruptedException { olmInstall.createManual(); // Approve install plan created for older version - KubernetesUtils.waitForInstallPlan(olmInstall.getNamespace(), olmInstall.getOperatorName() + "." + startingVersion); + TestUtils.waitForInstallPlan(olmInstall.getNamespace(), olmInstall.getOperatorName() + "." + startingVersion); InstallPlan ip = io.skodjob.testframe.utils.KubeUtils.getNonApprovedInstallPlan(olmInstall.getNamespace(), olmInstall.getOperatorName() + "." + startingVersion); io.skodjob.testframe.utils.KubeUtils.approveInstallPlan(olmInstall.getNamespace(), ip.getMetadata().getName()); // Wait for old version readiness @@ -99,7 +99,7 @@ void testUpgradeOlm() throws IOException, InterruptedException { LOGGER.info("Upgrade to next available version in OLM catalog"); // Approve upgrade to newer version - KubernetesUtils.waitForInstallPlan(olmInstall.getNamespace(), olmInstall.getCsvName()); + TestUtils.waitForInstallPlan(olmInstall.getNamespace(), olmInstall.getCsvName()); ip = io.skodjob.testframe.utils.KubeUtils.getNonApprovedInstallPlan(olmInstall.getNamespace(), olmInstall.getCsvName()); io.skodjob.testframe.utils.KubeUtils.approveInstallPlan(olmInstall.getNamespace(), ip.getMetadata().getName()); // Wait for operator RU