From 255dbd29efbe5a5b821c9d1d31916b192d229c93 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Thu, 22 Oct 2020 10:59:49 +0000 Subject: [PATCH] tests: factor out windows_auth This avoid repetition once we have more Windows tests. No functional change. Signed-off-by: Wei Liu --- tests/integration.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/integration.rs b/tests/integration.rs index 6b5dc60e7..a4aa0147d 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -5449,6 +5449,14 @@ mod tests { mod windows { use crate::tests::*; + #[cfg(target_arch = "x86_64")] + fn windows_auth() -> PasswordAuth { + PasswordAuth { + username: String::from("administrator"), + password: String::from("Admin123"), + } + } + #[test] #[cfg(target_arch = "x86_64")] fn test_windows_guest() { @@ -5482,11 +5490,7 @@ mod tests { assert!(pipesize >= PIPE_SIZE && pipesize1 >= PIPE_SIZE); thread::sleep(std::time::Duration::new(40, 0)); - let auth = PasswordAuth { - username: String::from("administrator"), - password: String::from("Admin123"), - }; - + let auth = windows_auth(); let r = std::panic::catch_unwind(|| { ssh_command_ip_with_auth( "shutdown /s", @@ -5581,10 +5585,7 @@ mod tests { // Resume the VM assert!(remote_command(&api_socket, "resume", None)); - let auth = PasswordAuth { - username: String::from("administrator"), - password: String::from("Admin123"), - }; + let auth = windows_auth(); ssh_command_ip_with_auth( "shutdown /s",