use of com.redhat.service.smartevents.shard.operator.resources.BridgeIngress in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgeIngressServiceTest method testBridgeIngressCreation.
@Test
public void testBridgeIngressCreation() {
// Given
BridgeDTO dto = TestSupport.newProvisioningBridgeDTO();
// When
bridgeIngressService.createBridgeIngress(dto);
waitUntilBridgeIngressExists(dto);
// Then
BridgeIngress bridgeIngress = fetchBridgeIngress(dto);
assertThat(bridgeIngress).isNotNull();
Secret secret = fetchBridgeIngressSecret(dto);
assertThat(secret).isNotNull();
assertThat(secret.getMetadata().getName()).isEqualTo(bridgeIngress.getMetadata().getName());
assertThat(secret.getData().get(GlobalConfigurationsConstants.KAFKA_BOOTSTRAP_SERVERS_ENV_VAR).length()).isGreaterThan(0);
assertThat(secret.getData().get(GlobalConfigurationsConstants.KAFKA_CLIENT_ID_ENV_VAR).length()).isGreaterThan(0);
assertThat(secret.getData().get(GlobalConfigurationsConstants.KAFKA_CLIENT_SECRET_ENV_VAR).length()).isGreaterThan(0);
assertThat(secret.getData().get(GlobalConfigurationsConstants.KAFKA_SECURITY_PROTOCOL_ENV_VAR).length()).isGreaterThan(0);
assertThat(secret.getData().get(GlobalConfigurationsConstants.KAFKA_TOPIC_ENV_VAR).length()).isGreaterThan(0);
}
use of com.redhat.service.smartevents.shard.operator.resources.BridgeIngress in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgeIngressServiceTest method waitUntilBridgeIngressDoesntExist.
private void waitUntilBridgeIngressDoesntExist(BridgeDTO dto) {
Awaitility.await().atMost(Duration.ofSeconds(30)).pollInterval(Duration.ofMillis(200)).untilAsserted(() -> {
BridgeIngress bridgeIngress = fetchBridgeIngress(dto);
assertThat(bridgeIngress).isNull();
});
}
use of com.redhat.service.smartevents.shard.operator.resources.BridgeIngress in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgeIngressServiceTest method testBridgeIngressRedeployment.
@Test
public void testBridgeIngressRedeployment() {
// Given
BridgeDTO dto = TestSupport.newProvisioningBridgeDTO();
String patchedCustomerId = TestSupport.CUSTOMER_ID + "-patched";
// When
bridgeIngressService.createBridgeIngress(dto);
waitUntilBridgeIngressExists(dto);
dto.setCustomerId(patchedCustomerId);
bridgeIngressService.createBridgeIngress(dto);
waitUntilBridgeIngressExists(dto);
// Then
BridgeIngress bridgeIngress = fetchBridgeIngress(dto);
assertThat(bridgeIngress).isNotNull();
assertThat(bridgeIngress.getSpec().getCustomerId()).isEqualTo(patchedCustomerId);
assertThat(bridgeIngress.getSpec().getOwner()).isEqualTo(dto.getOwner());
Secret secret = fetchBridgeIngressSecret(dto);
assertThat(secret).isNotNull();
assertThat(secret.getMetadata().getName()).isEqualTo(bridgeIngress.getMetadata().getName());
}
use of com.redhat.service.smartevents.shard.operator.resources.BridgeIngress in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class KubernetesNetworkingService method fetchOrCreateNetworkIngress.
@Override
public NetworkResource fetchOrCreateNetworkIngress(BridgeIngress bridgeIngress, Service service) {
Ingress expected = buildIngress(bridgeIngress, service);
Ingress existing = client.network().v1().ingresses().inNamespace(service.getMetadata().getNamespace()).withName(service.getMetadata().getName()).get();
if (existing == null || !expected.getSpec().equals(existing.getSpec())) {
client.network().v1().ingresses().inNamespace(service.getMetadata().getNamespace()).withName(service.getMetadata().getName()).createOrReplace(expected);
return buildNetworkingResource(expected);
}
return buildNetworkingResource(existing);
}
Aggregations