use of com.bakdata.quick.common.api.model.manager.creation.MirrorCreationData in project quick by bakdata.
the class ImageUpdaterTest method shouldNotUpdateFixedMirror.
@Test
void shouldNotUpdateFixedMirror() {
final MirrorResourceLoader loader = new MirrorResourceLoader(new KubernetesResources(), this.getDeploymentConfig(), this.getResourceConfig());
final MirrorService mirrorService = new KubernetesMirrorService(new KubernetesResources(), this.getManagerClient(), this.getDeploymentConfig(), loader);
final MirrorCreationData mirrorCreationData = new MirrorCreationData("topic", "service", 1, // use default tag
FIXED_TAG, null);
mirrorService.createMirror(mirrorCreationData).blockingAwait();
assertThat(this.getDeployments()).hasSize(1).first().extracting(ImageUpdaterTest::getContainerImage).isEqualTo(String.format("%s/%s:%s", DOCKER_REGISTRY, MIRROR_IMAGE, FIXED_TAG));
final DeploymentConfig newDeploymentConfig = this.createNewDeploymentConfig();
final ImageUpdater imageUpdater = new ImageUpdater(this.client, newDeploymentConfig);
imageUpdater.updateManagedDeployments();
assertThat(this.getDeployments()).hasSize(1).first().extracting(ImageUpdaterTest::getContainerImage).isEqualTo(String.format("%s/%s:%s", DOCKER_REGISTRY, MIRROR_IMAGE, FIXED_TAG));
}
use of com.bakdata.quick.common.api.model.manager.creation.MirrorCreationData in project quick by bakdata.
the class ImageUpdaterTest method shouldUpdateMirror.
@Test
void shouldUpdateMirror() {
final MirrorResourceLoader loader = new MirrorResourceLoader(new KubernetesResources(), this.getDeploymentConfig(), this.getResourceConfig());
final MirrorService mirrorService = new KubernetesMirrorService(new KubernetesResources(), this.getManagerClient(), this.getDeploymentConfig(), loader);
final MirrorCreationData mirrorCreationData = new MirrorCreationData("topic", "service", 1, // use default tag
null, null);
mirrorService.createMirror(mirrorCreationData).blockingAwait();
assertThat(this.getDeployments()).hasSize(1).first().extracting(ImageUpdaterTest::getContainerImage).isEqualTo(String.format("%s/%s:%s", DOCKER_REGISTRY, MIRROR_IMAGE, DEFAULT_IMAGE_TAG));
final DeploymentConfig newDeploymentConfig = this.createNewDeploymentConfig();
final ImageUpdater imageUpdater = new ImageUpdater(this.client, newDeploymentConfig);
imageUpdater.updateManagedDeployments();
assertThat(this.getDeployments()).hasSize(1).first().extracting(ImageUpdaterTest::getContainerImage).isEqualTo(String.format("%s/%s:%s", DOCKER_REGISTRY, MIRROR_IMAGE, NEW_TAG));
}
use of com.bakdata.quick.common.api.model.manager.creation.MirrorCreationData in project quick by bakdata.
the class MirrorControllerTest method shouldCreateMirrorWithDefaultReplica.
@Test
void shouldCreateMirrorWithDefaultReplica() {
when(this.service.createMirror(any())).thenReturn(Completable.complete());
final MirrorCreationData mirrorCreationData = new MirrorCreationData(NAME, NAME, DEFAULT_REPLICA, TAG, null);
this.httpClient.toBlocking().exchange(POST("topic/mirror", mirrorCreationData));
verify(this.service).createMirror(mirrorCreationData);
}
use of com.bakdata.quick.common.api.model.manager.creation.MirrorCreationData in project quick by bakdata.
the class KubernetesMirrorServiceTest method shouldDeleteService.
@Test
void shouldDeleteService() {
final MirrorCreationData mirrorCreationData = new MirrorCreationData(TOPIC_NAME, TOPIC_NAME, 1, null, null);
this.createMirror(mirrorCreationData);
assertThat(this.getServices()).isNotNull().hasSize(1);
final Completable deleteRequest = this.mirrorService.deleteMirror(TOPIC_NAME);
Optional.ofNullable(deleteRequest.blockingGet()).ifPresent(Assertions::fail);
assertThat(this.getServices()).isNullOrEmpty();
}
use of com.bakdata.quick.common.api.model.manager.creation.MirrorCreationData in project quick by bakdata.
the class KubernetesMirrorServiceTest method shouldRejectDuplicateMirrorCreation.
@Test
void shouldRejectDuplicateMirrorCreation() {
final MirrorCreationData mirrorCreationData = new MirrorCreationData(TOPIC_NAME, TOPIC_NAME, 1, null, null);
final Throwable firstDeployment = this.mirrorService.createMirror(mirrorCreationData).blockingGet();
assertThat(firstDeployment).isNull();
final Throwable invalidDeployment = this.mirrorService.createMirror(mirrorCreationData).blockingGet();
assertThat(invalidDeployment).isInstanceOf(BadArgumentException.class).hasMessageContaining(String.format("The resource with the name %s already exists", TOPIC_NAME));
}
Aggregations