rabbitmq_http_client 0.88.0

RabbitMQ HTTP API client
Documentation
// Copyright (C) 2023-2025 RabbitMQ Core Team (teamrabbitmq@gmail.com)
//
// 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;

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

#[test]
fn test_blocking_overview_crypto_lib_version() {
    if !rabbitmq_version_is_at_least(4, 2, 4) {
        return;
    }

    let endpoint = endpoint();
    let rc = Client::new(&endpoint, USERNAME, PASSWORD);
    let ov = rc.overview().unwrap();

    assert!(ov.crypto_lib_version.is_some());
}

#[test]
fn test_blocking_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);
}

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

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

    let ov = result.unwrap();

    // The method should return true if [jit] is in erlang_full_version, false otherwise
    let has_jit = ov.erlang_full_version.contains("[jit]");
    assert_eq!(ov.has_jit_enabled(), has_jit);
}