diff --git a/pom.xml b/pom.xml
index 9a5ab037..b0c94749 100644
--- a/pom.xml
+++ b/pom.xml
@@ -65,7 +65,7 @@
1.9.21.2
2.27.0
2.12.0
- 0.3.0
+ 0.4.0
diff --git a/src/main/java/io/odh/test/framework/manager/resources/DataScienceClusterType.java b/src/main/java/io/odh/test/framework/manager/resources/DataScienceClusterType.java
index 87f021ef..630ced9e 100644
--- a/src/main/java/io/odh/test/framework/manager/resources/DataScienceClusterType.java
+++ b/src/main/java/io/odh/test/framework/manager/resources/DataScienceClusterType.java
@@ -58,19 +58,19 @@ public void update(DataScienceCluster resource) {
}
@Override
- public void delete(String s) {
- dataScienceCLusterClient().withName(s).delete();
+ public void delete(DataScienceCluster s) {
+ dataScienceCLusterClient().withName(s.getMetadata().getName()).delete();
}
@Override
- public void replace(String s, Consumer editor) {
- DataScienceCluster toBeUpdated = dataScienceCLusterClient().withName(s).get();
+ public void replace(DataScienceCluster s, Consumer editor) {
+ DataScienceCluster toBeUpdated = dataScienceCLusterClient().withName(s.getMetadata().getName()).get();
editor.accept(toBeUpdated);
update(toBeUpdated);
}
@Override
- public boolean waitForReadiness(DataScienceCluster resource) {
+ public boolean isReady(DataScienceCluster resource) {
String message = String.format("DataScienceCluster %s readiness", resource.getMetadata().getName());
Wait.until(message, TestConstants.GLOBAL_POLL_INTERVAL_SHORT, TestConstants.GLOBAL_TIMEOUT, () -> {
boolean dscReady;
@@ -132,12 +132,13 @@ public boolean waitForReadiness(DataScienceCluster resource) {
// https://github.com/red-hat-data-services/rhods-operator/blob/rhoai-2.8/controllers/datasciencecluster/datasciencecluster_controller.go#L257
// Wait for standard Kubernetes condition types (status for the whole DSC)
- record ConditionExpectation(String conditionType, String expectedStatus) { }
+ record ConditionExpectation(String conditionType, String expectedStatus) {
+ }
List conditionExpectations = List.of(
- new ConditionExpectation("Available", "True"),
- new ConditionExpectation("Progressing", "False"),
- new ConditionExpectation("Degraded", "False"),
- new ConditionExpectation("Upgradeable", "True")
+ new ConditionExpectation("Available", "True"),
+ new ConditionExpectation("Progressing", "False"),
+ new ConditionExpectation("Degraded", "False"),
+ new ConditionExpectation("Upgradeable", "True")
);
for (ConditionExpectation conditionExpectation : conditionExpectations) {
String conditionType = conditionExpectation.conditionType;
@@ -155,16 +156,17 @@ record ConditionExpectation(String conditionType, String expectedStatus) { }
// Wait for DataScienceClusterCreationSuccessful event
EventingAPIGroupDSL eventsClient = KubeResourceManager.getKubeClient().getClient().events();
List resourceEvents = eventsClient.v1().events().inAnyNamespace().withNewFilter()
- .withField("regarding.name", resource.getMetadata().getName())
- .withField("regarding.uid", resource.getMetadata().getUid())
- .endFilter().list().getItems();
+ .withField("regarding.name", resource.getMetadata().getName())
+ .withField("regarding.uid", resource.getMetadata().getUid())
+ .endFilter().list().getItems();
LOGGER.debug("DataScienceCluster {} events: {}", resource.getMetadata().getName(), resourceEvents.stream().map(Event::getReason).toList());
boolean hasCreationSuccessfulEvent = resourceEvents.stream()
- .anyMatch(resourceEvent -> Objects.equals(resourceEvent.getReason(), OdhConstants.DSC_CREATION_SUCCESSFUL_EVENT_NAME));
+ .anyMatch(resourceEvent -> Objects.equals(resourceEvent.getReason(), OdhConstants.DSC_CREATION_SUCCESSFUL_EVENT_NAME));
dscReady = dscReady && hasCreationSuccessfulEvent;
return dscReady;
- }, () -> { });
+ }, () -> {
+ });
String namespace = OdhConstants.CONTROLLERS_NAMESPACE;
LOGGER.info("Waiting for pods readiness in {}", namespace);
@@ -177,7 +179,7 @@ record ConditionExpectation(String conditionType, String expectedStatus) { }
}
@Override
- public boolean waitForDeletion(DataScienceCluster dataScienceCluster) {
+ public boolean isDeleted(DataScienceCluster dataScienceCluster) {
return get(dataScienceCluster.getMetadata().getName()) == null;
}
diff --git a/src/main/java/io/odh/test/framework/manager/resources/DataScienceInitializationType.java b/src/main/java/io/odh/test/framework/manager/resources/DataScienceInitializationType.java
index 01adae54..173d4ec4 100644
--- a/src/main/java/io/odh/test/framework/manager/resources/DataScienceInitializationType.java
+++ b/src/main/java/io/odh/test/framework/manager/resources/DataScienceInitializationType.java
@@ -48,19 +48,19 @@ public void update(DSCInitialization resource) {
}
@Override
- public void delete(String s) {
- dsciClient().withName(s).delete();
+ public void delete(DSCInitialization s) {
+ dsciClient().withName(s.getMetadata().getName()).delete();
}
@Override
- public void replace(String s, Consumer editor) {
- DSCInitialization toBeUpdated = dsciClient().withName(s).get();
+ public void replace(DSCInitialization s, Consumer editor) {
+ DSCInitialization toBeUpdated = dsciClient().withName(s.getMetadata().getName()).get();
editor.accept(toBeUpdated);
update(toBeUpdated);
}
@Override
- public boolean waitForReadiness(DSCInitialization resource) {
+ public boolean isReady(DSCInitialization resource) {
String message = String.format("DSCInitialization %s readiness", resource.getMetadata().getName());
Wait.until(message, TestConstants.GLOBAL_POLL_INTERVAL_SHORT, TestConstants.GLOBAL_TIMEOUT, () -> {
boolean dsciReady;
@@ -76,7 +76,7 @@ public boolean waitForReadiness(DSCInitialization resource) {
}
@Override
- public boolean waitForDeletion(DSCInitialization dscInitialization) {
+ public boolean isDeleted(DSCInitialization dscInitialization) {
return get(dscInitialization.getMetadata().getName()) == null;
}
diff --git a/src/main/java/io/odh/test/framework/manager/resources/InferenceServiceType.java b/src/main/java/io/odh/test/framework/manager/resources/InferenceServiceType.java
index 93859520..7fb96415 100644
--- a/src/main/java/io/odh/test/framework/manager/resources/InferenceServiceType.java
+++ b/src/main/java/io/odh/test/framework/manager/resources/InferenceServiceType.java
@@ -10,7 +10,7 @@
import io.kserve.serving.v1beta1.InferenceService;
import io.odh.test.TestConstants;
import io.odh.test.TestUtils;
-import io.skodjob.testframe.interfaces.NamespacedResourceType;
+import io.skodjob.testframe.interfaces.ResourceType;
import io.skodjob.testframe.resources.KubeResourceManager;
import io.skodjob.testframe.utils.PodUtils;
import io.skodjob.testframe.wait.Wait;
@@ -19,7 +19,7 @@
import java.util.function.Consumer;
-public class InferenceServiceType implements NamespacedResourceType {
+public class InferenceServiceType implements ResourceType {
private static final Logger LOGGER = LoggerFactory.getLogger(InferenceServiceType.class);
@@ -34,28 +34,30 @@ public InferenceService get(String namespace, String name) {
@Override
public void create(InferenceService resource) {
- inferenceServiceClient().resource(resource).create();
+ inferenceServiceClient().inNamespace(resource.getMetadata().getNamespace()).resource(resource).create();
}
@Override
public void update(InferenceService resource) {
- inferenceServiceClient().resource(resource).update();
+ inferenceServiceClient().inNamespace(resource.getMetadata().getNamespace()).resource(resource).update();
}
@Override
- public void delete(String resource) {
- inferenceServiceClient().withName(resource).delete();
+ public void delete(InferenceService resource) {
+ inferenceServiceClient().inNamespace(resource.getMetadata().getNamespace())
+ .withName(resource.getMetadata().getName()).delete();
}
@Override
- public void replace(String s, Consumer editor) {
- InferenceService toBeUpdated = inferenceServiceClient().withName(s).get();
+ public void replace(InferenceService s, Consumer editor) {
+ InferenceService toBeUpdated = inferenceServiceClient().inNamespace(s.getMetadata().getNamespace())
+ .withName(s.getMetadata().getName()).get();
editor.accept(toBeUpdated);
update(toBeUpdated);
}
@Override
- public boolean waitForReadiness(InferenceService resource) {
+ public boolean isReady(InferenceService resource) {
String message = String.format("InferenceService %s readiness", resource.getMetadata().getName());
Wait.until(message, TestConstants.GLOBAL_POLL_INTERVAL_SHORT, TestConstants.GLOBAL_TIMEOUT, () -> {
boolean isReady;
@@ -71,7 +73,8 @@ public boolean waitForReadiness(InferenceService resource) {
isReady = isReady && readyStatus.equals("True");
return isReady;
- }, () -> { });
+ }, () -> {
+ });
String namespace = resource.getMetadata().getNamespace();
LOGGER.info("Waiting for pods readiness in {}", namespace);
@@ -84,7 +87,7 @@ public boolean waitForReadiness(InferenceService resource) {
}
@Override
- public boolean waitForDeletion(InferenceService inferenceService) {
+ public boolean isDeleted(InferenceService inferenceService) {
return get(inferenceService.getMetadata().getNamespace(), inferenceService.getMetadata().getName()) == null;
}
@@ -96,26 +99,4 @@ public static MixedOperation getClient() {
return inferenceServiceClient();
}
-
- @Override
- public void createInNamespace(String namespace, InferenceService inferenceService) {
- inferenceServiceClient().inNamespace(namespace).resource(inferenceService).create();
- }
-
- @Override
- public void updateInNamespace(String namespace, InferenceService inferenceService) {
- inferenceServiceClient().inNamespace(namespace).resource(inferenceService).update();
- }
-
- @Override
- public void deleteFromNamespace(String namespace, String resource) {
- inferenceServiceClient().inNamespace(namespace).withName(resource).delete();
- }
-
- @Override
- public void replaceInNamespace(String namespace, String s, Consumer editor) {
- InferenceService toBeUpdated = inferenceServiceClient().inNamespace(namespace).withName(s).get();
- editor.accept(toBeUpdated);
- update(toBeUpdated);
- }
}
diff --git a/src/main/java/io/odh/test/framework/manager/resources/NotebookType.java b/src/main/java/io/odh/test/framework/manager/resources/NotebookType.java
index be5f1559..9542215c 100644
--- a/src/main/java/io/odh/test/framework/manager/resources/NotebookType.java
+++ b/src/main/java/io/odh/test/framework/manager/resources/NotebookType.java
@@ -11,7 +11,7 @@
import io.odh.test.Environment;
import io.odh.test.OdhConstants;
import io.odh.test.TestUtils;
-import io.skodjob.testframe.interfaces.NamespacedResourceType;
+import io.skodjob.testframe.interfaces.ResourceType;
import io.skodjob.testframe.resources.KubeResourceManager;
import org.kubeflow.v1.Notebook;
@@ -24,7 +24,7 @@
import org.apache.commons.io.IOUtils;
-public class NotebookType implements NamespacedResourceType {
+public class NotebookType implements ResourceType {
private static final String REGISTRY_PATH = "image-registry.openshift-image-registry.svc:5000";
public static final String JUPYTER_MINIMAL_IMAGE = "jupyter-minimal-notebook";
@@ -40,7 +40,9 @@ public class NotebookType implements NamespacedResourceType {
static {
RHOAI_IMAGES_MAP = Map.of(JUPYTER_MINIMAL_IMAGE, "s2i-minimal-notebook");
}
+
private static final String NOTEBOOK_TEMPLATE_PATH = "notebook.yaml";
+
@Override
public String getKind() {
return "Notebook";
@@ -61,24 +63,25 @@ public void update(Notebook resource) {
}
@Override
- public void delete(String s) {
- notebookClient().withName(s).delete();
+ public void delete(Notebook s) {
+ notebookClient().inNamespace(s.getMetadata().getNamespace()).withName(s.getMetadata().getName()).delete();
}
@Override
- public void replace(String resource, Consumer editor) {
- Notebook toBeUpdated = notebookClient().withName(resource).get();
+ public void replace(Notebook resource, Consumer editor) {
+ Notebook toBeUpdated = notebookClient().inNamespace(resource.getMetadata().getNamespace())
+ .withName(resource.getMetadata().getName()).get();
editor.accept(toBeUpdated);
update(toBeUpdated);
}
@Override
- public boolean waitForReadiness(Notebook resource) {
+ public boolean isReady(Notebook resource) {
return resource != null;
}
@Override
- public boolean waitForDeletion(Notebook notebook) {
+ public boolean isDeleted(Notebook notebook) {
return get(notebook.getMetadata().getNamespace(), notebook.getMetadata().getName()) == null;
}
@@ -114,26 +117,4 @@ public static String getNotebookImage(String imageName, String imageTag) {
public MixedOperation, ?, ?> getClient() {
return notebookClient();
}
-
- @Override
- public void createInNamespace(String namespace, Notebook notebook) {
- notebookClient().inNamespace(namespace).resource(notebook).create();
- }
-
- @Override
- public void updateInNamespace(String namespace, Notebook notebook) {
- notebookClient().inNamespace(namespace).resource(notebook).update();
- }
-
- @Override
- public void deleteFromNamespace(String namespace, String resource) {
- notebookClient().inNamespace(namespace).withName(resource).delete();
- }
-
- @Override
- public void replaceInNamespace(String namespace, String resoruce, Consumer editor) {
- Notebook toBeUpdated = notebookClient().inNamespace(namespace).withName(resoruce).get();
- editor.accept(toBeUpdated);
- update(toBeUpdated);
- }
}