diff --git a/src/main/java/io/odh/test/install/OlmInstall.java b/src/main/java/io/odh/test/install/OlmInstall.java index 513283cb..e0c4a271 100644 --- a/src/main/java/io/odh/test/install/OlmInstall.java +++ b/src/main/java/io/odh/test/install/OlmInstall.java @@ -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; @@ -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(); diff --git a/src/test/java/io/odh/test/e2e/standard/StandardAbstract.java b/src/test/java/io/odh/test/e2e/standard/StandardAbstract.java index bd462322..6cb97c39 100644 --- a/src/test/java/io/odh/test/e2e/standard/StandardAbstract.java +++ b/src/test/java/io/odh/test/e2e/standard/StandardAbstract.java @@ -20,6 +20,7 @@ import org.slf4j.LoggerFactory; import java.io.IOException; +import java.util.Locale; import static org.junit.jupiter.api.Assertions.fail; @@ -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 {