Search in sources :

Example 1 with ParallelTest

use of org.bf2.systemtest.framework.ParallelTest in project kas-fleetshard by bf2fc6cc711aee1a0c2a.

the class OperatorST method testResizeAndCapacity.

@ParallelTest
void testResizeAndCapacity(ExtensionContext extensionContext) throws Exception {
    String mkAppName = "mk-test-resize-capacity";
    LOGGER.info("Create namespace");
    resourceManager.addResource(extensionContext, new NamespaceBuilder().withNewMetadata().withName(mkAppName).endMetadata().build());
    LOGGER.info("Create managedkafka");
    ManagedKafka mk = ManagedKafkaResourceType.getDefault(mkAppName, mkAppName, null, latestStrimziVersion, latestKafkaVersion);
    Quantity quantity = Quantity.parse("100Gi");
    // for values below 270Gi, the logic will report a slightly larger values
    Quantity reportedQuantity = Quantity.parse("103Gi");
    mk.getSpec().getCapacity().setMaxDataRetentionSize(quantity);
    mk = resourceManager.createResource(extensionContext, mk);
    Resource<ManagedKafka> mkResource = kube.client().resources(ManagedKafka.class).inNamespace(mk.getMetadata().getNamespace()).withName(mk.getMetadata().getName());
    assertEquals(reportedQuantity, mk.getStatus().getCapacity().getMaxDataRetentionSize());
    LOGGER.info("Trying to shrink");
    mk.getSpec().getCapacity().setMaxDataRetentionSize(Quantity.parse("50Gi"));
    mk = mkResource.createOrReplace(mk);
    String currentVersion = mk.getMetadata().getResourceVersion();
    // wait until the status is updated
    mk = mkResource.waitUntilCondition(m -> !Objects.equals(currentVersion, m.getMetadata().getResourceVersion()), 2, TimeUnit.MINUTES);
    // should be the same, as we can't resize down
    assertEquals(reportedQuantity, mk.getStatus().getCapacity().getMaxDataRetentionSize());
    LOGGER.info("Trying to grow");
    mk.getSpec().getCapacity().setMaxDataRetentionSize(Quantity.parse("200Gi"));
    mk = mkResource.createOrReplace(mk);
    // should grow - again the size is a little off
    Quantity endReportedQuantity = Quantity.parse("202Gi");
    mk = mkResource.waitUntilCondition(m -> endReportedQuantity.equals(m.getStatus().getCapacity().getMaxDataRetentionSize()), 5, TimeUnit.MINUTES);
}
Also used : Quantity(io.fabric8.kubernetes.api.model.Quantity) StrimziOperatorManager(org.bf2.systemtest.operator.StrimziOperatorManager) SyncApiClient(org.bf2.systemtest.api.sync.SyncApiClient) SequentialTest(org.bf2.systemtest.framework.SequentialTest) ManagedKafkaAgentBuilder(org.bf2.operator.resources.v1alpha1.ManagedKafkaAgentBuilder) CompletableFuture(java.util.concurrent.CompletableFuture) ManagedKafkaAgentSpecBuilder(org.bf2.operator.resources.v1alpha1.ManagedKafkaAgentSpecBuilder) ExtensionContext(org.junit.jupiter.api.extension.ExtensionContext) AfterAll(org.junit.jupiter.api.AfterAll) Resource(io.fabric8.kubernetes.client.dsl.Resource) AbstractST(org.bf2.systemtest.integration.AbstractST) BeforeAll(org.junit.jupiter.api.BeforeAll) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) ManagedKafkaAgentResourceClient(org.bf2.common.ManagedKafkaAgentResourceClient) FleetShardOperatorManager(org.bf2.systemtest.operator.FleetShardOperatorManager) ManagedKafkaResourceType(org.bf2.systemtest.framework.resource.ManagedKafkaResourceType) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) Logger(org.apache.logging.log4j.Logger) ManagedKafkaCondition(org.bf2.operator.resources.v1alpha1.ManagedKafkaCondition) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) NamespaceBuilder(io.fabric8.kubernetes.api.model.NamespaceBuilder) ParallelTest(org.bf2.systemtest.framework.ParallelTest) LogManager(org.apache.logging.log4j.LogManager) ManagedKafka(org.bf2.operator.resources.v1alpha1.ManagedKafka) ManagedKafka(org.bf2.operator.resources.v1alpha1.ManagedKafka) Quantity(io.fabric8.kubernetes.api.model.Quantity) NamespaceBuilder(io.fabric8.kubernetes.api.model.NamespaceBuilder) ParallelTest(org.bf2.systemtest.framework.ParallelTest)

Example 2 with ParallelTest

use of org.bf2.systemtest.framework.ParallelTest in project kas-fleetshard by bf2fc6cc711aee1a0c2a.

the class SuiteUnitTest method testExecutor.

@ParallelTest
void testExecutor() {
    ExecResult result = Exec.builder().withCommand("ls", System.getProperty("user.dir")).logToOutput(false).throwErrors(true).timeout(60).exec();
    assertTrue(result.exitStatus());
}
Also used : ExecResult(org.bf2.test.executor.ExecResult) ParallelTest(org.bf2.systemtest.framework.ParallelTest)

Example 3 with ParallelTest

use of org.bf2.systemtest.framework.ParallelTest in project kas-fleetshard by bf2fc6cc711aee1a0c2a.

the class SuiteUnitTest method testKeycloakInstance.

@ParallelTest
void testKeycloakInstance() {
    KeycloakInstance k = new KeycloakInstance("keycloak");
    assertEquals("https://keycloak.keycloak.svc:8443/auth/realms/demo/protocol/openid-connect/certs", k.getJwksEndpointUri());
    assertEquals("admin", k.getUsername());
    assertEquals("admin", k.getPassword());
    assertNotNull(k.getKeycloakCert());
}
Also used : KeycloakInstance(org.bf2.systemtest.framework.KeycloakInstance) ParallelTest(org.bf2.systemtest.framework.ParallelTest)

Aggregations

ParallelTest (org.bf2.systemtest.framework.ParallelTest)3 NamespaceBuilder (io.fabric8.kubernetes.api.model.NamespaceBuilder)1 Quantity (io.fabric8.kubernetes.api.model.Quantity)1 Resource (io.fabric8.kubernetes.client.dsl.Resource)1 List (java.util.List)1 Objects (java.util.Objects)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 TimeUnit (java.util.concurrent.TimeUnit)1 Collectors (java.util.stream.Collectors)1 LogManager (org.apache.logging.log4j.LogManager)1 Logger (org.apache.logging.log4j.Logger)1 ManagedKafkaAgentResourceClient (org.bf2.common.ManagedKafkaAgentResourceClient)1 ManagedKafka (org.bf2.operator.resources.v1alpha1.ManagedKafka)1 ManagedKafkaAgentBuilder (org.bf2.operator.resources.v1alpha1.ManagedKafkaAgentBuilder)1 ManagedKafkaAgentSpecBuilder (org.bf2.operator.resources.v1alpha1.ManagedKafkaAgentSpecBuilder)1 ManagedKafkaCondition (org.bf2.operator.resources.v1alpha1.ManagedKafkaCondition)1 SyncApiClient (org.bf2.systemtest.api.sync.SyncApiClient)1 KeycloakInstance (org.bf2.systemtest.framework.KeycloakInstance)1 SequentialTest (org.bf2.systemtest.framework.SequentialTest)1 ManagedKafkaResourceType (org.bf2.systemtest.framework.resource.ManagedKafkaResourceType)1