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);
}
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();
});
}
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();
}
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);
});
}
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);
}
Aggregations