Skip to content

Commit

Permalink
Add option to specify starting version for OLM upgrades
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Stejskal <[email protected]>
  • Loading branch information
Frawless committed Jan 12, 2024
1 parent cbc5535 commit 003098e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main/java/io/odh/test/Environment.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public class Environment {
private static final String OLM_OPERATOR_VERSION_ENV = "OLM_OPERATOR_VERSION";
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";

public static final String PRODUCT_DEFAULT = "odh";

Expand All @@ -87,6 +88,7 @@ public class Environment {
public static final String OLM_SOURCE_NAMESPACE = getOrDefault(OLM_SOURCE_NAMESPACE_ENV, "openshift-marketplace");
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 OPERATOR_INSTALL_TYPE = getOrDefault(OPERATOR_INSTALL_TYPE_ENV, InstallTypes.BUNDLE.toString());

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/io/odh/test/OdhConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ private OdhConstants() { }
private static final String ODH_OLM_SOURCE_NAME = "community-operators";
private static final String ODH_OLM_APP_BUNDLE_PREFIX = "opendatahub-operator";
private static final String ODH_OLM_OPERATOR_CHANNEL = "fast";
// TODO - should be changed after 2.5 release
private static final String ODH_OLM_OPERATOR_VERSION = "v2.4.0";
private static final String ODH_OLM_UPGRADE_STARTING_OPERATOR_VERSION = "v2.4.0";

// RHOAI
private static final String RHOAI_CONTROLLERS_NAMESPACE = "redhat-ods-applications";
Expand All @@ -37,6 +39,7 @@ private OdhConstants() { }
private static final String RHOAI_OLM_APP_BUNDLE_PREFIX = "rhods-operator";
private static final String RHOAI_OLM_OPERATOR_CHANNEL = "stable";
private static final String RHOAI_OLM_OPERATOR_VERSION = "2.5.0";
private static final String RHOAI_OLM_UPGRADE_STARTING_OPERATOR_VERSION = "2.4.0";

// Public part
public static final String CODEFLARE_DEPLOYMENT_NAME = "codeflare-operator-manager";
Expand All @@ -62,6 +65,7 @@ private OdhConstants() { }
public static final String OLM_OPERATOR_VERSION = getOdhOrRhoai(ODH_OLM_OPERATOR_VERSION, RHOAI_OLM_OPERATOR_VERSION);
public static final String OLM_SOURCE_NAME = getOdhOrRhoai(ODH_OLM_SOURCE_NAME, RHOAI_OLM_SOURCE_NAME);
public static final String OLM_OPERATOR_CHANNEL = getOdhOrRhoai(ODH_OLM_OPERATOR_CHANNEL, RHOAI_OLM_OPERATOR_CHANNEL);
public static final String OLM_UPGRADE_STARTING_OPERATOR_VERSION = getOdhOrRhoai(ODH_OLM_UPGRADE_STARTING_OPERATOR_VERSION, RHOAI_OLM_UPGRADE_STARTING_OPERATOR_VERSION);

private static <T> T getOdhOrRhoai(T odhValue, T rhoaiValue) {
T returnValue = odhValue;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/io/odh/test/e2e/upgrade/OlmUpgradeST.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class OlmUpgradeST extends UpgradeAbstract {
private static final Logger LOGGER = LoggerFactory.getLogger(OlmUpgradeST.class);
private static final String DS_PROJECT_NAME = "upgrade-dsc";

private final String startingVersion = !Environment.PRODUCT.equals(Environment.PRODUCT_DEFAULT) ? "2.4.0" : "v.2.4.0";
private final String startingVersion = Environment.OLM_UPGRADE_STARTING_VERSION;

@Test
@Disabled("Tested only for upgrades from 2.4+ so we are waiting for 2.5 release")
Expand Down

0 comments on commit 003098e

Please sign in to comment.