Skip to content

Commit

Permalink
VT MU:Stablize login,finish and virtmanager_offon
Browse files Browse the repository at this point in the history
  • Loading branch information
alice-suse committed Feb 27, 2025
1 parent caddf46 commit 68e715d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
16 changes: 16 additions & 0 deletions lib/virt_autotest/utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ our @EXPORT = qw(
get_guest_regcode
execute_over_ssh
reboot_virtual_machine
reconnect_console_if_not_good
);

my %log_cursors;
Expand Down Expand Up @@ -1435,4 +1436,19 @@ sub reboot_virtual_machine {
}
}

# Test console connection bi-directionally and reconnect if not good.
# This is useful for long time no use consoles.
sub reconnect_console_if_not_good {
my $_console = shift;
$_console //= 'root-ssh';

# Test console connection and reconnect if not good
enter_cmd "echo GOOD > /dev/$serialdev";
unless (defined(wait_serial 'GOOD', timeout => 30)) {
reset_consoles;
select_console($_console, await_console => 0);
}
record_info("Console is good");
}

1;
4 changes: 3 additions & 1 deletion tests/console/login.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ use warnings;
use testapi;
use lib 'sle/tests/virt_autotest';
use lib 'os-autoinst-distri-opensuse/tests/virt_autotest';
use virt_autotest::utils qw(reconnect_console_if_not_good);

sub run {
my $self = shift;
select_console 'root-ssh';
record_info("console logined");

reconnect_console_if_not_good;
}
1;
1 change: 1 addition & 0 deletions tests/virtualization/universal/finish.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ sub run {
# See https://progress.opensuse.org/issues/93204
select_console('root-console');
select_serial_terminal;
reconnect_console_if_not_good('root-serial-ssh');

# Show all guests
assert_script_run 'virsh list --all';
Expand Down
6 changes: 6 additions & 0 deletions tests/virtualization/universal/virtmanager_offon.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use warnings;
use testapi;
use utils;
use virtmanager;
use virt_autotest::utils qw(reconnect_console_if_not_good);

sub run_test {
my ($self) = @_;
Expand All @@ -36,6 +37,11 @@ sub run_test {
}

wait_screen_change { send_key 'ctrl-q'; };

# Wait a while untill the ssh console fully reacts after closing the X window of virt-manager
sleep 5;
# Reconnect if the text console does not respond well after long time no use
reconnect_console_if_not_good;
}

sub test_flags {
Expand Down

0 comments on commit 68e715d

Please sign in to comment.