mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-05 13:05:45 +00:00
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:
parent
2902a96ae6
commit
255dbd29ef
@ -5449,6 +5449,14 @@ mod tests {
|
|||||||
mod windows {
|
mod windows {
|
||||||
use crate::tests::*;
|
use crate::tests::*;
|
||||||
|
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
fn windows_auth() -> PasswordAuth {
|
||||||
|
PasswordAuth {
|
||||||
|
username: String::from("administrator"),
|
||||||
|
password: String::from("Admin123"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
fn test_windows_guest() {
|
fn test_windows_guest() {
|
||||||
@ -5482,11 +5490,7 @@ mod tests {
|
|||||||
assert!(pipesize >= PIPE_SIZE && pipesize1 >= PIPE_SIZE);
|
assert!(pipesize >= PIPE_SIZE && pipesize1 >= PIPE_SIZE);
|
||||||
|
|
||||||
thread::sleep(std::time::Duration::new(40, 0));
|
thread::sleep(std::time::Duration::new(40, 0));
|
||||||
let auth = PasswordAuth {
|
let auth = windows_auth();
|
||||||
username: String::from("administrator"),
|
|
||||||
password: String::from("Admin123"),
|
|
||||||
};
|
|
||||||
|
|
||||||
let r = std::panic::catch_unwind(|| {
|
let r = std::panic::catch_unwind(|| {
|
||||||
ssh_command_ip_with_auth(
|
ssh_command_ip_with_auth(
|
||||||
"shutdown /s",
|
"shutdown /s",
|
||||||
@ -5581,10 +5585,7 @@ mod tests {
|
|||||||
// Resume the VM
|
// Resume the VM
|
||||||
assert!(remote_command(&api_socket, "resume", None));
|
assert!(remote_command(&api_socket, "resume", None));
|
||||||
|
|
||||||
let auth = PasswordAuth {
|
let auth = windows_auth();
|
||||||
username: String::from("administrator"),
|
|
||||||
password: String::from("Admin123"),
|
|
||||||
};
|
|
||||||
|
|
||||||
ssh_command_ip_with_auth(
|
ssh_command_ip_with_auth(
|
||||||
"shutdown /s",
|
"shutdown /s",
|
||||||
|
Loading…
Reference in New Issue
Block a user