diff --git a/src/main/java/io/odh/test/framework/manager/ResourceManager.java b/src/main/java/io/odh/test/framework/manager/ResourceManager.java index 7f108396..205bed82 100644 --- a/src/main/java/io/odh/test/framework/manager/ResourceManager.java +++ b/src/main/java/io/odh/test/framework/manager/ResourceManager.java @@ -95,11 +95,8 @@ private void createResource(boolean waitReady, T... reso if (waitReady) { DeploymentUtils.waitForDeploymentReady(resource.getMetadata().getNamespace(), resource.getMetadata().getName()); } - continue; } else { - LOGGER.error("Invalid resource {} {}/{}. Please implement it in ResourceManager", - resource.getKind(), resource.getMetadata().getNamespace(), resource.getMetadata().getName()); - continue; + client.getClient().resource(resource).create(); } } else { type.create(resource); @@ -124,13 +121,14 @@ public final void deleteResource(T... resources) { for (T resource : resources) { ResourceType type = findResourceType(resource); if (type == null) { + LOGGER.info("Deleting of {} {}", + resource.getKind(), resource.getMetadata().getName()); if (resource instanceof Deployment) { Deployment deployment = (Deployment) resource; client.getClient().apps().deployments().resource(deployment).delete(); DeploymentUtils.waitForDeploymentDeletion(resource.getMetadata().getNamespace(), resource.getMetadata().getName()); } else { - LOGGER.error("Invalid resource {} {}/{}. Please implement it in ResourceManager", - resource.getKind(), resource.getMetadata().getNamespace(), resource.getMetadata().getName()); + client.getClient().resource(resource).delete(); } } else { if (resource.getMetadata().getNamespace() == null) { @@ -160,7 +158,11 @@ public final void deleteResource(T... resources) { public final void updateResource(T... resources) { for (T resource : resources) { ResourceType type = findResourceType(resource); - type.update(resource); + if (type != null) { + type.update(resource); + } else { + client.getClient().resource(resource).update(); + } } } diff --git a/src/main/java/io/odh/test/install/BundleInstall.java b/src/main/java/io/odh/test/install/BundleInstall.java index b2ce43e7..52b0e521 100644 --- a/src/main/java/io/odh/test/install/BundleInstall.java +++ b/src/main/java/io/odh/test/install/BundleInstall.java @@ -5,6 +5,8 @@ package io.odh.test.install; import io.fabric8.kubernetes.api.model.HasMetadata; +import io.fabric8.kubernetes.api.model.Namespace; +import io.fabric8.kubernetes.api.model.apps.Deployment; import io.odh.test.Environment; import io.odh.test.TestConstants; import io.odh.test.TestUtils; @@ -39,6 +41,14 @@ public BundleInstall() throws IOException { this(Environment.INSTALL_FILE_PATH); } + public String getNamespace() { + return resources.stream().filter(r -> r instanceof Namespace).findFirst().get().getMetadata().getName(); + } + + public String getDeploymentName() { + return resources.stream().filter(r -> r instanceof Deployment).findFirst().get().getMetadata().getName(); + } + public void printResources() { resources.forEach(r -> { LOGGER.info("Kind: {}, Name: {}", r.getKind(), r.getMetadata().getName()); @@ -46,6 +56,6 @@ public void printResources() { } public void installBundle() { - //TODO implement using RM + ResourceManager.getInstance().createResourceWithWait(resources.toArray(new HasMetadata[0])); } } diff --git a/src/test/java/io/odh/test/e2e/standard/OdhInstall.java b/src/test/java/io/odh/test/e2e/standard/OdhInstall.java index 9113ea4c..0e406177 100644 --- a/src/test/java/io/odh/test/e2e/standard/OdhInstall.java +++ b/src/test/java/io/odh/test/e2e/standard/OdhInstall.java @@ -30,6 +30,9 @@ void testInstallOdhOlm() { void testInstallOdhBundle() throws IOException { BundleInstall bundle = new BundleInstall(); bundle.printResources(); - //TODO complete + bundle.installBundle(); + + Deployment dep = ResourceManager.getClient().getDeployment(bundle.getNamespace(), bundle.getDeploymentName()); + assertNotNull(dep); } }