Skip to content

Commit

Permalink
fix(e2e): Telemetry rest-consumer service name
Browse files Browse the repository at this point in the history
  • Loading branch information
gansheer committed Jun 19, 2024
1 parent bf88ee6 commit 417d180
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions e2e/telemetry/telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand All @@ -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())
Expand Down

0 comments on commit 417d180

Please sign in to comment.