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

Add constants for test suite naming + make base classes abstract #49

Merged
merged 1 commit into from
Jan 9, 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
16 changes: 16 additions & 0 deletions src/main/java/io/odh/test/TestSuite.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* 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;

public class TestSuite {
public static final String SMOKE = "smoke";
public static final String UPGRADE = "upgrade";
public static final String STANDARD = "standard";
public static final String CONTINUOUS = "continuous";
public static final String UNIT = "unit";

private TestSuite() {
}
}
2 changes: 1 addition & 1 deletion src/test/java/io/odh/test/e2e/Abstract.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@ExtendWith(TestExceptionCallbackListener.class)
@ExtendWith(ResourceManagerContextHandler.class)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class Abstract implements TestVisualSeparator {
public abstract class Abstract implements TestVisualSeparator {

static {
ResourceManager.getInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.odh.test.OdhConstants;
import io.odh.test.TestSuite;
import io.odh.test.e2e.Abstract;
import io.odh.test.framework.manager.ResourceManager;
import io.odh.test.framework.manager.resources.DataScienceClusterResource;
Expand All @@ -31,7 +32,7 @@
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

@Tag("continuous")
@Tag(TestSuite.CONTINUOUS)
public class DataScienceClusterST extends Abstract {

private static final String DS_CLUSTER_NAME = "default";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import io.fabric8.kubernetes.api.model.KubernetesResourceList;
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.odh.test.TestSuite;
import io.odh.test.e2e.Abstract;
import io.odh.test.framework.manager.ResourceManager;
import io.odh.test.framework.manager.resources.NotebookResource;
Expand All @@ -25,7 +26,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

@Tag("continuous")
@Tag(TestSuite.CONTINUOUS)
public class DataScienceProjectST extends Abstract {
static final Logger LOGGER = LoggerFactory.getLogger(DataScienceProjectST.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
package io.odh.test.e2e.standard;

import io.odh.test.TestSuite;
import io.odh.test.framework.manager.ResourceManager;
import io.odh.test.framework.manager.resources.DataScienceClusterResource;
import io.opendatahub.datasciencecluster.v1.DataScienceCluster;
Expand All @@ -24,7 +25,7 @@

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

@Tag("smoke")
@Tag(TestSuite.SMOKE)
public class DataScienceClusterST extends StandardAbstract {

private static final String DS_PROJECT_NAME = "test-dsp";
Expand Down
5 changes: 3 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 @@ -5,6 +5,7 @@
package io.odh.test.e2e.standard;

import io.odh.test.Environment;
import io.odh.test.TestSuite;
import io.odh.test.e2e.Abstract;
import io.odh.test.framework.listeners.OdhResourceCleaner;
import io.odh.test.framework.listeners.ResourceManagerDeleteHandler;
Expand All @@ -24,10 +25,10 @@

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

@Tag("standard")
@Tag(TestSuite.STANDARD)
@ExtendWith(OdhResourceCleaner.class)
@ExtendWith(ResourceManagerDeleteHandler.class)
public class StandardAbstract extends Abstract {
public abstract class StandardAbstract extends Abstract {

private static final Logger LOGGER = LoggerFactory.getLogger(StandardAbstract.class);

Expand Down
2 changes: 0 additions & 2 deletions src/test/java/io/odh/test/e2e/upgrade/BundleUpgradeST.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@
import io.odh.test.utils.PodUtils;
import io.odh.test.utils.UpgradeUtils;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.Map;

@Tag("upgrade")
public class BundleUpgradeST extends UpgradeAbstract {

private static final Logger LOGGER = LoggerFactory.getLogger(BundleUpgradeST.class);
Expand Down
2 changes: 0 additions & 2 deletions src/test/java/io/odh/test/e2e/upgrade/OlmUpgradeST.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@
import io.odh.test.utils.PodUtils;
import io.odh.test.utils.UpgradeUtils;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.Map;

@Tag("upgrade")
public class OlmUpgradeST extends UpgradeAbstract {

private static final Logger LOGGER = LoggerFactory.getLogger(OlmUpgradeST.class);
Expand Down
5 changes: 4 additions & 1 deletion src/test/java/io/odh/test/e2e/upgrade/UpgradeAbstract.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import io.fabric8.kubernetes.api.model.Quantity;
import io.odh.test.Environment;
import io.odh.test.OdhAnnotationsLabels;
import io.odh.test.TestSuite;
import io.odh.test.e2e.Abstract;
import io.odh.test.framework.listeners.OdhResourceCleaner;
import io.odh.test.framework.listeners.ResourceManagerDeleteHandler;
Expand All @@ -31,16 +32,18 @@
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.ModelmeshservingBuilder;
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.Workbenches;
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.WorkbenchesBuilder;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.extension.ExtendWith;
import org.kubeflow.v1.Notebook;
import org.kubeflow.v1.NotebookBuilder;
import org.kubeflow.v1.notebookspec.template.spec.containers.EnvBuilder;

import java.io.IOException;

@Tag(TestSuite.UPGRADE)
@ExtendWith(OdhResourceCleaner.class)
@ExtendWith(ResourceManagerDeleteHandler.class)
public class UpgradeAbstract extends Abstract {
public abstract class UpgradeAbstract extends Abstract {

protected void deployDsc(String name) {
// Deploy DSC
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/io/odh/test/unit/UnitTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer;
import io.odh.test.TestSuite;
import io.odh.test.framework.ExtensionContextParameterResolver;
import io.odh.test.framework.listeners.TestVisualSeparator;
import io.opendatahub.datasciencecluster.v1.DataScienceCluster;
Expand All @@ -27,7 +28,7 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;

@Tag("unit")
@Tag(TestSuite.UNIT)
@ExtendWith(ExtensionContextParameterResolver.class)
@EnableKubernetesMockClient(crud = true)
public class UnitTests implements TestVisualSeparator {
Expand Down
Loading