diff --git a/src/main/java/io/odh/test/platform/KubeClient.java b/src/main/java/io/odh/test/platform/KubeClient.java index 1ec47c22..2bdc1664 100644 --- a/src/main/java/io/odh/test/platform/KubeClient.java +++ b/src/main/java/io/odh/test/platform/KubeClient.java @@ -25,6 +25,8 @@ import io.fabric8.openshift.client.OpenShiftClient; import io.odh.test.Environment; import io.opendatahub.datasciencecluster.v1.DataScienceCluster; +import io.opendatahub.v1alpha.OdhDashboardConfig; +import org.kubeflow.v1.Notebook; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -301,5 +303,12 @@ public MixedOperation, Resource> dashboardConfigClient() { + return client.resources(OdhDashboardConfig.class); + } + + public MixedOperation, Resource> notebookClient() { + return client.resources(Notebook.class); + } } diff --git a/src/test/java/io/odh/test/e2e/continuous/DataScienceClusterIT.java b/src/test/java/io/odh/test/e2e/continuous/DataScienceClusterIT.java index 707a7d0c..0c6118b0 100644 --- a/src/test/java/io/odh/test/e2e/continuous/DataScienceClusterIT.java +++ b/src/test/java/io/odh/test/e2e/continuous/DataScienceClusterIT.java @@ -19,27 +19,33 @@ import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.Ray; import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.Trustyai; import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.Workbenches; +import io.opendatahub.v1alpha.OdhDashboardConfig; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; @Tag("continuous") public class DataScienceClusterIT extends Abstract { - private final String DS_PROJECT_NAME = "default"; - MixedOperation, Resource> cli; + private final String DS_CLUSTER_NAME = "default"; + private final String DS_DASHBOARD_CONFIG_NAME = "odh-dashboard-config"; + MixedOperation, Resource> dataScienceProjectCli; + MixedOperation, Resource> dashboardConfigCli; @BeforeAll void init() { - cli = kubeClient.dataScienceClusterClient(); + dataScienceProjectCli = kubeClient.dataScienceClusterClient(); + dashboardConfigCli = kubeClient.dashboardConfigClient(); } @Test void checkDataScienceClusterExists() { - DataScienceCluster cluster = cli.inNamespace(TestConstants.ODH_NAMESPACE).withName(DS_PROJECT_NAME).get(); + DataScienceCluster cluster = dataScienceProjectCli.inNamespace(TestConstants.ODH_NAMESPACE).withName(DS_CLUSTER_NAME).get(); assertEquals(Kserve.ManagementState.MANAGED, cluster.getSpec().getComponents().getKserve().getManagementState()); assertEquals(Codeflare.ManagementState.MANAGED, cluster.getSpec().getComponents().getCodeflare().getManagementState()); @@ -53,7 +59,7 @@ void checkDataScienceClusterExists() { @Test void checkDataScienceClusterStatus() { - DataScienceCluster cluster = cli.inNamespace(TestConstants.ODH_NAMESPACE).withName(DS_PROJECT_NAME).get(); + DataScienceCluster cluster = dataScienceProjectCli.inNamespace(TestConstants.ODH_NAMESPACE).withName(DS_CLUSTER_NAME).get(); assertEquals("Ready", cluster.getStatus().getPhase()); assertNull(cluster.getStatus().getErrorMessage()); @@ -67,4 +73,19 @@ void checkDataScienceClusterStatus() { //assertEquals("True", KubeUtils.getDscConditionByType(cluster.getStatus().getConditions(), "model-meshReady").getStatus()); //assertEquals("True", KubeUtils.getDscConditionByType(cluster.getStatus().getConditions(), "trustyaiReady").getStatus()); } + + @Test + void checkDataScienceDashboard() { + OdhDashboardConfig dashboard = dashboardConfigCli.inNamespace(TestConstants.ODH_NAMESPACE).withName(DS_DASHBOARD_CONFIG_NAME).get(); + + assertTrue(dashboard.getSpec().getNotebookController().getEnabled()); + + assertFalse(dashboard.getSpec().getDashboardConfig().getDisableInfo()); + assertFalse(dashboard.getSpec().getDashboardConfig().getDisableBiasMetrics()); + assertFalse(dashboard.getSpec().getDashboardConfig().getDisableClusterManager()); + assertFalse(dashboard.getSpec().getDashboardConfig().getDisableCustomServingRuntimes()); + assertFalse(dashboard.getSpec().getDashboardConfig().getDisableKServe()); + assertFalse(dashboard.getSpec().getDashboardConfig().getDisablePipelines()); + assertFalse(dashboard.getSpec().getDashboardConfig().getDisableProjects()); + } } diff --git a/src/test/java/io/odh/test/e2e/continuous/DataScienceProjectIT.java b/src/test/java/io/odh/test/e2e/continuous/DataScienceProjectIT.java new file mode 100644 index 00000000..000d7d0f --- /dev/null +++ b/src/test/java/io/odh/test/e2e/continuous/DataScienceProjectIT.java @@ -0,0 +1,45 @@ +/* + * Copyright Tealc authors. + * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). + */ +package io.odh.test.e2e.continuous; + +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.e2e.Abstract; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; +import org.kubeflow.v1.Notebook; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +@Tag("continuous") +public class DataScienceProjectIT extends Abstract { + + private final String DS_PROJECT_NAME = "test"; + private final String DS_WORKBENCH_NAME = "test-workbench"; + MixedOperation, Resource> notebookCli; + + @BeforeAll + void init() { + notebookCli = kubeClient.notebookClient(); + } + + @Test + void checkDataScienceProject() { + assertTrue(kubeClient.namespaceExists(DS_PROJECT_NAME)); + + assertEquals("true", + kubeClient.getNamespace(DS_PROJECT_NAME).getMetadata().getLabels().getOrDefault("opendatahub.io/dashboard", "false")); + + Notebook testWorkbench = notebookCli.inNamespace(DS_PROJECT_NAME).withName(DS_WORKBENCH_NAME).get(); + + assertEquals("true", + testWorkbench.getMetadata().getLabels().getOrDefault("opendatahub.io/dashboard", "false")); + assertEquals("true", + testWorkbench.getMetadata().getLabels().getOrDefault("opendatahub.io/odh-managed", "false")); + } +} diff --git a/src/test/java/io/odh/test/e2e/standard/DataScienceClusterIT.java b/src/test/java/io/odh/test/e2e/standard/DataScienceClusterIT.java index b72165d1..99ecb491 100644 --- a/src/test/java/io/odh/test/e2e/standard/DataScienceClusterIT.java +++ b/src/test/java/io/odh/test/e2e/standard/DataScienceClusterIT.java @@ -54,7 +54,7 @@ void clean() { } @Test - void checkDataScienceClusterExists() { + void createDataScienceCluster() { if (!kubeClient.namespaceExists(DS_PROJECT_NAMESPACE)) { kubeClient.getClient() .namespaces()