use of com.bakdata.quick.manager.k8s.KubernetesResources in project quick by bakdata.
the class ImageUpdaterTest method shouldUpdateMultipleGateways.
@Test
void shouldUpdateMultipleGateways() {
final GatewayClient gatewayClient = Mockito.mock(GatewayClient.class);
final GatewayResourceLoader loader = new GatewayResourceLoader(new KubernetesResources(), this.getDeploymentConfig(), this.getResourceConfig(), NAMESPACE);
final GatewayService gatewayService = new KubernetesGatewayService(this.getManagerClient(), gatewayClient, new GraphQLToAvroConverter("test.avro"), loader);
Completable.mergeArray(gatewayService.createGateway(new GatewayCreationData("gateway", 1, null, null)), gatewayService.createGateway(new GatewayCreationData("gateway2", 1, null, null))).blockingAwait();
assertThat(this.getDeployments()).hasSize(2).extracting(ImageUpdaterTest::getContainerImage).allMatch(name -> name.equals(String.format("%s/%s:%s", DOCKER_REGISTRY, GatewayResources.GATEWAY_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, GatewayResources.GATEWAY_IMAGE, NEW_TAG)));
}
use of com.bakdata.quick.manager.k8s.KubernetesResources in project quick by bakdata.
the class ImageUpdaterTest method shouldNotUpdateFixedGateway.
@Test
void shouldNotUpdateFixedGateway() {
final GatewayClient gatewayClient = Mockito.mock(GatewayClient.class);
final GatewayResourceLoader loader = new GatewayResourceLoader(new KubernetesResources(), this.getDeploymentConfig(), this.getResourceConfig(), NAMESPACE);
final GatewayService gatewayService = new KubernetesGatewayService(this.getManagerClient(), gatewayClient, new GraphQLToAvroConverter("test.avro"), loader);
gatewayService.createGateway(new GatewayCreationData("gateway", 1, FIXED_TAG, null)).blockingAwait();
assertThat(this.getDeployments()).hasSize(1).first().extracting(ImageUpdaterTest::getContainerImage).isEqualTo(String.format("%s/%s:%s", DOCKER_REGISTRY, GatewayResources.GATEWAY_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, GatewayResources.GATEWAY_IMAGE, FIXED_TAG));
}
use of com.bakdata.quick.manager.k8s.KubernetesResources in project quick by bakdata.
the class ImageUpdaterTest method shouldUpdateGateway.
@Test
void shouldUpdateGateway() {
final GatewayClient gatewayClient = Mockito.mock(GatewayClient.class);
final GatewayResourceLoader loader = new GatewayResourceLoader(new KubernetesResources(), this.getDeploymentConfig(), this.getResourceConfig(), NAMESPACE);
final GatewayService gatewayService = new KubernetesGatewayService(this.getManagerClient(), gatewayClient, new GraphQLToAvroConverter("test.avro"), loader);
gatewayService.createGateway(new GatewayCreationData("gateway", 1, null, null)).blockingAwait();
assertThat(this.getDeployments()).hasSize(1).first().extracting(ImageUpdaterTest::getContainerImage).isEqualTo(String.format("%s/%s:%s", DOCKER_REGISTRY, GatewayResources.GATEWAY_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, GatewayResources.GATEWAY_IMAGE, NEW_TAG));
}
use of com.bakdata.quick.manager.k8s.KubernetesResources 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)));
}
use of com.bakdata.quick.manager.k8s.KubernetesResources 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));
}
Aggregations