-
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.
Port blocking_cluster_metadata_tests
- Loading branch information
1 parent
e88cbb6
commit ba6fde7
Showing
1 changed file
with
51 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// 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_get_cluster_name() { | ||
let endpoint = endpoint(); | ||
let rc = Client::new(&endpoint, USERNAME, PASSWORD); | ||
|
||
let result = rc.get_cluster_name().await; | ||
assert!(result.is_ok()); | ||
let meta = result.unwrap(); | ||
// in case of the below's test interference | ||
let name = meta.name; | ||
assert!(name.starts_with("rabbit") || name.starts_with("rusty")) | ||
} | ||
|
||
#[tokio::test] | ||
async fn test_async_set_cluster_name() { | ||
let endpoint = endpoint(); | ||
let rc = Client::new(&endpoint, USERNAME, PASSWORD); | ||
|
||
let result1 = rc.get_cluster_name().await; | ||
assert!(result1.is_ok()); | ||
let meta1 = result1.unwrap(); | ||
assert!(meta1.name.starts_with("rabbit")); | ||
|
||
let result2 = rc.set_cluster_name("rusty").await; | ||
assert!(result2.is_ok()); | ||
|
||
let result3 = rc.get_cluster_name().await; | ||
assert!(result3.is_ok()); | ||
let meta3 = result3.unwrap(); | ||
assert!(meta3.name == *"rusty"); | ||
|
||
let _ = rc.set_cluster_name(&meta1.name).await; | ||
} |