Skip to content

Commit 2b57879

Browse files
authored
Merge pull request #925 from fabriziosestito/test/add-output-to-otel-assertions
test: add json output as otel assertions custom message
2 parents f2308ed + a11c721 commit 2b57879

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

tests/integration_test.rs

+18-10
Original file line numberDiff line numberDiff line change
@@ -827,16 +827,24 @@ async fn test_otel() {
827827
.unwrap();
828828
let metrics = &metrics_output_json["resourceMetrics"][0]["scopeMetrics"][0];
829829
assert_eq!(metrics["scope"]["name"], "kubewarden");
830-
assert!(metrics["metrics"]
831-
.as_array()
832-
.unwrap()
833-
.iter()
834-
.any(|m| { m["name"] == "kubewarden_policy_evaluation_latency_milliseconds" }));
835-
assert!(metrics["metrics"]
836-
.as_array()
837-
.unwrap()
838-
.iter()
839-
.any(|m| { m["name"] == "kubewarden_policy_evaluations_total" }));
830+
assert!(
831+
metrics["metrics"]
832+
.as_array()
833+
.unwrap()
834+
.iter()
835+
.any(|m| { m["name"] == "kubewarden_policy_evaluation_latency_milliseconds" }),
836+
"metrics_output_json: {}",
837+
serde_json::to_string_pretty(&metrics_output_json).unwrap()
838+
);
839+
assert!(
840+
metrics["metrics"]
841+
.as_array()
842+
.unwrap()
843+
.iter()
844+
.any(|m| { m["name"] == "kubewarden_policy_evaluations_total" }),
845+
"metrics_output_json: {}",
846+
serde_json::to_string_pretty(&metrics_output_json).unwrap()
847+
);
840848

841849
let traces_output_json =
842850
(|| async { parse_exporter_output(traces_output_file.as_file()).await })

0 commit comments

Comments
 (0)