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 another unit test for fluent api odh dashboard config #18

Merged
merged 1 commit into from
Nov 27, 2023
Merged
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
34 changes: 33 additions & 1 deletion src/test/java/io/odh/test/unit/UnitTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@
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.v1alpha.OdhDashboardConfig;
import io.opendatahub.v1alpha.OdhDashboardConfigBuilder;
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;

@Tag("unit")
@EnableKubernetesMockClient(crud = true)
Expand All @@ -28,7 +32,7 @@ public class UnitTests implements TestSeparator {
private KubernetesMockServer server;

@Test
void testCreateDataScienceCluster() {
void testCreateDeleteDataScienceCluster() {
MixedOperation<DataScienceCluster, KubernetesResourceList<DataScienceCluster>, Resource<DataScienceCluster>> dsClient =
kubernetesClient.resources(DataScienceCluster.class);

Expand All @@ -51,5 +55,33 @@ void testCreateDataScienceCluster() {

DataScienceCluster returned = dsClient.withName(cluster.getMetadata().getName()).get();
assertEquals(Codeflare.ManagementState.MANAGED, returned.getSpec().getComponents().getCodeflare().getManagementState());

dsClient.withName(cluster.getMetadata().getName()).delete();

assertNull(dsClient.withName(cluster.getMetadata().getName()).get());
}

@Test
void testDashBoardConfig() {
MixedOperation<OdhDashboardConfig, KubernetesResourceList<OdhDashboardConfig>, Resource<OdhDashboardConfig>> dashboardCli =
kubernetesClient.resources(OdhDashboardConfig.class);

OdhDashboardConfig dashboard = new OdhDashboardConfigBuilder()
.withNewMetadata()
.withName("test-config")
.endMetadata()
.withNewSpec()
.withNewDashboardConfig()
.withDisableClusterManager(false)
.withDisableCustomServingRuntimes(false)
.withDisableKServe(false)
.endDashboardConfig()
.endSpec()
.build();

dashboardCli.resource(dashboard).create();

OdhDashboardConfig returned = dashboardCli.withName(dashboard.getMetadata().getName()).get();
assertFalse(returned.getSpec().getDashboardConfig().getDisableKServe());
}
}
Loading