Skip to content

Commit

Permalink
Use better check for upgrade rediness in bundle upgrade (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
kornys authored Dec 8, 2023
1 parent d37d83f commit af54832
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
11 changes: 11 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,17 @@
</groups>
</properties>
</profile>

<profile>
<id>all</id>
<properties>
<it.skip>false</it.skip>
<groups>
standard,
upgrade
</groups>
</properties>
</profile>
</profiles>

</project>
2 changes: 2 additions & 0 deletions src/test/java/io/odh/test/e2e/standard/StandardAbstract.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import io.odh.test.install.OlmInstall;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.extension.ExtendWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -22,6 +23,7 @@

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

@Tag("standard")
@ExtendWith(OdhResourceCleaner.class)
@ExtendWith(ResourceManagerDeleteHandler.class)
public class StandardAbstract extends Abstract {
Expand Down
22 changes: 21 additions & 1 deletion src/test/java/io/odh/test/e2e/upgrade/BundleUpgradeST.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
import io.fabric8.kubernetes.api.model.Quantity;
import io.odh.test.Environment;
import io.odh.test.OdhAnnotationsLabels;
import io.odh.test.OdhConstants;
import io.odh.test.TestConstants;
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.DeploymentUtils;
import io.odh.test.utils.PodUtils;
import io.opendatahub.datasciencecluster.v1.DataScienceCluster;
import io.opendatahub.datasciencecluster.v1.DataScienceClusterBuilder;
Expand All @@ -45,6 +48,10 @@
import java.io.IOException;
import java.util.Map;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.core.IsNot.not;

@Tag("upgrade")
@ExtendWith(OdhResourceCleaner.class)
@ExtendWith(ResourceManagerDeleteHandler.class)
Expand All @@ -68,6 +75,8 @@ void testUpgradeBundle() throws IOException {
baseBundle = new BundleInstall(Environment.INSTALL_FILE_PREVIOUS_PATH);
baseBundle.createWithoutResourceManager();

Map<String, String> operatorSnapshot = DeploymentUtils.depSnapshot(baseBundle.getNamespace(), baseBundle.getDeploymentName());

String dsProjectName = "test-notebooks-upgrade";
String ntbName = "test-odh-notebook";
String ntbNamespace = "test-odh-notebook-upgrade";
Expand Down Expand Up @@ -138,6 +147,17 @@ void testUpgradeBundle() throws IOException {
upgradeBundle = new BundleInstall(Environment.INSTALL_FILE_PATH);
upgradeBundle.createWithoutResourceManager();

PodUtils.waitForPodsReady(ntbNamespace, lblSelector, 1, true, () -> { });
DeploymentUtils.waitTillDepHasRolled(baseBundle.getNamespace(), baseBundle.getDeploymentName(), operatorSnapshot);

LabelSelector labelSelector = ResourceManager.getClient().getDeployment(TestConstants.ODH_NAMESPACE, OdhConstants.ODH_DASHBOARD).getSpec().getSelector();
PodUtils.verifyThatPodsAreStable(TestConstants.ODH_NAMESPACE, labelSelector);

// Check that operator doesn't contain errors in logs
String operatorLog = ResourceManager.getClient().getClient().apps().deployments()
.inNamespace(baseBundle.getNamespace()).withName(baseBundle.getDeploymentName()).getLog();

assertThat(operatorLog, not(containsString("error")));
assertThat(operatorLog, not(containsString("Error")));
assertThat(operatorLog, not(containsString("ERROR")));
}
}

0 comments on commit af54832

Please sign in to comment.