diff --git a/src/main/java/io/odh/test/framework/OdhResourceCleaner.java b/src/main/java/io/odh/test/framework/listeners/OdhResourceCleaner.java similarity index 68% rename from src/main/java/io/odh/test/framework/OdhResourceCleaner.java rename to src/main/java/io/odh/test/framework/listeners/OdhResourceCleaner.java index 6b03a9b8..0bf3c4bf 100644 --- a/src/main/java/io/odh/test/framework/OdhResourceCleaner.java +++ b/src/main/java/io/odh/test/framework/listeners/OdhResourceCleaner.java @@ -2,20 +2,14 @@ * Copyright Skodjob authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ -package io.odh.test.framework; +package io.odh.test.framework.listeners; import io.odh.test.platform.KubeUtils; import org.junit.jupiter.api.extension.AfterAllCallback; import org.junit.jupiter.api.extension.ExtensionContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class OdhResourceCleaner implements AfterAllCallback { - static final Logger LOGGER = LoggerFactory.getLogger(OdhResourceCleaner.class); - - static final String SEPARATOR_CHAR = "#"; - @Override public void afterAll(ExtensionContext extensionContext) { KubeUtils.clearOdhCRDs(); diff --git a/src/main/java/io/odh/test/framework/TestCallbackListener.java b/src/main/java/io/odh/test/framework/listeners/ResourceManagerContextHandler.java similarity index 55% rename from src/main/java/io/odh/test/framework/TestCallbackListener.java rename to src/main/java/io/odh/test/framework/listeners/ResourceManagerContextHandler.java index 4efddb4b..c3ccf9c7 100644 --- a/src/main/java/io/odh/test/framework/TestCallbackListener.java +++ b/src/main/java/io/odh/test/framework/listeners/ResourceManagerContextHandler.java @@ -2,7 +2,7 @@ * Copyright Skodjob authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ -package io.odh.test.framework; +package io.odh.test.framework.listeners; import io.odh.test.framework.manager.ResourceManager; import org.junit.jupiter.api.extension.AfterAllCallback; @@ -10,19 +10,11 @@ import org.junit.jupiter.api.extension.BeforeAllCallback; import org.junit.jupiter.api.extension.BeforeEachCallback; import org.junit.jupiter.api.extension.ExtensionContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Collections; /** * jUnit5 specific class which listening on test callbacks */ -public class TestCallbackListener implements BeforeAllCallback, BeforeEachCallback, AfterAllCallback, AfterEachCallback { - - static final Logger LOGGER = LoggerFactory.getLogger(TestCallbackListener.class); - - static final String SEPARATOR_CHAR = "#"; +public class ResourceManagerContextHandler implements BeforeAllCallback, BeforeEachCallback, AfterAllCallback, AfterEachCallback { @Override public void beforeAll(ExtensionContext extensionContext) throws Exception { @@ -31,24 +23,16 @@ public void beforeAll(ExtensionContext extensionContext) throws Exception { @Override public void beforeEach(ExtensionContext extensionContext) throws Exception { - LOGGER.info(String.join("", Collections.nCopies(76, SEPARATOR_CHAR))); - LOGGER.info(String.format("%s.%s-STARTED", extensionContext.getRequiredTestClass().getName(), - extensionContext.getDisplayName().replace("()", ""))); ResourceManager.getInstance().switchToTestResourceStack(); } @Override public void afterAll(ExtensionContext extensionContext) throws Exception { ResourceManager.getInstance().switchToClassResourceStack(); - ResourceManager.getInstance().deleteResources(); } @Override public void afterEach(ExtensionContext extensionContext) throws Exception { - LOGGER.info(String.format("%s.%s-FINISHED", extensionContext.getRequiredTestClass().getName(), - extensionContext.getDisplayName().replace("()", ""))); - LOGGER.info(String.join("", Collections.nCopies(76, SEPARATOR_CHAR))); ResourceManager.getInstance().switchToTestResourceStack(); - ResourceManager.getInstance().deleteResources(); } } diff --git a/src/main/java/io/odh/test/framework/listeners/ResourceManagerDeleteHandler.java b/src/main/java/io/odh/test/framework/listeners/ResourceManagerDeleteHandler.java new file mode 100644 index 00000000..57a896f8 --- /dev/null +++ b/src/main/java/io/odh/test/framework/listeners/ResourceManagerDeleteHandler.java @@ -0,0 +1,27 @@ +/* + * Copyright Skodjob authors. + * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). + */ +package io.odh.test.framework.listeners; + +import io.odh.test.framework.manager.ResourceManager; +import org.junit.jupiter.api.extension.AfterAllCallback; +import org.junit.jupiter.api.extension.AfterEachCallback; +import org.junit.jupiter.api.extension.ExtensionContext; + +/** + * jUnit5 specific class which listening on test callbacks + */ +public class ResourceManagerDeleteHandler implements AfterAllCallback, AfterEachCallback { + @Override + public void afterAll(ExtensionContext extensionContext) throws Exception { + ResourceManager.getInstance().switchToClassResourceStack(); + ResourceManager.getInstance().deleteResources(); + } + + @Override + public void afterEach(ExtensionContext extensionContext) throws Exception { + ResourceManager.getInstance().switchToTestResourceStack(); + ResourceManager.getInstance().deleteResources(); + } +} diff --git a/src/main/java/io/odh/test/framework/TestExceptionCallbackListener.java b/src/main/java/io/odh/test/framework/listeners/TestExceptionCallbackListener.java similarity index 98% rename from src/main/java/io/odh/test/framework/TestExceptionCallbackListener.java rename to src/main/java/io/odh/test/framework/listeners/TestExceptionCallbackListener.java index b552742e..b6ac9ec8 100644 --- a/src/main/java/io/odh/test/framework/TestExceptionCallbackListener.java +++ b/src/main/java/io/odh/test/framework/listeners/TestExceptionCallbackListener.java @@ -2,7 +2,7 @@ * Copyright Skodjob authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ -package io.odh.test.framework; +package io.odh.test.framework.listeners; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.LifecycleMethodExecutionExceptionHandler; diff --git a/src/main/java/io/odh/test/framework/TestPlanExecutionListener.java b/src/main/java/io/odh/test/framework/listeners/TestPlanExecutionListener.java similarity index 97% rename from src/main/java/io/odh/test/framework/TestPlanExecutionListener.java rename to src/main/java/io/odh/test/framework/listeners/TestPlanExecutionListener.java index 8c9d9ed6..6e29693e 100644 --- a/src/main/java/io/odh/test/framework/TestPlanExecutionListener.java +++ b/src/main/java/io/odh/test/framework/listeners/TestPlanExecutionListener.java @@ -2,7 +2,7 @@ * Copyright Skodjob authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ -package io.odh.test.framework; +package io.odh.test.framework.listeners; import io.odh.test.Environment; import org.junit.platform.launcher.TestExecutionListener; diff --git a/src/main/java/io/odh/test/framework/listeners/TestVisualSeparator.java b/src/main/java/io/odh/test/framework/listeners/TestVisualSeparator.java new file mode 100644 index 00000000..f8a12bc8 --- /dev/null +++ b/src/main/java/io/odh/test/framework/listeners/TestVisualSeparator.java @@ -0,0 +1,33 @@ +/* + * Copyright Skodjob authors. + * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). + */ +package io.odh.test.framework.listeners; + +import io.odh.test.framework.ExtensionContextParameterResolver; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Collections; + +@ExtendWith(ExtensionContextParameterResolver.class) +public interface TestVisualSeparator { + Logger LOGGER = LoggerFactory.getLogger(TestVisualSeparator.class); + String SEPARATOR_CHAR = "#"; + + @BeforeEach + default void beforeEachTest(ExtensionContext testContext) { + LOGGER.info(String.join("", Collections.nCopies(76, SEPARATOR_CHAR))); + LOGGER.info(String.format("%s.%s-STARTED", testContext.getRequiredTestClass().getName(), testContext.getDisplayName())); + } + + @AfterEach + default void afterEachTest(ExtensionContext testContext) { + LOGGER.info(String.format("%s.%s-FINISHED", testContext.getRequiredTestClass().getName(), testContext.getDisplayName())); + LOGGER.info(String.join("", Collections.nCopies(76, SEPARATOR_CHAR))); + } +} diff --git a/src/main/java/io/odh/test/framework/manager/resources/NamespaceResource.java b/src/main/java/io/odh/test/framework/manager/resources/NamespaceResource.java index b0ed6250..841b9635 100644 --- a/src/main/java/io/odh/test/framework/manager/resources/NamespaceResource.java +++ b/src/main/java/io/odh/test/framework/manager/resources/NamespaceResource.java @@ -23,7 +23,11 @@ public Namespace get(String namespace, String name) { @Override public void create(Namespace resource) { - ResourceManager.getClient().getClient().resource(resource).create(); + if (get("", resource.getMetadata().getName()) != null) { + ResourceManager.getClient().getClient().resource(resource).update(); + } else { + ResourceManager.getClient().getClient().resource(resource).create(); + } } @Override diff --git a/src/main/java/io/odh/test/install/BundleInstall.java b/src/main/java/io/odh/test/install/BundleInstall.java index 34633346..72a58c24 100644 --- a/src/main/java/io/odh/test/install/BundleInstall.java +++ b/src/main/java/io/odh/test/install/BundleInstall.java @@ -16,6 +16,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; @@ -26,13 +27,16 @@ public class BundleInstall { private static final Logger LOGGER = LoggerFactory.getLogger(BundleInstall.class); List resources; + File installFile; public BundleInstall(String installFilePath) throws IOException { InputStream is; if (installFilePath.equals(TestConstants.LATEST_BUNDLE_DEPLOY_FILE) || installFilePath.equals(TestConstants.RELEASED_BUNDLE_DEPLOY_FILE)) { + installFile = new File("src/main/resources/" + installFilePath); is = TestUtils.getFileFromResourceAsStream(installFilePath); } else { + installFile = new File(installFilePath); is = new FileInputStream(installFilePath); } resources = ResourceManager.getClient().readResourcesFromYaml(is); @@ -51,6 +55,12 @@ public String getDeploymentName() { return resources.stream().filter(r -> r instanceof Deployment).findFirst().get().getMetadata().getName(); } + public String getDeploymentImage() { + return ((Deployment) resources.stream().filter(r -> r instanceof Deployment).findFirst().get()) + .getSpec().getTemplate().getSpec().getContainers() + .stream().filter(c -> c.getName().equals("manager")).findFirst().get().getImage(); + } + public void printResources() { resources.forEach(r -> { LOGGER.info("Kind: {}, Name: {}", r.getKind(), r.getMetadata().getName()); @@ -61,4 +71,13 @@ public void create() { ResourceManager.getInstance().createResourceWithWait(resources.toArray(new HasMetadata[0])); ResourceManager.getInstance().pushToStack(new ResourceItem(KubeUtils::deleteDefaultDSCI, null)); } + + public void createWithoutResourceManager() throws IOException { + ResourceManager.getKubeCmdClient().namespace(getNamespace()).apply(installFile.getAbsolutePath()); + } + + public void deleteWithoutResourceManager() throws IOException { + KubeUtils.deleteDefaultDSCI(); + ResourceManager.getKubeCmdClient().namespace(getNamespace()).delete(installFile.getAbsolutePath()); + } } diff --git a/src/main/java/io/odh/test/platform/KubeUtils.java b/src/main/java/io/odh/test/platform/KubeUtils.java index 32345795..ad8c9645 100644 --- a/src/main/java/io/odh/test/platform/KubeUtils.java +++ b/src/main/java/io/odh/test/platform/KubeUtils.java @@ -36,7 +36,7 @@ public static void clearOdhCRDs() { */ public static void deleteDefaultDSCI() { LOGGER.info("Clearing DSCI ..."); - ResourceManager.getKubeCmdClient().exec("delete", "dsci", "--all"); + ResourceManager.getKubeCmdClient().exec(false, "delete", "dsci", "--all"); } private KubeUtils() { diff --git a/src/main/java/io/odh/test/platform/cmdClient/BaseCmdKubeClient.java b/src/main/java/io/odh/test/platform/cmdClient/BaseCmdKubeClient.java index 0b75c69b..456f74be 100644 --- a/src/main/java/io/odh/test/platform/cmdClient/BaseCmdKubeClient.java +++ b/src/main/java/io/odh/test/platform/cmdClient/BaseCmdKubeClient.java @@ -169,7 +169,7 @@ public K replace(File... files) { @Override @SuppressWarnings("unchecked") - public K applyContent(String yamlContent) { + public K applyContentInNamespace(String yamlContent) { try (Context context = defaultContext()) { Exec.exec(yamlContent, namespacedCommand(APPLY, "-f", "-")); return (K) this; @@ -178,13 +178,31 @@ public K applyContent(String yamlContent) { @Override @SuppressWarnings("unchecked") - public K deleteContent(String yamlContent) { + public K deleteContentInNamespace(String yamlContent) { try (Context context = defaultContext()) { Exec.exec(yamlContent, namespacedCommand(DELETE, "-f", "-"), 0, true, false); return (K) this; } } + @Override + @SuppressWarnings("unchecked") + public K applyContent(String yamlContent) { + try (Context context = defaultContext()) { + Exec.exec(yamlContent, command(Arrays.asList(APPLY, "-f", "-"), false), 0, true, true); + return (K) this; + } + } + + @Override + @SuppressWarnings("unchecked") + public K deleteContent(String yamlContent) { + try (Context context = defaultContext()) { + Exec.exec(yamlContent, command(Arrays.asList(DELETE, "-f", "-"), false), 0, true, false); + return (K) this; + } + } + @Override @SuppressWarnings("unchecked") public K createNamespace(String name) { @@ -297,7 +315,7 @@ public void createResourceAndApply(String template, Map params) } String yaml = Exec.exec(cmd).out(); - applyContent(yaml); + applyContentInNamespace(yaml); } @Override diff --git a/src/main/java/io/odh/test/platform/cmdClient/KubeCmdClient.java b/src/main/java/io/odh/test/platform/cmdClient/KubeCmdClient.java index c7e077ec..96f01e9d 100644 --- a/src/main/java/io/odh/test/platform/cmdClient/KubeCmdClient.java +++ b/src/main/java/io/odh/test/platform/cmdClient/KubeCmdClient.java @@ -70,6 +70,10 @@ default K delete(String... files) { */ K replace(File... files); + K applyContentInNamespace(String yamlContent); + + K deleteContentInNamespace(String yamlContent); + K applyContent(String yamlContent); K deleteContent(String yamlContent); diff --git a/src/test/java/io/odh/test/e2e/Abstract.java b/src/test/java/io/odh/test/e2e/Abstract.java index 6a69f105..3bf9d7b1 100644 --- a/src/test/java/io/odh/test/e2e/Abstract.java +++ b/src/test/java/io/odh/test/e2e/Abstract.java @@ -4,10 +4,10 @@ */ package io.odh.test.e2e; -import io.odh.test.framework.ExtensionContextParameterResolver; -import io.odh.test.framework.TestCallbackListener; +import io.odh.test.framework.listeners.ResourceManagerContextHandler; +import io.odh.test.framework.listeners.TestVisualSeparator; import io.odh.test.framework.manager.ResourceManager; -import io.odh.test.framework.TestExceptionCallbackListener; +import io.odh.test.framework.listeners.TestExceptionCallbackListener; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; import org.junit.jupiter.api.TestInstance; @@ -15,10 +15,9 @@ @DisplayNameGeneration(DisplayNameGenerator.IndicativeSentences.class) @ExtendWith(TestExceptionCallbackListener.class) -@ExtendWith(TestCallbackListener.class) -@ExtendWith(ExtensionContextParameterResolver.class) +@ExtendWith(ResourceManagerContextHandler.class) @TestInstance(TestInstance.Lifecycle.PER_CLASS) -public class Abstract { +public class Abstract implements TestVisualSeparator { static { ResourceManager.getInstance(); diff --git a/src/test/java/io/odh/test/e2e/standard/NotebookST.java b/src/test/java/io/odh/test/e2e/standard/NotebookST.java index ae1267dd..3e473986 100644 --- a/src/test/java/io/odh/test/e2e/standard/NotebookST.java +++ b/src/test/java/io/odh/test/e2e/standard/NotebookST.java @@ -39,7 +39,6 @@ public class NotebookST extends StandardAbstract { private static final String DS_PROJECT_NAME = "test-notebooks"; - private static final String DS_PROJECT_NAMESPACE = "test-notebooks"; private static final String NTB_NAME = "test-odh-notebook"; private static final String NTB_NAMESPACE = "test-odh-notebook"; @@ -84,10 +83,6 @@ void testCreateSimpleNotebook() throws IOException { @BeforeAll void deployDataScienceCluster() { - // Create namespace - Namespace ns = new NamespaceBuilder().withNewMetadata().withName(DS_PROJECT_NAMESPACE).endMetadata().build(); - ResourceManager.getInstance().createResourceWithoutWait(ns); - // Create DSC DataScienceCluster dsc = new DataScienceClusterBuilder() .withNewMetadata() 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 87363e5a..3299b186 100644 --- a/src/test/java/io/odh/test/e2e/standard/StandardAbstract.java +++ b/src/test/java/io/odh/test/e2e/standard/StandardAbstract.java @@ -6,7 +6,8 @@ import io.odh.test.Environment; import io.odh.test.e2e.Abstract; -import io.odh.test.framework.OdhResourceCleaner; +import io.odh.test.framework.listeners.OdhResourceCleaner; +import io.odh.test.framework.listeners.ResourceManagerDeleteHandler; import io.odh.test.framework.manager.ResourceManager; import io.odh.test.install.BundleInstall; import io.odh.test.install.InstallTypes; @@ -22,6 +23,7 @@ import static org.junit.jupiter.api.Assertions.fail; @ExtendWith(OdhResourceCleaner.class) +@ExtendWith(ResourceManagerDeleteHandler.class) public class StandardAbstract extends Abstract { private static final Logger LOGGER = LoggerFactory.getLogger(Abstract.class); diff --git a/src/test/java/io/odh/test/e2e/standard/UpgradeST.java b/src/test/java/io/odh/test/e2e/standard/UpgradeST.java deleted file mode 100644 index cad6f897..00000000 --- a/src/test/java/io/odh/test/e2e/standard/UpgradeST.java +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright Skodjob authors. - * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). - */ -package io.odh.test.e2e.standard; - -import org.junit.jupiter.api.Tag; - -@Tag("upgrade") -public class UpgradeST extends StandardAbstract { -} diff --git a/src/test/java/io/odh/test/e2e/upgrade/BundleUpgradeST.java b/src/test/java/io/odh/test/e2e/upgrade/BundleUpgradeST.java new file mode 100644 index 00000000..fba015bb --- /dev/null +++ b/src/test/java/io/odh/test/e2e/upgrade/BundleUpgradeST.java @@ -0,0 +1,143 @@ +/* + * Copyright Skodjob authors. + * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). + */ +package io.odh.test.e2e.upgrade; + +import io.fabric8.kubernetes.api.model.LabelSelector; +import io.fabric8.kubernetes.api.model.LabelSelectorBuilder; +import io.fabric8.kubernetes.api.model.Namespace; +import io.fabric8.kubernetes.api.model.NamespaceBuilder; +import io.fabric8.kubernetes.api.model.PersistentVolumeClaim; +import io.fabric8.kubernetes.api.model.PersistentVolumeClaimBuilder; +import io.fabric8.kubernetes.api.model.Quantity; +import io.odh.test.Environment; +import io.odh.test.OdhAnnotationsLabels; +import io.odh.test.e2e.Abstract; +import io.odh.test.framework.listeners.OdhResourceCleaner; +import io.odh.test.framework.listeners.ResourceManagerDeleteHandler; +import io.odh.test.framework.manager.ResourceManager; +import io.odh.test.framework.manager.resources.NotebookResource; +import io.odh.test.install.BundleInstall; +import io.odh.test.utils.PodUtils; +import io.opendatahub.datasciencecluster.v1.DataScienceCluster; +import io.opendatahub.datasciencecluster.v1.DataScienceClusterBuilder; +import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.ComponentsBuilder; +import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.Codeflare; +import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.CodeflareBuilder; +import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.Dashboard; +import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.DashboardBuilder; +import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.Datasciencepipelines; +import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.DatasciencepipelinesBuilder; +import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.Kserve; +import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.KserveBuilder; +import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.Workbenches; +import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.WorkbenchesBuilder; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.kubeflow.v1.Notebook; +import org.kubeflow.v1.NotebookBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.Map; + +@Tag("upgrade") +@ExtendWith(OdhResourceCleaner.class) +@ExtendWith(ResourceManagerDeleteHandler.class) +public class BundleUpgradeST extends Abstract { + + private static final Logger LOGGER = LoggerFactory.getLogger(BundleUpgradeST.class); + + BundleInstall baseBundle; + BundleInstall upgradeBundle; + + @AfterAll + void clean() throws IOException { + if (upgradeBundle != null) { + upgradeBundle.deleteWithoutResourceManager(); + } + } + + @Test + void testUpgradeBundle() throws IOException { + LOGGER.info("Install base version"); + baseBundle = new BundleInstall(Environment.INSTALL_FILE_PREVIOUS_PATH); + baseBundle.createWithoutResourceManager(); + + String dsProjectName = "test-notebooks-upgrade"; + String ntbName = "test-odh-notebook"; + String ntbNamespace = "test-odh-notebook-upgrade"; + + DataScienceCluster dsc = new DataScienceClusterBuilder() + .withNewMetadata() + .withName(dsProjectName) + .endMetadata() + .withNewSpec() + .withComponents( + new ComponentsBuilder() + .withWorkbenches( + new WorkbenchesBuilder().withManagementState(Workbenches.ManagementState.MANAGED).build() + ) + .withDashboard( + new DashboardBuilder().withManagementState(Dashboard.ManagementState.MANAGED).build() + ) + .withKserve( + new KserveBuilder().withManagementState(Kserve.ManagementState.REMOVED).build() + ) + .withCodeflare( + new CodeflareBuilder().withManagementState(Codeflare.ManagementState.REMOVED).build() + ) + .withDatasciencepipelines( + new DatasciencepipelinesBuilder().withManagementState(Datasciencepipelines.ManagementState.REMOVED).build() + ) + .build()) + .endSpec() + .build(); + // Deploy DSC + ResourceManager.getInstance().createResourceWithWait(dsc); + + Namespace ns = new NamespaceBuilder() + .withNewMetadata() + .withName(ntbNamespace) + .addToLabels(OdhAnnotationsLabels.LABEL_DASHBOARD, "true") + .addToAnnotations(OdhAnnotationsLabels.ANNO_SERVICE_MESH, "false") + .endMetadata() + .build(); + ResourceManager.getInstance().createResourceWithoutWait(ns); + + PersistentVolumeClaim pvc = new PersistentVolumeClaimBuilder() + .withNewMetadata() + .withName(ntbName) + .withNamespace(ntbNamespace) + .addToLabels(OdhAnnotationsLabels.LABEL_DASHBOARD, "true") + .endMetadata() + .withNewSpec() + .addToAccessModes("ReadWriteOnce") + .withNewResources() + .addToRequests("storage", new Quantity("10Gi")) + .endResources() + .withVolumeMode("Filesystem") + .endSpec() + .build(); + ResourceManager.getInstance().createResourceWithoutWait(pvc); + + Notebook notebook = new NotebookBuilder(NotebookResource.loadDefaultNotebook(ntbNamespace, ntbName)).build(); + ResourceManager.getInstance().createResourceWithoutWait(notebook); + + LabelSelector lblSelector = new LabelSelectorBuilder() + .withMatchLabels(Map.of("app", ntbName)) + .build(); + + PodUtils.waitForPodsReady(ntbNamespace, lblSelector, 1, true, () -> { }); + + LOGGER.info("Upgrade to latest version"); + upgradeBundle = new BundleInstall(Environment.INSTALL_FILE_PATH); + upgradeBundle.createWithoutResourceManager(); + + PodUtils.waitForPodsReady(ntbNamespace, lblSelector, 1, true, () -> { }); + } +} diff --git a/src/test/resources/META-INF/services/org.junit.platform.launcher.TestExecutionListener b/src/test/resources/META-INF/services/org.junit.platform.launcher.TestExecutionListener index f01b84f0..3c7c9cab 100644 --- a/src/test/resources/META-INF/services/org.junit.platform.launcher.TestExecutionListener +++ b/src/test/resources/META-INF/services/org.junit.platform.launcher.TestExecutionListener @@ -1 +1 @@ -io.odh.test.framework.TestPlanExecutionListener \ No newline at end of file +io.odh.test.framework.listeners.TestPlanExecutionListener \ No newline at end of file