Skip to content

Commit

Permalink
Make a test more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin committed Jan 5, 2025
1 parent bbe3ce8 commit 7737b99
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/node_memory_footprint_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@ fn test_get_node_memory_footprint() {
assert!(footprint.breakdown.grand_total() >= 1);

assert!(footprint.breakdown.metadata_store >= 1);
assert!(footprint.breakdown.plugins >= 1);
assert!(footprint.breakdown.code >= 1);

assert!(footprint.breakdown.plugins_percentage() >= 1.0);
assert!(footprint.breakdown.binary_heap_percentage() >= 0.1);
assert!(footprint.breakdown.allocated_but_unused_percentage() >= 0.1);

let regex = Regex::new(r"\d+\.\d+%").unwrap();

let metadata_store_percentage_s = footprint.breakdown.metadata_store_percentage_as_text();
assert!(regex.is_match(&metadata_store_percentage_s));

let plugins_percentage_s = footprint.breakdown.plugins_percentage_as_text();
assert!(regex.is_match(&plugins_percentage_s));
let code_percentage_s = footprint.breakdown.code_percentage_as_text();
assert!(regex.is_match(&code_percentage_s));
}

0 comments on commit 7737b99

Please sign in to comment.