Skip to content

Commit

Permalink
Correct GET /api/overview deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin committed Jan 6, 2025
1 parent 21f4767 commit 0ea7cf9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,6 @@ impl fmt::Display for ChurnRates {
}

#[derive(Debug, Deserialize, Clone, PartialEq, PartialOrd)]
#[serde(transparent)]
#[cfg_attr(feature = "tabled", derive(Tabled))]
pub struct Rate {
pub rate: f64,
Expand All @@ -1005,8 +1004,7 @@ pub struct QueueTotals {
pub messages_ready_for_delivery: u64,
#[serde(rename = "messages_unacknowledged")]
pub messages_delivered_but_unacknowledged_by_consumers: u64,

pub message_details: Rate,
pub messages_details: Rate,
#[serde(rename = "messages_ready_details")]
pub messages_ready_for_delivery_details: Rate,
#[serde(rename = "messages_unacknowledged_details")]
Expand Down
29 changes: 29 additions & 0 deletions tests/overview_tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// 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};

#[test]
fn test_overview() {
let endpoint = endpoint();
let rc = Client::new(&endpoint, USERNAME, PASSWORD);

let result1 = rc.overview();
assert!(result1.is_ok(), "overview returned {:?}", result1);

let ov = result1.unwrap();
assert!(ov.object_totals.exchanges > 0);
}

0 comments on commit 0ea7cf9

Please sign in to comment.