use of com.redhat.service.bridge.shard.operator.resources.BridgeExecutor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgeExecutorControllerTest method testBridgeExecutorDeployment_deploymentReplicaFailure.
@Test
void testBridgeExecutorDeployment_deploymentReplicaFailure() throws Exception {
// Given
BridgeExecutor bridgeExecutor = buildBridgeExecutor();
deployBridgeExecutorSecret(bridgeExecutor);
// When
bridgeExecutorController.reconcile(bridgeExecutor, null);
Deployment deployment = getDeploymentFor(bridgeExecutor);
// Then
kubernetesResourcePatcher.patchDeploymentAsReplicaFailed(deployment.getMetadata().getName(), deployment.getMetadata().getNamespace());
UpdateControl<BridgeExecutor> updateControl = bridgeExecutorController.reconcile(bridgeExecutor, 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.bridge.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.bridge.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.bridge.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();
}
use of com.redhat.service.bridge.shard.operator.resources.BridgeExecutor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgeExecutorServiceImpl method createBridgeExecutor.
@Override
public void createBridgeExecutor(ProcessorDTO processorDTO) {
final Namespace namespace = customerNamespaceProvider.fetchOrCreateCustomerNamespace(processorDTO.getCustomerId());
BridgeExecutor expected = BridgeExecutor.fromDTO(processorDTO, namespace.getMetadata().getName(), executorImage);
BridgeExecutor existing = kubernetesClient.resources(BridgeExecutor.class).inNamespace(namespace.getMetadata().getName()).withName(BridgeExecutor.resolveResourceName(processorDTO.getId())).get();
if (existing == null || !expected.getSpec().equals(existing.getSpec())) {
BridgeExecutor bridgeExecutor = kubernetesClient.resources(BridgeExecutor.class).inNamespace(namespace.getMetadata().getName()).createOrReplace(expected);
// create or update the secrets for the bridgeExecutor
createOrUpdateBridgeExecutorSecret(bridgeExecutor, processorDTO);
}
}
Aggregations