From 6a5f69376941eaf5d3662404f25c8d027bc8144a Mon Sep 17 00:00:00 2001 From: Jan Stourac Date: Sun, 10 Mar 2024 12:01:45 +0100 Subject: [PATCH] Let's have a separate global constants for RHOAI and ODH Let's keep the constant for the default product name but also introduce a global constants for the RHOAI and ODH so we can reference them directly in our tests instead of relying on the default product set. --- src/main/java/io/odh/test/Environment.java | 4 +++- src/main/java/io/odh/test/OdhConstants.java | 2 +- .../test/framework/manager/resources/NotebookResource.java | 2 +- .../java/io/odh/test/e2e/continuous/DataScienceClusterST.java | 2 +- .../java/io/odh/test/e2e/standard/DataScienceClusterST.java | 2 +- src/test/java/io/odh/test/e2e/standard/PipelineServerST.java | 2 +- src/test/java/io/odh/test/e2e/upgrade/UpgradeAbstract.java | 2 +- 7 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/io/odh/test/Environment.java b/src/main/java/io/odh/test/Environment.java index e5ff456f..36d04a31 100644 --- a/src/main/java/io/odh/test/Environment.java +++ b/src/main/java/io/odh/test/Environment.java @@ -69,7 +69,9 @@ public class Environment { private static final String OPERATOR_INSTALL_TYPE_ENV = "OPERATOR_INSTALL_TYPE"; private static final String OLM_UPGRADE_STARTING_VERSION_ENV = "OLM_UPGRADE_STARTING_VERSION"; - public static final String PRODUCT_DEFAULT = "odh"; + public static final String PRODUCT_ODH = "odh"; + public static final String PRODUCT_RHOAI = "rhoai"; + public static final String PRODUCT_DEFAULT = PRODUCT_ODH; /** * Set values diff --git a/src/main/java/io/odh/test/OdhConstants.java b/src/main/java/io/odh/test/OdhConstants.java index 95102af8..8bdf208c 100644 --- a/src/main/java/io/odh/test/OdhConstants.java +++ b/src/main/java/io/odh/test/OdhConstants.java @@ -87,7 +87,7 @@ private OdhConstants() { } private static T getOdhOrRhoai(String var, T odhValue, T rhoaiValue) { T returnValue = odhValue; - if (!Objects.equals(Environment.PRODUCT, Environment.PRODUCT_DEFAULT)) { + if (!Objects.equals(Environment.PRODUCT, Environment.PRODUCT_ODH)) { returnValue = rhoaiValue; } VALUES.put(var, String.valueOf(returnValue)); diff --git a/src/main/java/io/odh/test/framework/manager/resources/NotebookResource.java b/src/main/java/io/odh/test/framework/manager/resources/NotebookResource.java index 2f65b4b0..a478aa57 100644 --- a/src/main/java/io/odh/test/framework/manager/resources/NotebookResource.java +++ b/src/main/java/io/odh/test/framework/manager/resources/NotebookResource.java @@ -91,7 +91,7 @@ public static Notebook loadDefaultNotebook(String namespace, String name, String } public static String getNotebookImage(String imageName, String imageTag) { - if (Objects.equals(Environment.PRODUCT, Environment.PRODUCT_DEFAULT)) { + if (Objects.equals(Environment.PRODUCT, Environment.PRODUCT_ODH)) { return REGISTRY_PATH + "/" + OdhConstants.CONTROLLERS_NAMESPACE + "/" + ODH_IMAGES_MAP.get(imageName) + ":" + imageTag; } else { return REGISTRY_PATH + "/" + OdhConstants.CONTROLLERS_NAMESPACE + "/" + RHOAI_IMAGES_MAP.get(imageName) + ":" + imageTag; 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 9e23f2b5..51c8a8e4 100644 --- a/src/test/java/io/odh/test/e2e/continuous/DataScienceClusterST.java +++ b/src/test/java/io/odh/test/e2e/continuous/DataScienceClusterST.java @@ -61,7 +61,7 @@ void checkDataScienceClusterExists() { assertEquals(Ray.ManagementState.MANAGED, cluster.getSpec().getComponents().getRay().getManagementState()); assertEquals(Modelmeshserving.ManagementState.MANAGED, cluster.getSpec().getComponents().getModelmeshserving().getManagementState()); assertEquals(Datasciencepipelines.ManagementState.MANAGED, cluster.getSpec().getComponents().getDatasciencepipelines().getManagementState()); - if (!Environment.PRODUCT.equals(Environment.PRODUCT_DEFAULT) + if (!Environment.PRODUCT.equals(Environment.PRODUCT_ODH) && Environment.OPERATOR_INSTALL_TYPE.equalsIgnoreCase(InstallTypes.OLM.toString()) && Objects.requireNonNull(CsvUtils.getOperatorVersionFromCsv()).equals("2.7.0")) { // https://issues.redhat.com/browse/RHOAIENG-3234 Remove Kueue from RHOAI 2.7 diff --git a/src/test/java/io/odh/test/e2e/standard/DataScienceClusterST.java b/src/test/java/io/odh/test/e2e/standard/DataScienceClusterST.java index 2a3fe201..4e995201 100644 --- a/src/test/java/io/odh/test/e2e/standard/DataScienceClusterST.java +++ b/src/test/java/io/odh/test/e2e/standard/DataScienceClusterST.java @@ -92,7 +92,7 @@ void createDataScienceCluster() { assertEquals(Workbenches.ManagementState.MANAGED, cluster.getSpec().getComponents().getWorkbenches().getManagementState()); assertEquals(Modelmeshserving.ManagementState.MANAGED, cluster.getSpec().getComponents().getModelmeshserving().getManagementState()); assertEquals(Ray.ManagementState.MANAGED, cluster.getSpec().getComponents().getRay().getManagementState()); - if (!Environment.PRODUCT.equals(Environment.PRODUCT_DEFAULT) + if (!Environment.PRODUCT.equals(Environment.PRODUCT_ODH) && Environment.OPERATOR_INSTALL_TYPE.equalsIgnoreCase(InstallTypes.OLM.toString()) && Objects.requireNonNull(CsvUtils.getOperatorVersionFromCsv()).equals("2.7.0")) { // https://issues.redhat.com/browse/RHOAIENG-3234 Remove Kueue from RHOAI 2.7 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 040009c7..2cb49163 100644 --- a/src/test/java/io/odh/test/e2e/standard/PipelineServerST.java +++ b/src/test/java/io/odh/test/e2e/standard/PipelineServerST.java @@ -223,7 +223,7 @@ void testUserCanCreateRunAndDeleteADSPipelineFromDSProject() throws IOException KFPv1Client kfpv1Client = new KFPv1Client("http://localhost:%d".formatted(portForward.getLocalPort())); // WORKAROUND(RHOAIENG-3250): delete sample pipeline present on ODH - if (Environment.PRODUCT.equals(Environment.PRODUCT_DEFAULT)) { + if (Environment.PRODUCT.equals(Environment.PRODUCT_ODH)) { for (KFPv1Client.Pipeline pipeline : kfpv1Client.listPipelines()) { kfpv1Client.deletePipeline(pipeline.id); } diff --git a/src/test/java/io/odh/test/e2e/upgrade/UpgradeAbstract.java b/src/test/java/io/odh/test/e2e/upgrade/UpgradeAbstract.java index 34e905c8..ebc3357b 100644 --- a/src/test/java/io/odh/test/e2e/upgrade/UpgradeAbstract.java +++ b/src/test/java/io/odh/test/e2e/upgrade/UpgradeAbstract.java @@ -121,7 +121,7 @@ public void deployNotebook(String namespace, String name) throws IOException { String notebookImage = NotebookResource.getNotebookImage(NotebookResource.JUPYTER_MINIMAL_IMAGE, NotebookResource.JUPYTER_MINIMAL_2023_2_TAG); Notebook notebook = new NotebookBuilder(NotebookResource.loadDefaultNotebook(namespace, name, notebookImage)).build(); - if (!Environment.PRODUCT.equals(Environment.PRODUCT_DEFAULT)) { + if (!Environment.PRODUCT.equals(Environment.PRODUCT_ODH)) { notebook = new NotebookBuilder(NotebookResource.loadDefaultNotebook(namespace, name, notebookImage)) .editSpec() .editNotebookspecTemplate()