Skip to content

Commit

Permalink
Port blocking_node_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin committed Jan 16, 2025
1 parent 3f48ee5 commit 7860c63
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ pub struct QueueTotals {
#[derive(Debug, Deserialize, Clone, PartialEq)]
#[cfg_attr(feature = "tabled", derive(Tabled))]
pub struct MessageStats {
/// Consumder delivery rate plus polling (via 'basic.get') rate
/// Consumer delivery rate plus polling (via 'basic.get') rate
#[serde(rename = "deliver_get_details")]
pub delivery_details: Rate,
#[serde(rename = "publish_details")]
Expand Down
41 changes: 41 additions & 0 deletions tests/async_node_tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// 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::api::Client;

mod test_helpers;
use crate::test_helpers::{endpoint, PASSWORD, USERNAME};

#[tokio::test]
async fn test_async_list_nodes() {
let endpoint = endpoint();
let rc = Client::new(&endpoint, USERNAME, PASSWORD);
let result = rc.list_nodes().await;

assert!(result.is_ok());
let vec = result.unwrap();
assert!(vec.iter().any(|n| n.name.starts_with("rabbit@")))
}

#[tokio::test]
async fn test_async_get_node_info() {
let endpoint = endpoint();
let rc = Client::new(&endpoint, USERNAME, PASSWORD);
let nodes = rc.list_nodes().await.unwrap();
let name = nodes.first().unwrap().name.clone();
let node = &rc.get_node_info(&name).await.unwrap();

assert!(node.processors >= 1);
assert!(node.uptime >= 1);
assert!(node.total_erlang_processes >= 1);
}
1 change: 0 additions & 1 deletion tests/blocking_exchange_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ fn test_declare_a_durable_exchange_of_type(name: &str, typ: ExchangeType) {
_ => ExchangeParams::durable_fanout(name, optional_args),
};
let result2 = rc.declare_exchange(vhost, &params);
println!("{:?}", result2);
assert!(result2.is_ok());

let _ = rc.delete_exchange(vhost, name, false);
Expand Down

0 comments on commit 7860c63

Please sign in to comment.