use of com.redhat.service.smartevents.shard.operator.resources.BridgeExecutor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgeExecutorServiceTest method testBridgeExecutorCreation.
@Test
public void testBridgeExecutorCreation() {
// Given
ProcessorDTO dto = TestSupport.newRequestedProcessorDTO();
// When
bridgeExecutorService.createBridgeExecutor(dto);
// Then
BridgeExecutor bridgeExecutor = kubernetesClient.resources(BridgeExecutor.class).inNamespace(customerNamespaceProvider.resolveName(dto.getCustomerId())).withName(BridgeExecutor.resolveResourceName(dto.getId())).get();
assertThat(bridgeExecutor).isNotNull();
assertThat(bridgeExecutor.getSpec().getOwner()).isEqualTo(dto.getOwner());
Secret secret = fetchBridgeExecutorSecret(dto);
assertThat(secret).isNotNull();
assertThat(secret.getMetadata().getName()).isEqualTo(bridgeExecutor.getMetadata().getName());
assertThat(secret.getData().get(GlobalConfigurationsConstants.KAFKA_BOOTSTRAP_SERVERS_ENV_VAR)).isNotEmpty();
assertThat(secret.getData().get(GlobalConfigurationsConstants.KAFKA_CLIENT_ID_ENV_VAR)).isNotEmpty();
assertThat(secret.getData().get(GlobalConfigurationsConstants.KAFKA_CLIENT_SECRET_ENV_VAR)).isNotEmpty();
assertThat(secret.getData().get(GlobalConfigurationsConstants.KAFKA_SECURITY_PROTOCOL_ENV_VAR)).isNotEmpty();
assertThat(secret.getData().get(GlobalConfigurationsConstants.KAFKA_TOPIC_ENV_VAR)).isNotEmpty();
assertThat(secret.getData().get(GlobalConfigurationsConstants.KAFKA_ERROR_STRATEGY_ENV_VAR)).isNotEmpty();
assertThat(secret.getData().get(GlobalConfigurationsConstants.KAFKA_ERROR_TOPIC_ENV_VAR)).isNotEmpty();
assertThat(secret.getData().get(GlobalConfigurationsConstants.KAFKA_GROUP_ID_ENV_VAR)).isNotEmpty();
}
use of com.redhat.service.smartevents.shard.operator.resources.BridgeExecutor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgeExecutorControllerTest method testBridgeExecutorDeployment.
@Test
void testBridgeExecutorDeployment() {
// Given
BridgeExecutor bridgeExecutor = buildBridgeExecutor();
deployBridgeExecutorSecret(bridgeExecutor);
// When
bridgeExecutorController.reconcile(bridgeExecutor, null);
// Then
Deployment deployment = kubernetesClient.apps().deployments().inNamespace(bridgeExecutor.getMetadata().getNamespace()).withName(bridgeExecutor.getMetadata().getName()).get();
assertThat(deployment).isNotNull();
assertThat(deployment.getMetadata().getOwnerReferences().size()).isEqualTo(1);
assertThat(deployment.getMetadata().getLabels()).isNotNull();
assertThat(deployment.getSpec().getSelector().getMatchLabels().size()).isEqualTo(1);
assertThat(deployment.getSpec().getTemplate().getMetadata().getLabels()).isNotNull();
assertThat(deployment.getSpec().getTemplate().getSpec().getContainers().get(0).getImage()).isNotNull();
assertThat(deployment.getSpec().getTemplate().getSpec().getContainers().get(0).getName()).isNotNull();
}
use of com.redhat.service.smartevents.shard.operator.resources.BridgeExecutor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgeExecutorControllerTest method testBridgeExecutorNewImage.
@Test
void testBridgeExecutorNewImage() {
// Given
BridgeExecutor bridgeExecutor = buildBridgeExecutor();
String oldImage = "oldImage";
bridgeExecutor.getSpec().setImage(oldImage);
deployBridgeExecutorSecret(bridgeExecutor);
// When
UpdateControl<BridgeExecutor> updateControl = bridgeExecutorController.reconcile(bridgeExecutor, null);
// Then
assertThat(updateControl.isUpdateResource()).isTrue();
// Should be restored
assertThat(updateControl.getResource().getSpec().getImage()).isEqualTo(TestSupport.EXECUTOR_IMAGE);
}
use of com.redhat.service.smartevents.shard.operator.resources.BridgeExecutor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgeExecutorControllerTest method testCreateNewBridgeExecutorWithoutSecrets.
@Test
void testCreateNewBridgeExecutorWithoutSecrets() {
// Given
BridgeExecutor bridgeExecutor = buildBridgeExecutor();
// When
UpdateControl<BridgeExecutor> updateControl = bridgeExecutorController.reconcile(bridgeExecutor, null);
// Then
assertThat(updateControl.isNoUpdate()).isTrue();
}
use of com.redhat.service.smartevents.shard.operator.resources.BridgeExecutor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgeExecutorServiceTest method testBridgeIngressDeletion.
@Test
public void testBridgeIngressDeletion() {
// Given
ProcessorDTO dto = TestSupport.newRequestedProcessorDTO();
// When
bridgeExecutorService.createBridgeExecutor(dto);
bridgeExecutorService.deleteBridgeExecutor(dto);
// Then
BridgeExecutor bridgeExecutor = kubernetesClient.resources(BridgeExecutor.class).inNamespace(customerNamespaceProvider.resolveName(dto.getCustomerId())).withName(BridgeExecutor.resolveResourceName(dto.getId())).get();
assertThat(bridgeExecutor).isNull();
}
Aggregations