Skip to content

Commit

Permalink
test: Validate Istio metric attributes (#662)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrkl authored Dec 21, 2023
1 parent c7a52aa commit 864ce36
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions test/integration/istio/metrics_istio_input_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,28 @@ var _ = Describe("Metrics Istio Input", Label("metrics"), func() {
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(
ContainMd(ContainMetric(SatisfyAll(
ContainDataPointAttrs(HaveKey(BeElementOf(istioProxyMetricAttributes))),
ContainDataPointAttrs(HaveKeyWithValue("source_workload_namespace", app1Ns)),
))),
ContainMd(SatisfyAll(
ContainResourceAttrs(SatisfyAll(
HaveKeyWithValue("k8s.namespace.name", "app-1"),
HaveKeyWithValue("k8s.pod.name", "destination"),
HaveKeyWithValue("k8s.container.name", "istio-proxy"),
HaveKeyWithValue("service.name", "destination"),
)),
ContainMetric(SatisfyAll(
ContainDataPointAttrs(HaveKey(BeElementOf(istioProxyMetricAttributes))),
ContainDataPointAttrs(HaveKeyWithValue("source_workload_namespace", app1Ns)),
ContainDataPointAttrs(HaveKeyWithValue("destination_workload", "destination")),
ContainDataPointAttrs(HaveKeyWithValue("destination_app", "destination")),
ContainDataPointAttrs(HaveKeyWithValue("destination_service_name", "destination")),
ContainDataPointAttrs(HaveKeyWithValue("destination_service", "destination.app-1.svc.cluster.local")),
ContainDataPointAttrs(HaveKeyWithValue("destination_service_namespace", app1Ns)),
ContainDataPointAttrs(HaveKeyWithValue("destination_principal", "spiffe://cluster.local/ns/app-1/sa/default")),
ContainDataPointAttrs(HaveKeyWithValue("source_workload", "source")),
ContainDataPointAttrs(HaveKeyWithValue("source_principal", "spiffe://cluster.local/ns/app-1/sa/default")),
ContainDataPointAttrs(HaveKeyWithValue("response_code", "200")),
ContainDataPointAttrs(HaveKeyWithValue("request_protocol", "http")),
ContainDataPointAttrs(HaveKeyWithValue("connection_security_policy", "mutual_tls")),
)))),
))
}, periodic.TelemetryEventuallyTimeout, periodic.TelemetryInterval).Should(Succeed())
})
Expand Down

0 comments on commit 864ce36

Please sign in to comment.