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 authored and squakez committed Jun 24, 2024
1 parent 5e79393 commit f1a3968
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 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 All @@ -70,7 +77,7 @@ func TestTelemetryTrait(t *testing.T) {
g.Expect(builderTrait).NotTo(BeNil())
g.Expect(len(builderTrait)).To(Equal(2))
g.Expect(builderTrait["enabled"]).To(Equal(true))
g.Expect(builderTrait["endpoint"]).To(Equal("http://opentelemetrycollector.otlp.svc.cluster.local:4317"))
g.Expect(builderTrait["endpoint"]).To(Equal("http://opentelemetrycollector.otlp:4317"))

// Clean up
g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed())
Expand Down

0 comments on commit f1a3968

Please sign in to comment.