From 417d18033c21bbb7d3e8c3643859245e6f386d79 Mon Sep 17 00:00:00 2001 From: Gaelle Fournier Date: Wed, 19 Jun 2024 15:06:51 +0200 Subject: [PATCH] fix(e2e): Telemetry rest-consumer service name --- e2e/telemetry/telemetry_test.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/e2e/telemetry/telemetry_test.go b/e2e/telemetry/telemetry_test.go index ec3d494c26..a5ad371c3f 100644 --- a/e2e/telemetry/telemetry_test.go +++ b/e2e/telemetry/telemetry_test.go @@ -45,11 +45,18 @@ func TestTelemetryTrait(t *testing.T) { // Create integration and activate traces by telemetry trait - g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/rest-consumer.yaml", "--name", "rest-consumer", "-t", "telemetry.enabled=true", "-t", "telemetry.endpoint=http://opentelemetrycollector.otlp.svc.cluster.local:4317").Execute()).To(Succeed()) + g.Expect(KamelRunWithID(t, ctx, operatorID, ns, + "files/rest-consumer.yaml", "--name", "rest-consumer", + "-t", "telemetry.enabled=true", + "-t", "telemetry.endpoint=http://opentelemetrycollector.otlp:4317").Execute()).To(Succeed()) g.Eventually(IntegrationPodPhase(t, ctx, ns, "rest-consumer"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) name := "Bob" - g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/rest-producer.yaml", "-p", "serviceName=rest-consumer", "-p", "name="+name, "--name", "rest-producer").Execute()).To(Succeed()) + serviceName := fmt.Sprintf("rest-consumer.%s", ns) + g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/rest-producer.yaml", + "-p", fmt.Sprintf("serviceName=%s", serviceName), + "-p", "name="+name, + "--name", "rest-producer").Execute()).To(Succeed()) g.Eventually(IntegrationPodPhase(t, ctx, ns, "rest-producer"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) g.Eventually(IntegrationLogs(t, ctx, ns, "rest-consumer"), TestTimeoutLong).Should(ContainSubstring(fmt.Sprintf("get %s", name))) g.Eventually(IntegrationLogs(t, ctx, ns, "rest-producer"), TestTimeoutLong).Should(ContainSubstring(fmt.Sprintf("%s Doe", name))) @@ -61,7 +68,7 @@ func TestTelemetryTrait(t *testing.T) { // Ensured logs in opentelemetry collector pod are present g.Eventually(TailedLogs(t, ctx, pod.Namespace, pod.Name, 100), TestTimeoutLong).Should(ContainSubstring(fmt.Sprintf("http.target: Str(/customers/%s)", name))) - g.Eventually(TailedLogs(t, ctx, pod.Namespace, pod.Name, 100), TestTimeoutLong).Should(ContainSubstring(fmt.Sprintf("http.url: Str(http://rest-consumer/customers/%s)", name))) + g.Eventually(TailedLogs(t, ctx, pod.Namespace, pod.Name, 100), TestTimeoutLong).Should(ContainSubstring(fmt.Sprintf("http.url: Str(http://%s/customers/%s)", serviceName, name))) // check integration schema does not contains unwanted default trait value. g.Eventually(UnstructuredIntegration(t, ctx, ns, "rest-consumer")).ShouldNot(BeNil())