-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Percentage calculations for the NodeMemoryBreakdown fields
- Loading branch information
1 parent
6bb6782
commit 7740edd
Showing
5 changed files
with
211 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (C) 2023-2025 RabbitMQ Core Team ([email protected]) | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
use rabbitmq_http_client::blocking_api::Client; | ||
|
||
mod test_helpers; | ||
use crate::test_helpers::{endpoint, PASSWORD, USERNAME}; | ||
|
||
use regex::Regex; | ||
|
||
#[test] | ||
fn test_get_node_memory_footprint() { | ||
let endpoint = endpoint(); | ||
let rc = Client::new(&endpoint, USERNAME, PASSWORD); | ||
let nodes = rc.list_nodes().unwrap(); | ||
let name = nodes.first().unwrap().name.clone(); | ||
let footprint = &mut rc.get_node_memory_footprint(&name).unwrap(); | ||
|
||
assert!(footprint.breakdown.total.rss >= 1); | ||
assert!(footprint.breakdown.total.allocated >= 1); | ||
assert!(footprint.breakdown.total.used_by_runtime >= 1); | ||
assert!(footprint.breakdown.grand_total() >= 1); | ||
|
||
assert!(footprint.breakdown.metadata_store >= 1); | ||
assert!(footprint.breakdown.plugins >= 1); | ||
|
||
assert!(footprint.breakdown.plugins_percentage() >= 1.0); | ||
|
||
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)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters