Search in sources :

Example 1 with MirrorResourceLoader

use of com.bakdata.quick.manager.mirror.resources.MirrorResourceLoader in project quick by bakdata.

the class KubernetesMirrorServiceTest method setUp.

@BeforeEach
void setUp() {
    final MirrorResourceLoader loader = new MirrorResourceLoader(new KubernetesResources(), this.getDeploymentConfig(), this.getResourceConfig());
    this.mirrorService = new KubernetesMirrorService(new KubernetesResources(), this.getManagerClient(), this.getDeploymentConfig(), loader);
}
Also used : MirrorResourceLoader(com.bakdata.quick.manager.mirror.resources.MirrorResourceLoader) KubernetesResources(com.bakdata.quick.manager.k8s.KubernetesResources) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with MirrorResourceLoader

use of com.bakdata.quick.manager.mirror.resources.MirrorResourceLoader in project quick by bakdata.

the class ImageUpdaterTest method shouldUpdateMultipleMirrors.

@Test
void shouldUpdateMultipleMirrors() {
    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 mirrorCreationData1 = new MirrorCreationData("topic", "service", 1, // use default tag
    null, null);
    mirrorService.createMirror(mirrorCreationData1).blockingAwait();
    final MirrorCreationData mirrorCreationData2 = new MirrorCreationData("topic2", "service2", 1, // use default tag
    null, null);
    mirrorService.createMirror(mirrorCreationData2).blockingAwait();
    assertThat(this.getDeployments()).hasSize(2).extracting(ImageUpdaterTest::getContainerImage).allMatch(name -> name.equals(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(2).extracting(ImageUpdaterTest::getContainerImage).allMatch(name -> name.equals(String.format("%s/%s:%s", DOCKER_REGISTRY, MIRROR_IMAGE, NEW_TAG)));
}
Also used : MirrorResourceLoader(com.bakdata.quick.manager.mirror.resources.MirrorResourceLoader) KubernetesMirrorService(com.bakdata.quick.manager.mirror.KubernetesMirrorService) MirrorService(com.bakdata.quick.manager.mirror.MirrorService) KubernetesResources(com.bakdata.quick.manager.k8s.KubernetesResources) KubernetesMirrorService(com.bakdata.quick.manager.mirror.KubernetesMirrorService) DeploymentConfig(com.bakdata.quick.manager.config.DeploymentConfig) MirrorCreationData(com.bakdata.quick.common.api.model.manager.creation.MirrorCreationData) KubernetesTest(com.bakdata.quick.manager.k8s.KubernetesTest) Test(org.junit.jupiter.api.Test)

Example 3 with MirrorResourceLoader

use of com.bakdata.quick.manager.mirror.resources.MirrorResourceLoader 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));
}
Also used : MirrorResourceLoader(com.bakdata.quick.manager.mirror.resources.MirrorResourceLoader) KubernetesMirrorService(com.bakdata.quick.manager.mirror.KubernetesMirrorService) MirrorService(com.bakdata.quick.manager.mirror.MirrorService) KubernetesResources(com.bakdata.quick.manager.k8s.KubernetesResources) KubernetesMirrorService(com.bakdata.quick.manager.mirror.KubernetesMirrorService) DeploymentConfig(com.bakdata.quick.manager.config.DeploymentConfig) MirrorCreationData(com.bakdata.quick.common.api.model.manager.creation.MirrorCreationData) KubernetesTest(com.bakdata.quick.manager.k8s.KubernetesTest) Test(org.junit.jupiter.api.Test)

Example 4 with MirrorResourceLoader

use of com.bakdata.quick.manager.mirror.resources.MirrorResourceLoader 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));
}
Also used : MirrorResourceLoader(com.bakdata.quick.manager.mirror.resources.MirrorResourceLoader) KubernetesMirrorService(com.bakdata.quick.manager.mirror.KubernetesMirrorService) MirrorService(com.bakdata.quick.manager.mirror.MirrorService) KubernetesResources(com.bakdata.quick.manager.k8s.KubernetesResources) KubernetesMirrorService(com.bakdata.quick.manager.mirror.KubernetesMirrorService) DeploymentConfig(com.bakdata.quick.manager.config.DeploymentConfig) MirrorCreationData(com.bakdata.quick.common.api.model.manager.creation.MirrorCreationData) KubernetesTest(com.bakdata.quick.manager.k8s.KubernetesTest) Test(org.junit.jupiter.api.Test)

Aggregations

KubernetesResources (com.bakdata.quick.manager.k8s.KubernetesResources)4 MirrorResourceLoader (com.bakdata.quick.manager.mirror.resources.MirrorResourceLoader)4 MirrorCreationData (com.bakdata.quick.common.api.model.manager.creation.MirrorCreationData)3 DeploymentConfig (com.bakdata.quick.manager.config.DeploymentConfig)3 KubernetesTest (com.bakdata.quick.manager.k8s.KubernetesTest)3 KubernetesMirrorService (com.bakdata.quick.manager.mirror.KubernetesMirrorService)3 MirrorService (com.bakdata.quick.manager.mirror.MirrorService)3 Test (org.junit.jupiter.api.Test)3 BeforeEach (org.junit.jupiter.api.BeforeEach)1