From f5c1af824375746d73350088995d420141bb2c2e Mon Sep 17 00:00:00 2001 From: Corneil du Plessis Date: Wed, 7 Aug 2024 10:43:31 +0200 Subject: [PATCH] Added volumes and additional containers to test that both are mapped. --- .../spi/kubernetes/KubernetesAppDeployerTests.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spring-cloud-deployer-kubernetes/src/test/java/org/springframework/cloud/deployer/spi/kubernetes/KubernetesAppDeployerTests.java b/spring-cloud-deployer-kubernetes/src/test/java/org/springframework/cloud/deployer/spi/kubernetes/KubernetesAppDeployerTests.java index b4bbb798..8a3ac6c1 100644 --- a/spring-cloud-deployer-kubernetes/src/test/java/org/springframework/cloud/deployer/spi/kubernetes/KubernetesAppDeployerTests.java +++ b/spring-cloud-deployer-kubernetes/src/test/java/org/springframework/cloud/deployer/spi/kubernetes/KubernetesAppDeployerTests.java @@ -147,8 +147,8 @@ public void deployWithVolumesAndVolumeMounts() throws Exception { public void deployWithVolumesAndVolumeMountsOnAdditionalContainer() throws Exception { AppDefinition definition = new AppDefinition("app-test", null); Map props = new HashMap<>(); - props.put("spring.cloud.deployer.kubernetes.volumes", "[{name: 'config', configMap: {name: promtail-config, items: [{key: promtail.yaml, path: promtail.yaml}]}}]"); - props.put("spring.cloud.deployer.kubernetes.additional-containers", "[{name: 'promtail',image: image-path-of-promtail, ports:[{protocol: TCP,containerPort: 8080}],args: [\"-config.file=/home/conf/promtail.yaml\"],volumeMounts: [{name: 'config', mountPath: '/home/conf'}]}]"); + props.put("spring.cloud.deployer.kubernetes.volumes", "[{name: 'config', configMap: {name: promtail-config, items: [{key: promtail.yaml, path: promtail.yaml}]}},{name: 'config2', configMap: {name: promtail-config, items: [{key: promtail.yaml, path: promtail.yaml}]}}]"); + props.put("spring.cloud.deployer.kubernetes.additional-containers", "[{name: 'promtail',image: image-path-of-promtail, ports:[{protocol: TCP,containerPort: 8080}],args: [\"-config.file=/home/conf/promtail.yaml\"],volumeMounts: [{name: 'config', mountPath: '/home/conf'}]},{name: 'promtail2',image: image-path-of-promtail, ports:[{protocol: TCP,containerPort: 8080}],args: [\"-config.file=/home/conf/promtail.yaml\"],volumeMounts: [{name: 'config2', mountPath: '/home/conf'}]}]"); AppDeploymentRequest appDeploymentRequest = new AppDeploymentRequest(definition, getResource(), props); deployer = k8sAppDeployer(); @@ -159,7 +159,9 @@ public void deployWithVolumesAndVolumeMountsOnAdditionalContainer() throws Excep .withItems(new KeyToPath("promtail.yaml", null, "promtail.yaml")) .build(); Volume volume = new VolumeBuilder().withName("config").withNewConfigMapLike(configMapVolumeSource).endConfigMap().build(); - assertThat(podSpec.getVolumes()).containsOnly(volume); + Volume volume2 = new VolumeBuilder().withName("config2").withNewConfigMapLike(configMapVolumeSource).endConfigMap().build(); + assertThat(podSpec.getVolumes()).containsExactly(volume, volume2); + } @Test