-
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.
Introduce Client#close_user_connections
- Loading branch information
1 parent
e433c8d
commit 7a3bb33
Showing
4 changed files
with
78 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
use std::time::Duration; | ||
// Copyright (C) 2023-2025 RabbitMQ Core Team ([email protected]) | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
|
@@ -93,3 +94,28 @@ async fn test_async_list_virtual_host_stream_connections() { | |
result1 | ||
); | ||
} | ||
|
||
#[tokio::test] | ||
async fn test_async_close_user_connections() { | ||
let endpoint = endpoint(); | ||
let rc = Client::new(&endpoint, USERNAME, PASSWORD); | ||
|
||
let args = OpenConnectionArguments::new(&hostname(), 5672, USERNAME, PASSWORD); | ||
let conn = Connection::open(&args).await.unwrap(); | ||
assert!(conn.is_open()); | ||
|
||
let result1 = rc | ||
.close_user_connections( | ||
USERNAME, | ||
Some("closed in test_async_close_user_connections"), | ||
) | ||
.await; | ||
assert!( | ||
result1.is_ok(), | ||
"close_user_connections returned {:?}", | ||
result1 | ||
); | ||
|
||
tokio::time::sleep(Duration::from_millis(50)).await; | ||
assert!(!conn.is_open()); | ||
} |