-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf171c0
commit b889ea1
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use dicom_dictionary_std::uids::VERIFICATION; | ||
use dicom_ul::ClientAssociationOptions; | ||
use rstest::rstest; | ||
use std::time::Instant; | ||
|
||
#[rstest] | ||
#[case(100)] | ||
#[case(500)] | ||
#[case(1000)] | ||
fn test_slow_association(#[case] timeout: u64) { | ||
let scu_init = ClientAssociationOptions::new() | ||
.with_abstract_syntax(VERIFICATION) | ||
.calling_ae_title("RANDOM") | ||
.read_timeout(std::time::Duration::from_secs(1)) | ||
.connection_timeout(std::time::Duration::from_millis(timeout)); | ||
|
||
let now = Instant::now(); | ||
let _res = scu_init.establish_with("RANDOM@167.167.167.167:11111"); | ||
let elapsed = now.elapsed(); | ||
assert!(elapsed.as_millis() < (timeout + 10).into()); | ||
} | ||
|
||
#[cfg(feature = "async")] | ||
#[rstest] | ||
#[case(100)] | ||
#[case(500)] | ||
#[case(1000)] | ||
#[tokio::test(flavor = "multi_thread")] | ||
async fn test_slow_association_async(#[case] timeout: u64) { | ||
let scu_init = ClientAssociationOptions::new() | ||
.with_abstract_syntax(VERIFICATION) | ||
.calling_ae_title("RANDOM") | ||
.read_timeout(std::time::Duration::from_secs(1)) | ||
.connection_timeout(std::time::Duration::from_millis(timeout)); | ||
let now = Instant::now(); | ||
let res = scu_init | ||
.establish_with_async("RANDOM@167.167.167.167:11111") | ||
.await; | ||
assert!(res.is_err()); | ||
let elapsed = now.elapsed(); | ||
println!("Elapsed time: {:?}", elapsed); | ||
assert!(elapsed.as_millis() < (timeout + 10).into()); | ||
} |