Skip to content

Commit

Permalink
Let's have a separate global constants for RHOAI and ODH (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
jstourac authored Mar 10, 2024
1 parent 495b5b4 commit 1224565
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/main/java/io/odh/test/Environment.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ 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";

/**
* Set values
*/
public static final String PRODUCT = getOrDefault(PRODUCT_ENV, PRODUCT_DEFAULT);
public static final String PRODUCT = getOrDefault(PRODUCT_ENV, PRODUCT_ODH);
public static final String RUN_USER = getOrDefault("USER", null);
public static final String KUBE_USERNAME = getOrDefault(USERNAME_ENV, null);
public static final String KUBE_PASSWORD = getOrDefault(PASSWORD_ENV, null);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/odh/test/OdhConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private OdhConstants() { }

private static <T> 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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/io/odh/test/e2e/upgrade/UpgradeAbstract.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 1224565

Please sign in to comment.