tests: factor out windows_auth

This avoid repetition once we have more Windows tests.

No functional change.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu 2020-10-22 10:59:49 +00:00 committed by Sebastien Boeuf
parent 2902a96ae6
commit 255dbd29ef

View File

@ -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",