Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Precreate namespace for RHOAI operator #44

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading