From 532ba43c475a55a5ccde656af0ff4eb7056d4fbd Mon Sep 17 00:00:00 2001 From: Ioannis Canellos Date: Tue, 30 Jun 2020 16:52:54 +0300 Subject: [PATCH] test (#10620): labels on ingress and routes --- .../KubernetesWithApplicationPropertiesTest.java | 7 +++++++ .../OpenshiftWithApplicationPropertiesTest.java | 12 +++++++++++- .../resources/kubernetes-with-application.properties | 1 + .../resources/openshift-with-application.properties | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithApplicationPropertiesTest.java b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithApplicationPropertiesTest.java index 81dae05cb9f5e..4bcd2a8e9954f 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithApplicationPropertiesTest.java +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithApplicationPropertiesTest.java @@ -96,6 +96,13 @@ public void assertGeneratedResources() throws IOException { assertThat(kubernetesList).filteredOn(i -> "Ingress".equals(i.getKind())).hasOnlyOneElementSatisfying(i -> { assertThat(i).isInstanceOfSatisfying(Ingress.class, in -> { + //Check that lables and annotations are also applied to Ingresses (#10260) + assertThat(i.getMetadata()).satisfies(m -> { + assertThat(m.getName()).isEqualTo("test-it"); + assertThat(m.getLabels()).contains(entry("foo", "bar")); + assertThat(m.getAnnotations()).contains(entry("bar", "baz")); + }); + assertThat(in.getSpec().getRules()).hasOnlyOneElementSatisfying(r -> { assertThat(r.getHost()).isEqualTo("example.com"); }); diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/OpenshiftWithApplicationPropertiesTest.java b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/OpenshiftWithApplicationPropertiesTest.java index ebd8cf9557249..1c8318dd2c2f5 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/OpenshiftWithApplicationPropertiesTest.java +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/OpenshiftWithApplicationPropertiesTest.java @@ -16,6 +16,7 @@ import io.fabric8.kubernetes.api.model.HasMetadata; import io.fabric8.kubernetes.api.model.PodSpec; import io.fabric8.kubernetes.api.model.Service; +import io.fabric8.openshift.api.model.Route; import io.quarkus.test.ProdBuildResults; import io.quarkus.test.ProdModeTestResults; import io.quarkus.test.QuarkusProdModeTest; @@ -66,6 +67,15 @@ public void assertGeneratedResources() throws IOException { }); }); - assertThat(openshiftList).filteredOn(h -> "Route".equals(h.getKind())).hasSize(1); + assertThat(openshiftList).filteredOn(i -> "Route".equals(i.getKind())).hasOnlyOneElementSatisfying(i -> { + assertThat(i).isInstanceOfSatisfying(Route.class, in -> { + //Check that lables and annotations are also applied to Routes (#10260) + assertThat(i.getMetadata()).satisfies(m -> { + assertThat(m.getName()).isEqualTo("test-it"); + assertThat(m.getLabels()).contains(entry("foo", "bar")); + assertThat(m.getAnnotations()).contains(entry("bar", "baz")); + }); + }); + }); } } diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/resources/kubernetes-with-application.properties b/integration-tests/kubernetes/quarkus-standard-way/src/test/resources/kubernetes-with-application.properties index c188cc754f209..567a3a6d8113b 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/resources/kubernetes-with-application.properties +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/resources/kubernetes-with-application.properties @@ -1,6 +1,7 @@ quarkus.http.port=9090 quarkus.kubernetes.name=test-it quarkus.kubernetes.labels.foo=bar +quarkus.kubernetes.annotations.bar=baz quarkus.kubernetes.env-vars.my-env-var.value=SOMEVALUE quarkus.kubernetes.env-vars.my-name.field=metadata.name quarkus.container-image.group=grp diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/resources/openshift-with-application.properties b/integration-tests/kubernetes/quarkus-standard-way/src/test/resources/openshift-with-application.properties index 0bf9466a1fec0..321fc5d18337d 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/resources/openshift-with-application.properties +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/resources/openshift-with-application.properties @@ -2,6 +2,7 @@ quarkus.http.port=9090 quarkus.kubernetes.deployment-target=openshift quarkus.openshift.name=test-it quarkus.openshift.labels.foo=bar +quarkus.openshift.annotations.bar=baz quarkus.openshift.env-vars.my-env-var.value=SOMEVALUE quarkus.openshift.group=grp quarkus.openshift.expose=true