From da20467d0a57de12628b498d378db468cd2adf13 Mon Sep 17 00:00:00 2001 From: Fabio Burzigotti Date: Fri, 30 Aug 2024 21:04:46 +0200 Subject: [PATCH] [issue 190] - Fix InfinispanOperatorProvisionerTest in order not to use .spec.service.type=cache and .spec.autoscale, which are no longer supported --- .../InfinispanOperatorProvisionerTest.java | 105 ------------------ 1 file changed, 105 deletions(-) diff --git a/testsuite/integration-tests/src/test/java/org/jboss/intersmash/testsuite/provision/openshift/InfinispanOperatorProvisionerTest.java b/testsuite/integration-tests/src/test/java/org/jboss/intersmash/testsuite/provision/openshift/InfinispanOperatorProvisionerTest.java index 70324a9b..4b977608 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/intersmash/testsuite/provision/openshift/InfinispanOperatorProvisionerTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/intersmash/testsuite/provision/openshift/InfinispanOperatorProvisionerTest.java @@ -30,7 +30,6 @@ import org.jboss.intersmash.provision.openshift.InfinispanOperatorProvisioner; import org.jboss.intersmash.provision.openshift.operator.infinispan.cache.CacheBuilder; import org.jboss.intersmash.provision.openshift.operator.infinispan.infinispan.InfinispanBuilder; -import org.jboss.intersmash.provision.openshift.operator.infinispan.infinispan.spec.AutoscaleBuilder; import org.jboss.intersmash.provision.openshift.operator.infinispan.infinispan.spec.InfinispanServiceSpecBuilder; import org.jboss.intersmash.provision.openshift.operator.resources.OperatorGroup; import org.junit.jupiter.api.AfterAll; @@ -166,60 +165,6 @@ public void testMinimalTwoReplicasInfinispan() { } } - /** - * This test case creates and validates a basic {@link Infinispan} CR, configured for using Cache service type - * explicitly - * - * This is not an integration test, the goal here is to assess that the created CRs are configured as per the - * model specification. - */ - @Test - public void testMinimalTwoReplicasCacheServiceInfinispan() { - INFINISPAN_OPERATOR_PROVISIONER.subscribe(); - try { - name = "example-infinispan"; - Infinispan infinispan = new InfinispanBuilder(name, matchLabels) - .replicas(2) - .service(new InfinispanServiceSpecBuilder().type(Service.Type.Cache) - .build()) - .build(); - - verifyMinimalTwoReplicasInfinispan(infinispan, true); - } finally { - INFINISPAN_OPERATOR_PROVISIONER.unsubscribe(); - } - } - - /** - * This test case creates and validates a basic {@link Infinispan} CR, configured for using Cache service type - * and autoscale functionality - * - * This is not an integration test, the goal here is to assess that the created CRs are configured as per the - * model specification. - */ - @Test - public void testMinimalCacheServiceInfinispanWithAutoscale() { - INFINISPAN_OPERATOR_PROVISIONER.subscribe(); - try { - name = "example-infinispan"; - Infinispan infinispan = new InfinispanBuilder(name, matchLabels) - .replicas(2) - .service(new InfinispanServiceSpecBuilder() - .type(Service.Type.Cache) - .build()) - .autoscale(new AutoscaleBuilder() - .maxReplicas(5) - .maxMemUsagePercent(70L) - .minReplicas(2) - .minMemUsagePercent(30L).build()) - .build(); - - verifyMinimalCacheServiceInfinispanWithAutoscale(infinispan, true); - } finally { - INFINISPAN_OPERATOR_PROVISIONER.unsubscribe(); - } - } - /** * This test case creates and validates a basic {@link Infinispan} CR, configured for using DataGrid service type * and a cache secret @@ -379,24 +324,6 @@ private void verifyMinimalTwoReplicasInfinispan(Infinispan infinispan, boolean w deleteAndVerifyMinimalInfinispan(waitForPods); } - /** - * Verify that two replicas are up and running and that have the relevant properties set to the same values - */ - private void verifyMinimalCacheServiceInfinispanWithAutoscale(Infinispan infinispan, boolean waitForPods) { - createAndVerifyInfinispan(infinispan); - if (waitForPods) { - // a correct number of Infinispan CRs has been created - new SimpleWaiter( - () -> InfinispanOperatorProvisioner.getInfinispanPods(name).size() == infinispan.getSpec().getReplicas()) - .level(Level.DEBUG).waitFor(); - log.debug(INFINISPAN_OPERATOR_PROVISIONER.infinispansClient().withName(name).get().getStatus().toString()); - } - assertMinimalInfinispanWithAutoscaleCreation(infinispan); - - // delete and verify that object was removed - deleteAndVerifyMinimalInfinispan(waitForPods); - } - /** * Verify that two replicas are up and running and that have the relevant properties set to the same values */ @@ -409,38 +336,6 @@ private void verifyCacheWithBasicSecretFromTemplate(Cache cache, boolean waitFor deleteAndVerifyCache(waitForPods); } - /** - * Minimal setup + autoscale verification involves:
- * - the created Infinispan .metadata.name == the CRD .metadata.name
- * - the created Infinispan .spec.replicas == the CRD .spec.replicas
- * - the created Infinispan .spec.autoscale properties == the CRD .spec.autoscale properties - * - * Created Infinispan .spec.autoscale and CRD .spec aren't equal because aggregated props are null in CRD .spec.autoscale - * - * @param infinispan the Infinispan resource which configuration has to be verified - */ - private void assertMinimalInfinispanWithAutoscaleCreation(Infinispan infinispan) { - Assertions.assertEquals(infinispan.getMetadata().getName(), - INFINISPAN_OPERATOR_PROVISIONER.infinispansClient().withName(name).get().getMetadata().getName()); - Assertions.assertEquals(infinispan.getSpec().getReplicas(), - INFINISPAN_OPERATOR_PROVISIONER.infinispansClient().withName(name).get().getSpec().getReplicas()); - Assertions.assertEquals(infinispan.getSpec().getService().getType(), - INFINISPAN_OPERATOR_PROVISIONER.infinispansClient().withName(name).get().getSpec().getService().getType()); - Assertions.assertEquals(infinispan.getSpec().getAutoscale().getMaxReplicas(), - INFINISPAN_OPERATOR_PROVISIONER.infinispansClient().withName(name).get().getSpec().getAutoscale() - .getMaxReplicas()); - Assertions.assertEquals(infinispan.getSpec().getAutoscale().getMaxMemUsagePercent(), - INFINISPAN_OPERATOR_PROVISIONER.infinispansClient().withName(name).get().getSpec().getAutoscale() - .getMaxMemUsagePercent()); - Assertions.assertEquals(infinispan.getSpec().getAutoscale().getMinReplicas(), - INFINISPAN_OPERATOR_PROVISIONER.infinispansClient().withName(name).get().getSpec().getAutoscale() - .getMinReplicas()); - Assertions.assertEquals(infinispan.getSpec().getAutoscale().getMinMemUsagePercent(), - INFINISPAN_OPERATOR_PROVISIONER.infinispansClient().withName(name).get().getSpec().getAutoscale() - .getMinMemUsagePercent()); - // NOTE: created Infinispan .spec.autoscale and CRD .spec.autoscale aren't equal because aggregated props are null in CRD .spec - } - /** * Minimal setup verification involves:
* - the created Infinispan .metadata.name == the CRD .metadata.name