Search in sources :

Example 1 with ApplicationCreationData

use of com.bakdata.quick.common.api.model.manager.creation.ApplicationCreationData in project quick by bakdata.

the class ApplicationControllerTest method shouldDeployApplication.

@Test
void shouldDeployApplication() {
    final ApplicationCreationData applicationCreationData = new ApplicationCreationData(NAME, REGISTRY, IMAGE_NAME, TAG, REPLICAS, PORT, null, ARGS);
    when(this.service.deployApplication(applicationCreationData)).thenReturn(Completable.complete());
    final Completable completable = this.applicationClient.deployApplication(applicationCreationData);
    Optional.ofNullable(completable.blockingGet()).ifPresent(Assertions::fail);
}
Also used : Completable(io.reactivex.Completable) ApplicationCreationData(com.bakdata.quick.common.api.model.manager.creation.ApplicationCreationData) Assertions(org.junit.jupiter.api.Assertions) Test(org.junit.jupiter.api.Test) MicronautTest(io.micronaut.test.extensions.junit5.annotation.MicronautTest)

Example 2 with ApplicationCreationData

use of com.bakdata.quick.common.api.model.manager.creation.ApplicationCreationData in project quick by bakdata.

the class ApplicationControllerTest method shouldCallDeployApplication.

@Test
void shouldCallDeployApplication() {
    final ApplicationCreationData applicationCreationData = new ApplicationCreationData(NAME, REGISTRY, IMAGE_NAME, TAG, REPLICAS, PORT, null, ARGS);
    when(this.service.deployApplication(applicationCreationData)).thenReturn(Completable.complete());
    this.httpClient.toBlocking().exchange(POST("/application/", applicationCreationData));
    verify(this.service).deployApplication(applicationCreationData);
}
Also used : ApplicationCreationData(com.bakdata.quick.common.api.model.manager.creation.ApplicationCreationData) Test(org.junit.jupiter.api.Test) MicronautTest(io.micronaut.test.extensions.junit5.annotation.MicronautTest)

Example 3 with ApplicationCreationData

use of com.bakdata.quick.common.api.model.manager.creation.ApplicationCreationData in project quick by bakdata.

the class KubernetesApplicationServiceTest method deployApplication.

private void deployApplication(@Nullable final Integer port, final Map<String, String> arguments) {
    final ApplicationCreationData applicationCreationData = new ApplicationCreationData(APP_NAME, DOCKER_REGISTRY, IMAGE_NAME, DEFAULT_IMAGE_TAG, 1, port, null, arguments);
    final Completable completable = this.service.deployApplication(applicationCreationData);
    Optional.ofNullable(completable.blockingGet()).ifPresent(Assertions::fail);
}
Also used : Completable(io.reactivex.Completable) ApplicationCreationData(com.bakdata.quick.common.api.model.manager.creation.ApplicationCreationData) Assertions(org.junit.jupiter.api.Assertions)

Example 4 with ApplicationCreationData

use of com.bakdata.quick.common.api.model.manager.creation.ApplicationCreationData in project quick by bakdata.

the class KubernetesApplicationServiceTest method shouldRejectDuplicateApplicationCreation.

@Test
void shouldRejectDuplicateApplicationCreation() {
    final ApplicationCreationData applicationCreationData = new ApplicationCreationData(APP_NAME, DOCKER_REGISTRY, IMAGE_NAME, DEFAULT_IMAGE_TAG, 1, DEFAULT_PORT, null, Map.of());
    final Completable firstDeployment = this.service.deployApplication(applicationCreationData);
    Optional.ofNullable(firstDeployment.blockingGet()).ifPresent(Assertions::fail);
    final Throwable invalidDeployment = this.service.deployApplication(applicationCreationData).blockingGet();
    assertThat(invalidDeployment).isInstanceOf(BadArgumentException.class).hasMessageContaining(String.format("The resource with the name %s already exists", APP_NAME));
}
Also used : BadArgumentException(com.bakdata.quick.common.exception.BadArgumentException) Completable(io.reactivex.Completable) ApplicationCreationData(com.bakdata.quick.common.api.model.manager.creation.ApplicationCreationData) Assertions(org.junit.jupiter.api.Assertions) KubernetesTest(com.bakdata.quick.manager.k8s.KubernetesTest) Test(org.junit.jupiter.api.Test)

Aggregations

ApplicationCreationData (com.bakdata.quick.common.api.model.manager.creation.ApplicationCreationData)4 Completable (io.reactivex.Completable)3 Assertions (org.junit.jupiter.api.Assertions)3 Test (org.junit.jupiter.api.Test)3 MicronautTest (io.micronaut.test.extensions.junit5.annotation.MicronautTest)2 BadArgumentException (com.bakdata.quick.common.exception.BadArgumentException)1 KubernetesTest (com.bakdata.quick.manager.k8s.KubernetesTest)1