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

Added a check for Uninstall scenario #80

Merged
merged 3 commits into from
Feb 1, 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
2 changes: 2 additions & 0 deletions src/main/java/io/odh/test/OdhConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ private OdhConstants() { }
private static final String RHOAI_CONTROLLERS_NAMESPACE = "redhat-ods-applications";
private static final String RHOAI_DASHBOARD_ROUTE_NAME = "rhods-dashboard";
private static final String RHOAI_DASHBOARD_CONTROLLER = "rhods-dashboard";
private static final String RHOAI_NOTEBOOKS_NAMESPACE = "rhods-notebooks";
private static final String RHOAI_DSCI_NAME = "default-dsci";
// RHOAI OLM
private static final String RHOAI_OLM_OPERATOR_NAME = "rhods-operator";
Expand Down Expand Up @@ -68,6 +69,7 @@ private OdhConstants() { }
public static final String CONTROLLERS_NAMESPACE = getOdhOrRhoai("CONTROLLERS_NAMESPACE", ODH_CONTROLLERS_NAMESPACE, RHOAI_CONTROLLERS_NAMESPACE);
public static final String DASHBOARD_ROUTE_NAME = getOdhOrRhoai("DASHBOARD_ROUTE_NAME", ODH_DASHBOARD_ROUTE_NAME, RHOAI_DASHBOARD_ROUTE_NAME);
public static final String DASHBOARD_CONTROLLER = getOdhOrRhoai("DASHBOARD_CONTROLLER", ODH_DASHBOARD_CONTROLLER, RHOAI_DASHBOARD_CONTROLLER);
public static final String NOTEBOOKS_NAMESPACE = getOdhOrRhoai("NOTEBOOKS_NAMESPACE", ODH_CONTROLLERS_NAMESPACE, RHOAI_NOTEBOOKS_NAMESPACE);
public static final String BUNDLE_OPERATOR_NAMESPACE = getOdhOrRhoai("BUNDLE_OPERATOR_NAMESPACE", ODH_BUNDLE_OPERATOR_NAME, RHOAI_OLM_OPERATOR_NAME);
public static final String DEFAULT_DSCI_NAME = getOdhOrRhoai("DSCI_NAME", ODH_DSCI_NAME, RHOAI_DSCI_NAME);
public static final String MONITORING_NAMESPACE = getOdhOrRhoai("MONITORING_NAMESPACE", ODH_MONITORING_NAMESPACE, RHOAI_MONITORING_NAMESPACE);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/odh/test/platform/KubeClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public String getKubeconfigPath() {
}

// ==================================================
// ---------> Create/read multi-resoruces <---------
// ---------> Create/read multi-resources <---------
// ==================================================
public void create(String namespace, InputStream is, Function<HasMetadata, HasMetadata> modifier) throws IOException {
try (is) {
Expand Down
95 changes: 95 additions & 0 deletions src/main/java/io/odh/test/utils/DscUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
* 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.utils;

import io.odh.test.OdhConstants;
import io.odh.test.framework.manager.requirements.ServiceMeshOperator;
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.Modelmeshserving;
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.ModelmeshservingBuilder;
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.Ray;
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.RayBuilder;
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.Trustyai;
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.TrustyaiBuilder;
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.Workbenches;
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.WorkbenchesBuilder;
import io.opendatahub.dscinitialization.v1.DSCInitialization;
import io.opendatahub.dscinitialization.v1.DSCInitializationBuilder;
import io.opendatahub.dscinitialization.v1.dscinitializationspec.Monitoring;
import io.opendatahub.dscinitialization.v1.dscinitializationspec.ServiceMesh;
import io.opendatahub.dscinitialization.v1.dscinitializationspec.servicemesh.ControlPlane;

public class DscUtils {

public static DSCInitialization getBasicDSCI() {
return new DSCInitializationBuilder()
.withNewMetadata()
.withName(OdhConstants.DEFAULT_DSCI_NAME)
.endMetadata()
.withNewSpec()
.withApplicationsNamespace(OdhConstants.CONTROLLERS_NAMESPACE)
.withNewMonitoring()
.withManagementState(Monitoring.ManagementState.MANAGED)
.withNamespace(OdhConstants.MONITORING_NAMESPACE)
.endMonitoring()
.withNewServiceMesh()
.withManagementState(ServiceMesh.ManagementState.MANAGED)
.withNewControlPlane()
.withName(ServiceMeshOperator.SERVICE_MESH_NAME)
.withNamespace(ServiceMeshOperator.SERVICE_MESH_NAMESPACE)
.withMetricsCollection(ControlPlane.MetricsCollection.ISTIO)
.endControlPlane()
.endServiceMesh()
.endSpec()
.build();
}

public static DataScienceCluster getBasicDSC(String dsProjectName) {
return 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.MANAGED).build()
)
.withCodeflare(
new CodeflareBuilder().withManagementState(Codeflare.ManagementState.MANAGED).build()
)
.withDatasciencepipelines(
new DatasciencepipelinesBuilder().withManagementState(Datasciencepipelines.ManagementState.MANAGED).build()
)
.withModelmeshserving(
new ModelmeshservingBuilder().withManagementState(Modelmeshserving.ManagementState.MANAGED).build()
)
.withRay(
new RayBuilder().withManagementState(Ray.ManagementState.MANAGED).build()
)
.withTrustyai(
new TrustyaiBuilder().withManagementState(Trustyai.ManagementState.MANAGED).build()
)
.build())
.endSpec()
.build();
}
}
75 changes: 5 additions & 70 deletions src/test/java/io/odh/test/e2e/standard/DataScienceClusterST.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,20 @@
*/
package io.odh.test.e2e.standard;

import io.odh.test.OdhConstants;
import io.odh.test.TestSuite;
import io.odh.test.framework.manager.ResourceManager;
import io.odh.test.framework.manager.requirements.ServiceMeshOperator;
import io.odh.test.framework.manager.resources.DataScienceClusterResource;
import io.odh.test.utils.DscUtils;
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.Modelmeshserving;
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.ModelmeshservingBuilder;
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.Ray;
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.RayBuilder;
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.Trustyai;
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.TrustyaiBuilder;
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.Workbenches;
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.WorkbenchesBuilder;
import io.opendatahub.dscinitialization.v1.DSCInitialization;
import io.opendatahub.dscinitialization.v1.DSCInitializationBuilder;
import io.opendatahub.dscinitialization.v1.dscinitializationspec.Monitoring;
import io.opendatahub.dscinitialization.v1.dscinitializationspec.ServiceMesh;
import io.opendatahub.dscinitialization.v1.dscinitializationspec.servicemesh.ControlPlane;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

Expand All @@ -45,61 +30,11 @@ public class DataScienceClusterST extends StandardAbstract {

@Test
void createDataScienceCluster() {
DSCInitialization dsci = new DSCInitializationBuilder()
.withNewMetadata()
.withName(OdhConstants.DEFAULT_DSCI_NAME)
.endMetadata()
.withNewSpec()
.withApplicationsNamespace(OdhConstants.CONTROLLERS_NAMESPACE)
.withNewMonitoring()
.withManagementState(Monitoring.ManagementState.MANAGED)
.withNamespace(OdhConstants.MONITORING_NAMESPACE)
.endMonitoring()
.withNewServiceMesh()
.withManagementState(ServiceMesh.ManagementState.MANAGED)
.withNewControlPlane()
.withName(ServiceMeshOperator.SERVICE_MESH_NAME)
.withNamespace(ServiceMeshOperator.SERVICE_MESH_NAMESPACE)
.withMetricsCollection(ControlPlane.MetricsCollection.ISTIO)
.endControlPlane()
.endServiceMesh()
.endSpec()
.build();

DataScienceCluster c = new DataScienceClusterBuilder()
.withNewMetadata()
.withName(DS_PROJECT_NAME)
.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.MANAGED).build()
)
.withCodeflare(
new CodeflareBuilder().withManagementState(Codeflare.ManagementState.MANAGED).build()
)
.withDatasciencepipelines(
new DatasciencepipelinesBuilder().withManagementState(Datasciencepipelines.ManagementState.MANAGED).build()
)
.withModelmeshserving(
new ModelmeshservingBuilder().withManagementState(Modelmeshserving.ManagementState.MANAGED).build()
)
.withRay(
new RayBuilder().withManagementState(Ray.ManagementState.MANAGED).build()
)
.withTrustyai(
new TrustyaiBuilder().withManagementState(Trustyai.ManagementState.MANAGED).build()
)
.build())
.endSpec()
.build();
// Create DSCI
DSCInitialization dsci = DscUtils.getBasicDSCI();
// Create DSC
DataScienceCluster c = DscUtils.getBasicDSC(DS_PROJECT_NAME);

ResourceManager.getInstance().createResourceWithWait(dsci);
ResourceManager.getInstance().createResourceWithWait(c);
Expand Down
28 changes: 2 additions & 26 deletions src/test/java/io/odh/test/e2e/standard/NotebookST.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
import io.fabric8.kubernetes.api.model.PersistentVolumeClaimBuilder;
import io.fabric8.kubernetes.api.model.Quantity;
import io.odh.test.OdhAnnotationsLabels;
import io.odh.test.OdhConstants;
import io.odh.test.framework.manager.ResourceManager;
import io.odh.test.framework.manager.requirements.ServiceMeshOperator;
import io.odh.test.framework.manager.resources.NotebookResource;
import io.odh.test.utils.DscUtils;
import io.odh.test.utils.PodUtils;
import io.opendatahub.datasciencecluster.v1.DataScienceCluster;
import io.opendatahub.datasciencecluster.v1.DataScienceClusterBuilder;
Expand All @@ -37,10 +36,6 @@
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.Workbenches;
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.WorkbenchesBuilder;
import io.opendatahub.dscinitialization.v1.DSCInitialization;
import io.opendatahub.dscinitialization.v1.DSCInitializationBuilder;
import io.opendatahub.dscinitialization.v1.dscinitializationspec.Monitoring;
import io.opendatahub.dscinitialization.v1.dscinitializationspec.ServiceMesh;
import io.opendatahub.dscinitialization.v1.dscinitializationspec.servicemesh.ControlPlane;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.kubeflow.v1.Notebook;
Expand Down Expand Up @@ -97,26 +92,7 @@ void testCreateSimpleNotebook() throws IOException {
@BeforeAll
void deployDataScienceCluster() {
// Create DSCI
DSCInitialization dsci = new DSCInitializationBuilder()
.withNewMetadata()
.withName(OdhConstants.DEFAULT_DSCI_NAME)
.endMetadata()
.withNewSpec()
.withApplicationsNamespace(OdhConstants.CONTROLLERS_NAMESPACE)
.withNewMonitoring()
.withManagementState(Monitoring.ManagementState.MANAGED)
.withNamespace(OdhConstants.MONITORING_NAMESPACE)
.endMonitoring()
.withNewServiceMesh()
.withManagementState(ServiceMesh.ManagementState.MANAGED)
.withNewControlPlane()
.withName(ServiceMeshOperator.SERVICE_MESH_NAME)
.withNamespace(ServiceMeshOperator.SERVICE_MESH_NAMESPACE)
.withMetricsCollection(ControlPlane.MetricsCollection.ISTIO)
.endControlPlane()
.endServiceMesh()
.endSpec()
.build();
DSCInitialization dsci = DscUtils.getBasicDSCI();

// Create DSC
DataScienceCluster dsc = new DataScienceClusterBuilder()
Expand Down
Loading
Loading