Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package os-autoinst for openSUSE:Factory checked in at 2025-02-03 21:45:29 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/os-autoinst (Old) and /work/SRC/openSUSE:Factory/.os-autoinst.new.2316 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "os-autoinst" Mon Feb 3 21:45:29 2025 rev:493 rq:1242856 version:4.6.1738587296.1a8261d Changes: -------- --- /work/SRC/openSUSE:Factory/os-autoinst/os-autoinst.changes 2025-01-29 16:10:33.523913679 +0100 +++ /work/SRC/openSUSE:Factory/.os-autoinst.new.2316/os-autoinst.changes 2025-02-03 21:47:11.119593388 +0100 @@ -1,0 +2,10 @@ +Mon Feb 03 14:31:52 UTC 2025 - ok...@suse.com + +- Update to version 4.6.1738587296.1a8261d: + * Fix race condition when autotest terminates + * Make it obvious when autotest receives SIGTERM in any case + * Increase vnctest script coverage + * Remove call to unmock from code review suggestion + * Fix error handling when reading output of SSH commands after 0d09ec97e + +------------------------------------------------------------------- Old: ---- os-autoinst-4.6.1738076220.6b39995.obscpio New: ---- os-autoinst-4.6.1738587296.1a8261d.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ os-autoinst-devel-test.spec ++++++ --- /var/tmp/diff_new_pack.XgWCOx/_old 2025-02-03 21:47:13.767703109 +0100 +++ /var/tmp/diff_new_pack.XgWCOx/_new 2025-02-03 21:47:13.771703275 +0100 @@ -18,7 +18,7 @@ %define short_name os-autoinst-devel Name: %{short_name}-test -Version: 4.6.1738076220.6b39995 +Version: 4.6.1738587296.1a8261d Release: 0 Summary: Test package for %{short_name} License: GPL-2.0-or-later ++++++ os-autoinst-openvswitch-test.spec ++++++ --- /var/tmp/diff_new_pack.XgWCOx/_old 2025-02-03 21:47:14.007713053 +0100 +++ /var/tmp/diff_new_pack.XgWCOx/_new 2025-02-03 21:47:14.011713219 +0100 @@ -19,7 +19,7 @@ %define name_ext -test %define short_name os-autoinst-openvswitch Name: %{short_name}%{?name_ext} -Version: 4.6.1738076220.6b39995 +Version: 4.6.1738587296.1a8261d Release: 0 Summary: test package for %{short_name} License: GPL-2.0-or-later ++++++ os-autoinst-test.spec ++++++ --- /var/tmp/diff_new_pack.XgWCOx/_old 2025-02-03 21:47:14.151719020 +0100 +++ /var/tmp/diff_new_pack.XgWCOx/_new 2025-02-03 21:47:14.155719186 +0100 @@ -19,7 +19,7 @@ %define name_ext -test %define short_name os-autoinst Name: %{short_name}%{?name_ext} -Version: 4.6.1738076220.6b39995 +Version: 4.6.1738587296.1a8261d Release: 0 Summary: test package for os-autoinst License: GPL-2.0-or-later ++++++ os-autoinst.spec ++++++ --- /var/tmp/diff_new_pack.XgWCOx/_old 2025-02-03 21:47:14.395729130 +0100 +++ /var/tmp/diff_new_pack.XgWCOx/_new 2025-02-03 21:47:14.399729296 +0100 @@ -17,7 +17,7 @@ Name: os-autoinst -Version: 4.6.1738076220.6b39995 +Version: 4.6.1738587296.1a8261d Release: 0 Summary: OS-level test automation License: GPL-2.0-or-later ++++++ os-autoinst-4.6.1738076220.6b39995.obscpio -> os-autoinst-4.6.1738587296.1a8261d.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-4.6.1738076220.6b39995/OpenQA/Isotovideo/CommandHandler.pm new/os-autoinst-4.6.1738587296.1a8261d/OpenQA/Isotovideo/CommandHandler.pm --- old/os-autoinst-4.6.1738076220.6b39995/OpenQA/Isotovideo/CommandHandler.pm 2025-01-28 15:57:00.000000000 +0100 +++ new/os-autoinst-4.6.1738587296.1a8261d/OpenQA/Isotovideo/CommandHandler.pm 2025-02-03 13:54:56.000000000 +0100 @@ -291,6 +291,7 @@ sub _handle_command_tests_done ($self, $response, @) { $self->test_died($response->{died}); $self->test_completed($response->{completed}); + $self->_respond_ok; $self->emit(tests_done => $response); $self->current_test_name(''); $self->status('finished'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-4.6.1738076220.6b39995/OpenQA/Isotovideo/NeedleDownloader.pm new/os-autoinst-4.6.1738587296.1a8261d/OpenQA/Isotovideo/NeedleDownloader.pm --- old/os-autoinst-4.6.1738076220.6b39995/OpenQA/Isotovideo/NeedleDownloader.pm 2025-01-28 15:57:00.000000000 +0100 +++ new/os-autoinst-4.6.1738587296.1a8261d/OpenQA/Isotovideo/NeedleDownloader.pm 2025-02-03 13:54:56.000000000 +0100 @@ -124,6 +124,11 @@ # downloads missing needles considering $new_needles # (see t/21-needle-downloader.t for an example of $new_needles) sub download_missing_needles ($self, $new_needles) { + if ($new_needles && $bmwqemu::vars{SYNC_ASSETS_HOOK}) { + bmwqemu::diag("Running SYNC_ASSETS_HOOK"); + my $ret = system($bmwqemu::vars{SYNC_ASSETS_HOOK}); + return if ($ret == (32 << 8)); + } $self->add_relevant_downloads($new_needles); $self->download(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-4.6.1738076220.6b39995/OpenQA/Isotovideo/Runner.pm new/os-autoinst-4.6.1738587296.1a8261d/OpenQA/Isotovideo/Runner.pm --- old/os-autoinst-4.6.1738076220.6b39995/OpenQA/Isotovideo/Runner.pm 2025-01-28 15:57:00.000000000 +0100 +++ new/os-autoinst-4.6.1738587296.1a8261d/OpenQA/Isotovideo/Runner.pm 2025-02-03 13:54:56.000000000 +0100 @@ -127,8 +127,8 @@ $command_handler->on(tests_done => sub (@) { CORE::close($self->testfd); $self->testfd(undef); - $self->stop_autotest(); $self->loop(0); + $self->stop_autotest(); }); # uncoverable statement count:1 # uncoverable statement count:2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-4.6.1738076220.6b39995/autotest.pm new/os-autoinst-4.6.1738587296.1a8261d/autotest.pm --- old/os-autoinst-4.6.1738076220.6b39995/autotest.pm 2025-01-28 15:57:00.000000000 +0100 +++ new/os-autoinst-4.6.1738587296.1a8261d/autotest.pm 2025-02-03 13:54:56.000000000 +0100 @@ -276,15 +276,17 @@ eval { bmwqemu::save_vars(no_secret => 1); bmwqemu::diag("Sending tests_done"); - myjsonrpc::send_json($isotovideo, {cmd => 'tests_done', died => $died, completed => $completed}); + my $token = myjsonrpc::send_json($isotovideo, {cmd => 'tests_done', died => $died, completed => $completed}); + myjsonrpc::read_json($isotovideo, $token); # wait for response from isotovideo before exiting }; warn "Error at the end of run_all: $@" if $@; _terminate; } sub handle_sigterm ($sig) { # uncoverable statement + my $info = $current_test ? ', saving results of current test before exiting' : ''; # uncoverable statement + bmwqemu::diag("autotest received signal $sig$info"); # uncoverable statement if ($current_test) { # uncoverable statement - bmwqemu::diag("autotest received signal $sig, saving results of current test before exiting"); # uncoverable statement $current_test->result('canceled'); # uncoverable statement $current_test->save_test_result(); # uncoverable statement } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-4.6.1738076220.6b39995/backend/baseclass.pm new/os-autoinst-4.6.1738587296.1a8261d/backend/baseclass.pm --- old/os-autoinst-4.6.1738076220.6b39995/backend/baseclass.pm 2025-01-28 15:57:00.000000000 +0100 +++ new/os-autoinst-4.6.1738587296.1a8261d/backend/baseclass.pm 2025-02-03 13:54:56.000000000 +0100 @@ -1325,7 +1325,11 @@ $stdout .= $o; $stderr .= $e; } - else { + # check whether an error occurred + # note: The example from the documentation suggests that a simple `else` is sufficient. However, this does + # not work when the command returns without producing any output and `die_with_error` dies with the + # error message `no libssh2 error registered` then. + elsif ($ssh->error) { $log_output->(); $ssh->die_with_error; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-4.6.1738076220.6b39995/backend/qemu.pm new/os-autoinst-4.6.1738587296.1a8261d/backend/qemu.pm --- old/os-autoinst-4.6.1738076220.6b39995/backend/qemu.pm 2025-01-28 15:57:00.000000000 +0100 +++ new/os-autoinst-4.6.1738587296.1a8261d/backend/qemu.pm 2025-02-03 13:54:56.000000000 +0100 @@ -393,6 +393,7 @@ # no need to save CDs return if ($node =~ qr/cd[0-9]-overlay/); my $my_node = "$node-$fname"; + return unless defined $vars->{NAME}; my $bck_file = "assets_public/$my_node-$vars->{NAME}.qcow2"; # create disk runcmd('qemu-img', 'create', '-f', 'qcow2', "$bck_file", $size); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-4.6.1738076220.6b39995/codecov.yml new/os-autoinst-4.6.1738587296.1a8261d/codecov.yml --- old/os-autoinst-4.6.1738076220.6b39995/codecov.yml 2025-01-28 15:57:00.000000000 +0100 +++ new/os-autoinst-4.6.1738587296.1a8261d/codecov.yml 2025-02-03 13:54:56.000000000 +0100 @@ -27,7 +27,9 @@ - consoles/serial_screen.pm - consoles/sshSerial.pm - consoles/sshVirtsh.pm + - consoles/sshVirtshSUT.pm - consoles/sshIucvconn.pm + - consoles/sshXtermIPMI.pm - consoles/sshXtermVt.pm - consoles/ssh_screen.pm - consoles/video_stream.pm @@ -49,6 +51,7 @@ - t/ - xt/ - script/check_qemu_oom + - script/vnctest patch: default: branches: null diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-4.6.1738076220.6b39995/script/vnctest new/os-autoinst-4.6.1738587296.1a8261d/script/vnctest --- old/os-autoinst-4.6.1738076220.6b39995/script/vnctest 2025-01-28 15:57:00.000000000 +0100 +++ new/os-autoinst-4.6.1738587296.1a8261d/script/vnctest 2025-02-03 13:54:56.000000000 +0100 @@ -19,35 +19,44 @@ example: --hostname localhost --port 590x'; exit $r; } -my %options; -GetOptions(\%options, 'hostname=s', 'port=s', 'password=s', 'update-delay=s', 'verbose|v', 'help|h|?') or usage(1); -usage if $options{help}; - -my $update_delay = $options{'update-delay'} // 1; -my $log = Mojo::Log->new; -$log->level($options{verbose} ? 'debug' : 'info'); -$log->debug('Loading tinycv'); -cv::init; -require tinycv; - -my $image_path = '/tmp/vnc-framebuffer.png' // $ENV{VNC_TEST_TEMP_IMAGE_PATH}; -unlink $image_path; -exec "$Bin/debugviewer/debugviewer", $image_path if $ENV{VNC_TEST_DEBUGVIEWER} && fork == 0; - -$log->info('Initializing VNC'); -my $vnc = consoles::VNC->new(%options); -my $incremental = 0; -$vnc->login; - -while(1) { - $log->info('Send update request'); - $vnc->send_update_request($incremental); - $incremental = 1; - $log->debug('Updating frame buffer'); - if ($vnc->update_framebuffer) { - my $frame_buffer = $vnc->_framebuffer; - $log->debug($frame_buffer ? 'Update received, has frame buffer' : 'Update received'); - $frame_buffer->write($image_path) if $frame_buffer; + +sub parse_args () { + my %options; + GetOptions(\%options, 'hostname=s', 'port=s', 'password=s', 'update-delay=s', 'verbose|v', 'help|h|?') or usage(1); + usage if $options{help}; + return \%options; +} + +sub main ($args) { + my $update_delay = $args->{'update-delay'} // 1; + my $log = Mojo::Log->new; + $log->level($args->{verbose} ? 'debug' : 'info'); + $log->debug('Loading tinycv'); + cv::init; + require tinycv; + + my $image_path = '/tmp/vnc-framebuffer.png' // $ENV{VNC_TEST_TEMP_IMAGE_PATH}; + unlink $image_path; + exec "$Bin/debugviewer/debugviewer", $image_path if $ENV{VNC_TEST_DEBUGVIEWER} && fork == 0; + + $log->info('Initializing VNC'); + my $vnc = consoles::VNC->new(%$args); + my $incremental = 0; + $vnc->login; + + while(1) { + $log->info('Send update request'); + $vnc->send_update_request($incremental); + $incremental = 1; + $log->debug('Updating frame buffer'); + if ($vnc->update_framebuffer) { + my $frame_buffer = $vnc->_framebuffer; + $log->debug($frame_buffer ? 'Update received, has frame buffer' : 'Update received'); + $frame_buffer->write($image_path) if $frame_buffer; + } + sleep $update_delay; + last if $ENV{TEST_ENV}; } - sleep $update_delay; } + +main(parse_args()) unless caller(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-4.6.1738076220.6b39995/t/08-autotest.t new/os-autoinst-4.6.1738587296.1a8261d/t/08-autotest.t --- old/os-autoinst-4.6.1738076220.6b39995/t/08-autotest.t 2025-01-28 15:57:00.000000000 +0100 +++ new/os-autoinst-4.6.1738587296.1a8261d/t/08-autotest.t 2025-02-03 13:54:56.000000000 +0100 @@ -39,7 +39,7 @@ my @reset_consoles; my @selected_consoles; sub fake_send ($target, $msg) { push @sent, $msg } -sub fake_read ($fd) { +sub fake_read ($fd, $cmd_token = undef) { my $lcmd = $sent[-1]; my $cmd = $lcmd->{cmd}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-4.6.1738076220.6b39995/t/21-needle-downloader.t new/os-autoinst-4.6.1738587296.1a8261d/t/21-needle-downloader.t --- old/os-autoinst-4.6.1738076220.6b39995/t/21-needle-downloader.t 2025-01-28 15:57:00.000000000 +0100 +++ new/os-autoinst-4.6.1738587296.1a8261d/t/21-needle-downloader.t 2025-02-03 13:54:56.000000000 +0100 @@ -149,6 +149,40 @@ like $stderr, qr{internal error occurred when downloading.*oops}, 'internal error was logged'; }; +subtest 'sync assets hook used at the right time' => sub { + $downloader = OpenQA::Isotovideo::NeedleDownloader->new; + $bmwqemu::vars{SYNC_ASSETS_HOOK} = "touch -t 201801010000 '$needles_dir/foo.png' '$needles_dir/foo.json'; exit 32"; + my @new_needles = ( + { + id => 1, + name => 'foo', + directory => 'fixtures', + tags => [qw(some tag)], + json_path => '/needles/1/json', + image_path => '/needles/1/image', + t_created => '2018-01-01T00:00:00Z', + t_updated => '2018-01-01T00:00:00Z', + }, + { + id => 2, + name => 'bar', + directory => 'fixtures', + tags => [qw(yet another tag)], + json_path => '/needles/2/json', + image_path => '/needles/2/image', + t_created => '2018-01-01T00:00:00Z', + t_updated => '2018-01-01T00:00:00Z', + }, + ); + + # define expected downloads: nothing as download is skipped + my @expected_downloads = (); + + $downloader->download_missing_needles(\@new_needles); + is_deeply($downloader->files_to_download, \@expected_downloads, 'download skipped') + or always_explain $downloader->files_to_download; +}; + remove_tree($needles_dir); done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-4.6.1738076220.6b39995/t/23-baseclass.t new/os-autoinst-4.6.1738587296.1a8261d/t/23-baseclass.t --- old/os-autoinst-4.6.1738076220.6b39995/t/23-baseclass.t 2025-01-28 15:57:00.000000000 +0100 +++ new/os-autoinst-4.6.1738587296.1a8261d/t/23-baseclass.t 2025-02-03 13:54:56.000000000 +0100 @@ -148,7 +148,7 @@ shift->{connected} = 0; return 1; }); - $self->mock(error => sub { return @net_ssh2_error; }); + $self->mock(error => sub { wantarray ? @net_ssh2_error : ($net_ssh2_error[0] // 0) }); $self->mock(sock => sub { my $self = shift; unless ($self->{sock}) { @@ -168,17 +168,18 @@ my ($self, $cmd) = @_; $self->{cmd} = $cmd; $self->{eof} = 0; - if ($cmd =~ /^(echo|test)/) { - $self->{stdout} = qx{$cmd}; - $self->{exit_status} = $?; - $self->{stderr} = ''; - } + return 1 unless $cmd =~ /^(echo|test)/; + my $output = qx{$cmd}; + $self->{exit_status} = $?; + return 1 unless $cmd =~ /^echo/; + $self->{stdout} = $output; + $self->{stderr} = ''; return 1; }); $mock_channel->mock(read2 => sub ($self) { return () if $fail_on_read2; $self->{eof} = 1; - return ($self->{stdout}, $self->{stderr}); + return defined $self->{stdout} ? ($self->{stdout}, $self->{stderr}) : (); }); $mock_channel->mock(eof => sub { return shift->{eof}; }); $mock_channel->mock(blocking => sub { return shift->{ssh}->blocking(shift) }); @@ -269,6 +270,8 @@ throws_ok { $baseclass->run_ssh_cmd('sleep infinity', %ssh_creds, timeout => 100) } qr/waiting for data.*timeout/i, 'read timeout is fatal error'; is_deeply \@timeouts, [100, 42], 'timeout increased to specified value, then set back to mocked default again'; ($fail_on_read2, @net_ssh2_error) = (); + @output = $baseclass->run_ssh_cmd('test foo', %ssh_creds, timeout => 100, wantarray => 1); + is_deeply \@output, [0, '', ''], 'command successful exit without output'; # Create a SSH session implecit with `run_ssh_cmd()` $ssh_expect->{password} = '2+3=5'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-4.6.1738076220.6b39995/t/26-video_stream.t new/os-autoinst-4.6.1738587296.1a8261d/t/26-video_stream.t --- old/os-autoinst-4.6.1738076220.6b39995/t/26-video_stream.t 2025-01-28 15:57:00.000000000 +0100 +++ new/os-autoinst-4.6.1738587296.1a8261d/t/26-video_stream.t 2025-02-03 13:54:56.000000000 +0100 @@ -108,10 +108,8 @@ '-vcodec', 'ppm', '-f', 'rawvideo', '-r', 3, '-'], "correct cmd built for fps=3"; $mock_console->redefine(update_framebuffer => sub ($self) { $self->{_last_update_received} = 200; return 0; }); - my $start_time = time; $console->request_screen_update(); is $console->{dv_timings_supported}, 1, 'dv timings are supported'; - cmp_ok $console->{dv_timings_last_check}, '>=', $start_time, 'dv_timings_last_check ok'; $mock_console->unmock('update_framebuffer'); $console->disable_video; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-4.6.1738076220.6b39995/t/27-consoles-sshXtermIPMI.t new/os-autoinst-4.6.1738587296.1a8261d/t/27-consoles-sshXtermIPMI.t --- old/os-autoinst-4.6.1738076220.6b39995/t/27-consoles-sshXtermIPMI.t 2025-01-28 15:57:00.000000000 +0100 +++ new/os-autoinst-4.6.1738587296.1a8261d/t/27-consoles-sshXtermIPMI.t 2025-02-03 13:54:56.000000000 +0100 @@ -46,7 +46,6 @@ $s->mock($_ => sub { push @printed, $_[1] }) for qw(print write); $vnc_mock->redefine(_read_socket => sub { substr(${$_[1]}, $_[3], $_[2]) = $s->mocked_read; length ${$_[1]} }); $inet_mock->redefine(new => $s); -$backend_mock->redefine(ipmi_cmdline => sub { (qw(echo simulating ipmi)) }); $backend_mock->redefine(do_mc_reset => sub { bmwqemu::diag('IPMI mc reset success'); }); $testapi_console_mock->redefine(backend => $backend); $localXvnc_mock->redefine(activate => sub ($self) { $self->{DISPLAY} = "display"; }); @@ -56,14 +55,26 @@ ok my $sol_connection = consoles::sshXtermIPMI->new($testapi_console, undef), 'sol connection can be established'; subtest 'sshXtermIPMI activate' => sub { + my $ipc_run_mock = Test::MockModule->new('IPC::Run'); + $ipc_run_mock->redefine(run => sub ($cmd, $stdin, $stdout, $stderr) { + $$stdin = 'in', $$stdout = 'out', $$stderr = 'err'; return 1; + }); stderr_like { $sol_connection->activate(); } qr/Xterm PID:/, 'VNC connection established'; + + $ipc_run_mock->redefine(run => sub ($cmd, $stdin, $stdout, $stderr) { + $$stdin = 'in', $$stdout = 'out', $$stderr = 'Unable to deactivate SOL payload'; return 0; + }); + throws_ok { + $sol_connection->activate(); + } qr/Unexpected IPMI response/, 'sshXterm dies with unexpected ipmi response'; }; subtest 'sshXtermIPMI current_screen' => sub { my $sol_mock = Test::MockModule->new('consoles::sshXtermIPMI'); $sol_mock->redefine(waitpid => -1); + $backend_mock->redefine(ipmi_cmdline => sub { (qw(echo simulating ipmi)) }); combined_like { throws_ok { $sol_connection->current_screen() } qr/Too many IPMI SOL errors/, 'dies on reconnect failure'; } qr/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-4.6.1738076220.6b39995/t/27-consoles-ssh_virtsh_sut.t new/os-autoinst-4.6.1738587296.1a8261d/t/27-consoles-ssh_virtsh_sut.t --- old/os-autoinst-4.6.1738076220.6b39995/t/27-consoles-ssh_virtsh_sut.t 2025-01-28 15:57:00.000000000 +0100 +++ new/os-autoinst-4.6.1738587296.1a8261d/t/27-consoles-ssh_virtsh_sut.t 2025-02-03 13:54:56.000000000 +0100 @@ -6,6 +6,8 @@ use Test::Most; use Mojo::Base -strict, -signatures; use Test::Warnings qw(:all :report_warnings); +use Test::MockObject; +use Test::Output qw(stderr_like); use FindBin '$Bin'; use lib "$Bin/../external/os-autoinst-common/lib"; use OpenQA::Test::TimeLimit '5'; @@ -14,5 +16,10 @@ my $c = consoles::sshVirtshSUT->new('sut', {}); is $c->screen, undef, 'no screen defined'; is $c->is_serial_terminal, 1, 'is a serial terminal'; +my $mock_ssh = Test::MockObject->new()->set_true('disconnect'); +$c->{backend} = Test::MockObject->new()->set_list(open_serial_console_via_ssh => ($mock_ssh, 'chan')); +stderr_like { $c->activate } qr/Activate console/, 'activate can be called'; +is $c->disable, undef, 'disable can be called'; +ok $mock_ssh->called('disconnect'), 'disable disconnected ssh'; done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-4.6.1738076220.6b39995/t/45-vnctest.t new/os-autoinst-4.6.1738587296.1a8261d/t/45-vnctest.t --- old/os-autoinst-4.6.1738076220.6b39995/t/45-vnctest.t 1970-01-01 01:00:00.000000000 +0100 +++ new/os-autoinst-4.6.1738587296.1a8261d/t/45-vnctest.t 2025-02-03 13:54:56.000000000 +0100 @@ -0,0 +1,30 @@ +#!/usr/bin/env perl +# Copyright SUSE LLC +# SPDX-License-Identifier: GPL-2.0-or-later + +use Test::Most; +use Test::Warnings ':report_warnings'; +use Test::MockModule; +use Test::Output qw(stderr_like); +use FindBin '$Bin'; +use lib "$FindBin::Bin/lib", "$Bin/../external/os-autoinst-common/lib"; +use OpenQA::Test::TimeLimit '10'; + +require "$Bin/../script/vnctest"; + +subtest 'Ensure that main gets args' => sub { + local @ARGV = qw(--verbose --hostname open.qa); + my $options = main::parse_args(); + is_deeply $options, {verbose => 1, hostname => 'open.qa'}, 'parse_args() returns options'; +}; + +subtest 'Run vnctest script' => sub { + $ENV{TEST_ENV} = 1; + my $vnc = Test::MockModule->new('consoles::VNC'); + $vnc->redefine('login', 1); + $vnc->redefine('send_update_request', 1); + $vnc->redefine('update_framebuffer', 1); + stderr_like { main::main({hostname => 'nohost', 'update-delay' => 0, verbose => 1}) } qr/Update received/, 'Captured output from main::main'; +}; + +done_testing; ++++++ os-autoinst.obsinfo ++++++ --- /var/tmp/diff_new_pack.XgWCOx/_old 2025-02-03 21:47:16.191803548 +0100 +++ /var/tmp/diff_new_pack.XgWCOx/_new 2025-02-03 21:47:16.195803714 +0100 @@ -1,5 +1,5 @@ name: os-autoinst -version: 4.6.1738076220.6b39995 -mtime: 1738076220 -commit: 6b399957ca5f802e08fa88e487c6a9af4d61dfaf +version: 4.6.1738587296.1a8261d +mtime: 1738587296 +commit: 1a8261d620200a19d077dd9a760921f848724376