Skip to content

Commit

Permalink
feat: support the necessary configurability for testing odh-nightly b…
Browse files Browse the repository at this point in the history
…uilds (#148)
  • Loading branch information
jiridanek authored Jul 10, 2024
1 parent 762ca69 commit 1764396
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/main/java/io/odh/test/Environment.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class Environment {
private static final String SKIP_INSTALL_OPERATOR_DEPS_ENV = "SKIP_INSTALL_OPERATOR_DEPS";
private static final String SKIP_INSTALL_OPERATOR_ENV = "SKIP_INSTALL_OPERATOR";
public static final String SKIP_DEPLOY_DSCI_DSC_ENV = "SKIP_DEPLOY_DSCI_DSC";
public static final String DEFAULT_DSCI_NAME_ENV = "DEFAULT_DSCI_NAME";

/**
* Install bundle files
Expand All @@ -62,6 +63,7 @@ public class Environment {
private static final String OLM_SOURCE_NAME_ENV = "OLM_SOURCE_NAME";
private static final String OLM_SOURCE_NAMESPACE_ENV = "OLM_SOURCE_NAMESPACE";
private static final String OLM_OPERATOR_VERSION_ENV = "OLM_OPERATOR_VERSION";
private static final String OLM_OPERATOR_NAME_ENV = "OLM_OPERATOR_NAME";
private static final String OLM_OPERATOR_CHANNEL_ENV = "OLM_OPERATOR_CHANNEL";
private static final String OPERATOR_INSTALL_TYPE_ENV = "OPERATOR_INSTALL_TYPE";
private static final String OLM_UPGRADE_STARTING_VERSION_ENV = "OLM_UPGRADE_STARTING_VERSION";
Expand All @@ -78,6 +80,7 @@ public class Environment {
public static final boolean SKIP_INSTALL_OPERATOR_DEPS = getOrDefault(SKIP_INSTALL_OPERATOR_DEPS_ENV, Boolean::valueOf, false);
public static final boolean SKIP_INSTALL_OPERATOR = getOrDefault(SKIP_INSTALL_OPERATOR_ENV, Boolean::valueOf, false);
public static final boolean SKIP_DEPLOY_DSCI_DSC = getOrDefault(SKIP_DEPLOY_DSCI_DSC_ENV, Boolean::valueOf, false);
public static final String DEFAULT_DSCI_NAME = getOrDefault(DEFAULT_DSCI_NAME_ENV, String::valueOf, OdhConstants.DEFAULT_DSCI_NAME);

// YAML Bundle
public static final String INSTALL_FILE_PATH = getOrDefault(INSTALL_FILE_ENV, TestConstants.LATEST_BUNDLE_DEPLOY_FILE);
Expand All @@ -90,6 +93,7 @@ public class Environment {
public static final String OLM_OPERATOR_CHANNEL = getOrDefault(OLM_OPERATOR_CHANNEL_ENV, OdhConstants.OLM_OPERATOR_CHANNEL);
public static final String OLM_OPERATOR_VERSION = getOrDefault(OLM_OPERATOR_VERSION_ENV, OdhConstants.OLM_OPERATOR_VERSION);
public static final String OLM_UPGRADE_STARTING_VERSION = getOrDefault(OLM_UPGRADE_STARTING_VERSION_ENV, OdhConstants.OLM_UPGRADE_STARTING_OPERATOR_VERSION);
public static final String OLM_OPERATOR_NAME = getOrDefault(OLM_OPERATOR_NAME_ENV, OdhConstants.OLM_OPERATOR_NAME);

public static final String OPERATOR_INSTALL_TYPE = getOrDefault(OPERATOR_INSTALL_TYPE_ENV, InstallTypes.BUNDLE.toString());

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/io/odh/test/install/OlmInstall.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ public class OlmInstall {

private String namespace = OdhConstants.OLM_OPERATOR_NAMESPACE;
private String channel = Environment.OLM_OPERATOR_CHANNEL;
private String name = OdhConstants.OLM_OPERATOR_NAME;
private String operatorName = OdhConstants.OLM_OPERATOR_NAME;
private String name = Environment.OLM_OPERATOR_NAME;
private String operatorName = Environment.OLM_OPERATOR_NAME;
private String sourceName = Environment.OLM_SOURCE_NAME;
private String sourceNamespace = Environment.OLM_SOURCE_NAMESPACE;
private String startingCsv;
private String deploymentName = OdhConstants.OLM_OPERATOR_DEPLOYMENT_NAME;
private String olmAppBundlePrefix = OdhConstants.OLM_OPERATOR_NAME;
private String olmAppBundlePrefix = Environment.OLM_OPERATOR_NAME;
private String operatorVersion = Environment.OLM_OPERATOR_VERSION;
private String csvName = operatorName + "." + operatorVersion;

Expand Down Expand Up @@ -62,7 +62,7 @@ public void createManual() {
*/
private void createNamespace() {
if (!KubeResourceManager.getKubeClient().namespaceExists(namespace)) {
// Create namespace at first because operator-group and subscription could you specific namespace
// Create a namespace first because operator-group and subscription could use specific namespace
Namespace ns = new NamespaceBuilder()
.withNewMetadata()
.withName(namespace)
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/odh/test/utils/DscUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
package io.odh.test.utils;

import io.odh.test.Environment;
import io.odh.test.OdhConstants;
import io.odh.test.framework.manager.requirements.ServiceMeshOperator;
import io.opendatahub.datasciencecluster.v1.DataScienceCluster;
Expand Down Expand Up @@ -37,7 +38,7 @@ public class DscUtils {
public static DSCInitialization getBasicDSCI() {
return new DSCInitializationBuilder()
.withNewMetadata()
.withName(OdhConstants.DEFAULT_DSCI_NAME)
.withName(Environment.DEFAULT_DSCI_NAME)
.endMetadata()
.withNewSpec()
.withApplicationsNamespace(OdhConstants.CONTROLLERS_NAMESPACE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ void createDataScienceCluster() {
// Create DSC
DataScienceCluster c = DscUtils.getBasicDSC(DS_PROJECT_NAME);

KubeResourceManager.getInstance().createResourceWithWait(dsci);
// odh-nightly gives us a default DSCi, update that
KubeResourceManager.getInstance().createOrUpdateResourceWithWait(dsci);
KubeResourceManager.getInstance().createResourceWithWait(c);

DataScienceCluster cluster = DataScienceClusterType.dataScienceCLusterClient().withName(DS_PROJECT_NAME).get();
Expand Down

0 comments on commit 1764396

Please sign in to comment.