Search in sources :

Example 6 with BridgeIngress

use of com.redhat.service.smartevents.shard.operator.resources.BridgeIngress in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class BridgeIngressControllerTest method testBridgeIngressDeployment_deploymentTimeoutFailure.

@Test
void testBridgeIngressDeployment_deploymentTimeoutFailure() {
    // Given
    BridgeIngress bridgeIngress = buildBridgeIngress();
    deployBridgeIngressSecret(bridgeIngress);
    // When
    bridgeIngressController.reconcile(bridgeIngress, null);
    Deployment deployment = getDeploymentFor(bridgeIngress);
    // Then
    kubernetesResourcePatcher.patchDeploymentAsTimeoutFailed(deployment.getMetadata().getName(), deployment.getMetadata().getNamespace());
    UpdateControl<BridgeIngress> updateControl = bridgeIngressController.reconcile(bridgeIngress, null);
    assertThat(updateControl.isUpdateStatus()).isTrue();
    assertThat(updateControl.getResource().getStatus().getConditionByType(ConditionType.Ready).get().getReason()).isEqualTo(ConditionReason.DeploymentFailed);
    assertThat(updateControl.getResource().getStatus().getConditionByType(ConditionType.Augmentation).get().getStatus()).isEqualTo(ConditionStatus.False);
}
Also used : BridgeIngress(com.redhat.service.smartevents.shard.operator.resources.BridgeIngress) Deployment(io.fabric8.kubernetes.api.model.apps.Deployment) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 7 with BridgeIngress

use of com.redhat.service.smartevents.shard.operator.resources.BridgeIngress in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class BridgeIngressServiceTest method waitUntilBridgeIngressExists.

private void waitUntilBridgeIngressExists(BridgeDTO dto) {
    Awaitility.await().atMost(Duration.ofSeconds(30)).pollInterval(Duration.ofMillis(200)).untilAsserted(() -> {
        BridgeIngress bridgeIngress = fetchBridgeIngress(dto);
        assertThat(bridgeIngress).isNotNull();
    });
}
Also used : BridgeIngress(com.redhat.service.smartevents.shard.operator.resources.BridgeIngress)

Example 8 with BridgeIngress

use of com.redhat.service.smartevents.shard.operator.resources.BridgeIngress in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class BridgeIngressServiceTest method testBridgeIngressDeletion.

@Test
public void testBridgeIngressDeletion() {
    // Given
    BridgeDTO dto = TestSupport.newProvisioningBridgeDTO();
    // When
    bridgeIngressService.createBridgeIngress(dto);
    waitUntilBridgeIngressExists(dto);
    bridgeIngressService.deleteBridgeIngress(dto);
    waitUntilBridgeIngressDoesntExist(dto);
    // Then
    BridgeIngress bridgeIngress = fetchBridgeIngress(dto);
    assertThat(bridgeIngress).isNull();
}
Also used : BridgeIngress(com.redhat.service.smartevents.shard.operator.resources.BridgeIngress) BridgeDTO(com.redhat.service.smartevents.infra.models.dto.BridgeDTO) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 9 with BridgeIngress

use of com.redhat.service.smartevents.shard.operator.resources.BridgeIngress in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class BridgeIngressControllerTest method testCreateNewBridgeIngress.

@Test
void testCreateNewBridgeIngress() {
    // Given
    BridgeIngress bridgeIngress = buildBridgeIngress();
    deployBridgeIngressSecret(bridgeIngress);
    // When
    UpdateControl<BridgeIngress> updateControl = bridgeIngressController.reconcile(bridgeIngress, null);
    // Then
    assertThat(updateControl.isUpdateStatus()).isTrue();
    assertThat(bridgeIngress.getStatus()).isNotNull();
    assertThat(bridgeIngress.getStatus().isReady()).isFalse();
    assertThat(bridgeIngress.getStatus().getConditionByType(ConditionType.Augmentation)).isPresent().hasValueSatisfying(c -> {
        assertThat(c.getStatus()).isEqualTo(ConditionStatus.False);
    });
    assertThat(bridgeIngress.getStatus().getConditionByType(ConditionType.Ready)).isPresent().hasValueSatisfying(c -> {
        assertThat(c.getStatus()).isEqualTo(ConditionStatus.False);
        assertThat(c.getReason()).isEqualTo(ConditionReason.DeploymentNotAvailable);
    });
}
Also used : BridgeIngress(com.redhat.service.smartevents.shard.operator.resources.BridgeIngress) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 10 with BridgeIngress

use of com.redhat.service.smartevents.shard.operator.resources.BridgeIngress in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class BridgeIngressControllerTest method testBridgeIngressNewImage.

@Test
void testBridgeIngressNewImage() {
    // Given
    BridgeIngress bridgeIngress = buildBridgeIngress();
    String oldImage = "oldImage";
    bridgeIngress.getSpec().setImage(oldImage);
    deployBridgeIngressSecret(bridgeIngress);
    // When
    UpdateControl<BridgeIngress> updateControl = bridgeIngressController.reconcile(bridgeIngress, null);
    // Then
    assertThat(updateControl.isUpdateResource()).isTrue();
    // Should be restored
    assertThat(updateControl.getResource().getSpec().getImage()).isEqualTo(TestSupport.INGRESS_IMAGE);
}
Also used : BridgeIngress(com.redhat.service.smartevents.shard.operator.resources.BridgeIngress) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Aggregations

BridgeIngress (com.redhat.service.smartevents.shard.operator.resources.BridgeIngress)19 QuarkusTest (io.quarkus.test.junit.QuarkusTest)12 Test (org.junit.jupiter.api.Test)12 BridgeDTO (com.redhat.service.smartevents.infra.models.dto.BridgeDTO)6 Secret (io.fabric8.kubernetes.api.model.Secret)4 Deployment (io.fabric8.kubernetes.api.model.apps.Deployment)4 Ingress (io.fabric8.kubernetes.api.model.networking.v1.Ingress)3 Namespace (io.fabric8.kubernetes.api.model.Namespace)2 ObjectMetaBuilder (io.fabric8.kubernetes.api.model.ObjectMetaBuilder)2 SecretBuilder (io.fabric8.kubernetes.api.model.SecretBuilder)2 BridgeIngressService (com.redhat.service.smartevents.shard.operator.BridgeIngressService)1 WithPrometheus (com.redhat.service.smartevents.shard.operator.WithPrometheus)1 LabelsBuilder (com.redhat.service.smartevents.shard.operator.utils.LabelsBuilder)1 When (io.cucumber.java.en.When)1 Service (io.fabric8.kubernetes.api.model.Service)1 HTTPIngressPath (io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressPath)1 HTTPIngressPathBuilder (io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressPathBuilder)1 HTTPIngressRuleValueBuilder (io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressRuleValueBuilder)1 IngressBackend (io.fabric8.kubernetes.api.model.networking.v1.IngressBackend)1 IngressBackendBuilder (io.fabric8.kubernetes.api.model.networking.v1.IngressBackendBuilder)1