Skip to content

Commit 0a9cd08

Browse files
author
Frederik Rothenberger
authored
Allow fractions in helper assert_metric helper (#2633)
The `assert_metric` helper only parses integers right now, even though the metrics could be fractions. This is required once the registrations rates are exposed as a metric, hence this PR to fix it.
1 parent 6a6f616 commit 0a9cd08

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/canister_tests/src/framework.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ pub fn get_metrics(env: &PocketIc, canister_id: CanisterId) -> String {
469469

470470
pub fn parse_metric(body: &str, metric: &str) -> (f64, u64) {
471471
let metric = metric.replace('{', "\\{").replace('}', "\\}");
472-
let metric_capture = Regex::new(&format!("(?m)^{metric} (\\d+) (\\d+)$"))
472+
let metric_capture = Regex::new(&format!("(?m)^{metric} ([\\d\\.]+) ([\\d\\.]+)$"))
473473
.unwrap()
474474
.captures(body)
475475
.unwrap_or_else(|| panic!("metric {metric} not found"));

0 commit comments

Comments
 (0)