use of com.bakdata.quick.common.api.model.manager.creation.MirrorCreationData in project quick by bakdata.
the class MirrorResourceLoaderTest method shouldCreateDeploymentWithCustomTag.
@Test
void shouldCreateDeploymentWithCustomTag() {
final String customTag = "my-tag";
final MirrorCreationData mirrorCreationData = new MirrorCreationData(DEFAULT_NAME, DEFAULT_TOPIC_NAME, 1, customTag, null);
final MirrorResources mirrorResources = this.loader.forCreation(mirrorCreationData, ResourcePrefix.MIRROR);
final Optional<HasMetadata> hasMetadata = findResource(mirrorResources, ResourceKind.DEPLOYMENT);
assertThat(hasMetadata).isPresent().get(InstanceOfAssertFactories.type(Deployment.class)).satisfies(deployment -> {
final PodSpec podSpec = deployment.getSpec().getTemplate().getSpec();
assertThat(podSpec.getContainers()).isNotNull().hasSize(1).first().hasFieldOrPropertyWithValue("image", getImage(DOCKER_REGISTRY, EXPECTED_MIRROR_IMAGE, customTag));
});
}
use of com.bakdata.quick.common.api.model.manager.creation.MirrorCreationData in project quick by bakdata.
the class MirrorResourceLoaderTest method shouldCreateServiceWithCustomTopicName.
@Test
void shouldCreateServiceWithCustomTopicName() {
final String topicName = "__internal-test-topic";
final String name = "test-topic";
final MirrorCreationData mirrorCreationData = new MirrorCreationData(name, topicName, 1, null, null);
final MirrorResources mirrorResources = this.loader.forCreation(mirrorCreationData, ResourcePrefix.MIRROR);
final Optional<HasMetadata> hasMetadata = findResource(mirrorResources, ResourceKind.SERVICE);
assertThat(hasMetadata).isPresent().get(InstanceOfAssertFactories.type(Service.class)).satisfies(service -> {
final String deploymentName = ResourcePrefix.MIRROR.getPrefix() + name;
assertThat(service.getMetadata()).hasFieldOrPropertyWithValue("name", deploymentName).extracting(ObjectMeta::getLabels, MAP).isNotNull().contains(Map.entry("app.kubernetes.io/name", deploymentName));
final ServiceSpec serviceSpec = service.getSpec();
assertThat(serviceSpec.getSelector()).contains(Map.entry("app.kubernetes.io/name", deploymentName));
});
}
use of com.bakdata.quick.common.api.model.manager.creation.MirrorCreationData in project quick by bakdata.
the class MirrorResourceLoaderTest method shouldSetRetentionTimeForDeployment.
@Test
void shouldSetRetentionTimeForDeployment() {
final Duration retentionTime = Duration.ofHours(1);
final MirrorCreationData mirrorCreationData = new MirrorCreationData(DEFAULT_NAME, DEFAULT_TOPIC_NAME, 1, null, retentionTime);
final MirrorResources mirrorResources = this.loader.forCreation(mirrorCreationData, ResourcePrefix.MIRROR);
final Optional<HasMetadata> hasMetadata = findResource(mirrorResources, ResourceKind.DEPLOYMENT);
assertThat(hasMetadata).isPresent().get(InstanceOfAssertFactories.type(Deployment.class)).satisfies(deployment -> {
final PodSpec podSpec = deployment.getSpec().getTemplate().getSpec();
assertThat(podSpec.getContainers()).isNotNull().hasSize(1).first().extracting(Container::getArgs, LIST).isNotEmpty().contains("--input-topics=" + DEFAULT_TOPIC_NAME).contains("--retention-time=" + retentionTime);
});
}
Aggregations