Skip to content

Commit

Permalink
Precreate namespace for RHOAI operator
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Stejskal <[email protected]>
  • Loading branch information
Frawless committed Jan 5, 2024
1 parent 8da4160 commit b273606
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/main/java/io/odh/test/install/OlmInstall.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/
package io.odh.test.install;

import io.fabric8.kubernetes.api.model.Namespace;
import io.fabric8.kubernetes.api.model.NamespaceBuilder;
import io.fabric8.openshift.api.model.operatorhub.v1.OperatorGroupBuilder;
import io.fabric8.openshift.api.model.operatorhub.v1alpha1.Subscription;
import io.fabric8.openshift.api.model.operatorhub.v1alpha1.SubscriptionBuilder;
Expand Down Expand Up @@ -38,6 +40,14 @@ public class OlmInstall {
private String approval = "Automatic";

public void create() {
// Create namespace at first because operator-group and subscription could you specific namespace
Namespace ns = new NamespaceBuilder()
.withNewMetadata()
.withName(namespace)
.endMetadata()
.build();
ResourceManager.getInstance().createResourceWithoutWait(ns);
// Create operator group and subscription
createOperatorGroup();
ResourceManager.getInstance().pushToStack(new ResourceItem(this::deleteCSV));
createAndModifySubscription();
Expand Down
7 changes: 5 additions & 2 deletions src/test/java/io/odh/test/e2e/standard/StandardAbstract.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.Locale;

import static org.junit.jupiter.api.Assertions.fail;

Expand All @@ -32,10 +33,12 @@ public class StandardAbstract extends Abstract {

@BeforeAll
void setupEnvironment() throws IOException {
if (Environment.OPERATOR_INSTALL_TYPE.equals(InstallTypes.OLM.toString())) {
if (Environment.OPERATOR_INSTALL_TYPE.toLowerCase(Locale.ENGLISH)
.equals(InstallTypes.OLM.toString().toLowerCase(Locale.ENGLISH))) {
OlmInstall olmInstall = new OlmInstall();
olmInstall.create();
} else if (Environment.OPERATOR_INSTALL_TYPE.equals(InstallTypes.BUNDLE.toString())) {
} else if (Environment.OPERATOR_INSTALL_TYPE.toLowerCase(Locale.ENGLISH)
.equals(InstallTypes.BUNDLE.toString().toLowerCase(Locale.ENGLISH))) {
BundleInstall bundleInstall = new BundleInstall();
bundleInstall.create();
} else {
Expand Down

0 comments on commit b273606

Please sign in to comment.