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-05 17:26:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/os-autoinst (Old) and /work/SRC/openSUSE:Factory/.os-autoinst.new.2316 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "os-autoinst" Wed Feb 5 17:26:02 2025 rev:495 rq:1243421 version:4.6.1738752967.6623798 Changes: -------- --- /work/SRC/openSUSE:Factory/os-autoinst/os-autoinst.changes 2025-02-04 18:16:02.224211874 +0100 +++ /work/SRC/openSUSE:Factory/.os-autoinst.new.2316/os-autoinst.changes 2025-02-05 17:26:16.425305934 +0100 @@ -1,0 +2,12 @@ +Wed Feb 05 14:45:06 UTC 2025 - ok...@suse.com + +- Update to version 4.6.1738752967.6623798: + * Modify connect_and_login() test to catch multiline carp warning + * Apply suggestions from code review + * Add unit tests for consoles/s3270.pm + * t: Use more simple prototyped Test::Exceptions functions + * t: Focus on using Test::Exception only instead of Test::Fatal + * t: Ensure we use implicit Test::Exception in all places + * Fix race condition when autotest terminates + +------------------------------------------------------------------- Old: ---- os-autoinst-4.6.1738604220.30e658a.obscpio New: ---- os-autoinst-4.6.1738752967.6623798.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ os-autoinst-devel-test.spec ++++++ --- /var/tmp/diff_new_pack.w4ePm8/_old 2025-02-05 17:26:18.025372134 +0100 +++ /var/tmp/diff_new_pack.w4ePm8/_new 2025-02-05 17:26:18.029372300 +0100 @@ -18,7 +18,7 @@ %define short_name os-autoinst-devel Name: %{short_name}-test -Version: 4.6.1738604220.30e658a +Version: 4.6.1738752967.6623798 Release: 0 Summary: Test package for %{short_name} License: GPL-2.0-or-later ++++++ os-autoinst-openvswitch-test.spec ++++++ --- /var/tmp/diff_new_pack.w4ePm8/_old 2025-02-05 17:26:18.053373293 +0100 +++ /var/tmp/diff_new_pack.w4ePm8/_new 2025-02-05 17:26:18.053373293 +0100 @@ -19,7 +19,7 @@ %define name_ext -test %define short_name os-autoinst-openvswitch Name: %{short_name}%{?name_ext} -Version: 4.6.1738604220.30e658a +Version: 4.6.1738752967.6623798 Release: 0 Summary: test package for %{short_name} License: GPL-2.0-or-later ++++++ os-autoinst-test.spec ++++++ --- /var/tmp/diff_new_pack.w4ePm8/_old 2025-02-05 17:26:18.081374451 +0100 +++ /var/tmp/diff_new_pack.w4ePm8/_new 2025-02-05 17:26:18.081374451 +0100 @@ -19,7 +19,7 @@ %define name_ext -test %define short_name os-autoinst Name: %{short_name}%{?name_ext} -Version: 4.6.1738604220.30e658a +Version: 4.6.1738752967.6623798 Release: 0 Summary: test package for os-autoinst License: GPL-2.0-or-later ++++++ os-autoinst.spec ++++++ --- /var/tmp/diff_new_pack.w4ePm8/_old 2025-02-05 17:26:18.109375610 +0100 +++ /var/tmp/diff_new_pack.w4ePm8/_new 2025-02-05 17:26:18.113375775 +0100 @@ -17,7 +17,7 @@ Name: os-autoinst -Version: 4.6.1738604220.30e658a +Version: 4.6.1738752967.6623798 Release: 0 Summary: OS-level test automation License: GPL-2.0-or-later ++++++ os-autoinst-4.6.1738604220.30e658a.obscpio -> os-autoinst-4.6.1738752967.6623798.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-4.6.1738604220.30e658a/consoles/s3270.pm new/os-autoinst-4.6.1738752967.6623798/consoles/s3270.pm --- old/os-autoinst-4.6.1738604220.30e658a/consoles/s3270.pm 2025-02-03 18:37:00.000000000 +0100 +++ new/os-autoinst-4.6.1738752967.6623798/consoles/s3270.pm 2025-02-05 11:56:07.000000000 +0100 @@ -7,6 +7,7 @@ use Mojo::Base 'consoles::localXvnc', -signatures; use feature 'say'; use Data::Dumper 'Dumper'; +use YAML::PP 'Dump'; use Carp qw(confess cluck carp croak); require IPC::Run; use IPC::Run::Debug; # set IPCRUNDEBUG=data in shell environment for trace @@ -312,12 +313,12 @@ } sub _connect_3270 ($self, $host) { - my $r = $self->send_3270("Connect($host)"); - confess "connect to host >$host< failed.\n" . join("\n", @$r) if $r->{terminal_status} !~ / C\($host\) /; + my $sent = $self->send_3270("Connect($host)"); + confess "connect to host >$host< failed.\n" . Dump($sent) if $sent->{terminal_status} !~ / C\($host\) /; $self->send_3270("Wait(InputField)"); - $r = $self->expect_3270(); - confess "doesn't look like zVM login prompt." unless grep /Fill in your USERID and PASSWORD and press ENTER/, @$r; - return $r; + my $lines = $self->expect_3270(); + confess "doesn't look like zVM login prompt." unless grep /Fill in your USERID and PASSWORD and press ENTER/, @$lines; + return $lines; } sub _login_guest ($self, $guest, $password) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-autoinst-4.6.1738604220.30e658a/t/27-consoles-s3270.t new/os-autoinst-4.6.1738752967.6623798/t/27-consoles-s3270.t --- old/os-autoinst-4.6.1738604220.30e658a/t/27-consoles-s3270.t 1970-01-01 01:00:00.000000000 +0100 +++ new/os-autoinst-4.6.1738752967.6623798/t/27-consoles-s3270.t 2025-02-05 11:56:07.000000000 +0100 @@ -0,0 +1,84 @@ +#!/usr/bin/perl + +use Test::Most; +use Mojo::Base -strict, -signatures; +use Test::MockModule 'strict'; +use Test::MockObject; +use Test::Warnings qw(:report_warnings warnings); +use Test::Output qw(combined_like); +use FindBin '$Bin'; +use lib "$Bin/../external/os-autoinst-common/lib"; +use OpenQA::Test::TimeLimit '10'; +use consoles::s3270; + +$bmwqemu::vars{ZVM_HOST} = "localhost.localdomain"; +$bmwqemu::vars{ZVM_GUEST} = "guest.user"; +$bmwqemu::vars{ZVM_PASSWORD} = "password"; + +my $ipc_run_mock = Test::MockModule->new('IPC::Run'); +my $vnc_mock = Test::MockModule->new('consoles::VNC'); +my $localXvnc_mock = Test::MockModule->new('consoles::localXvnc'); +my $inet_mock = Test::MockModule->new('IO::Socket::INET'); +my $socket_mock = Test::MockObject->new->set_true(qw(sockopt fileno print connected close blocking)); + +$localXvnc_mock->redefine(activate => sub ($self) { $self->{DISPLAY} = "display"; }); +$vnc_mock->redefine(_read_socket => sub { substr(${$_[1]}, $_[3], $_[2]) = $socket_mock->mocked_read; length ${$_[1]} }); +$vnc_mock->redefine(login => 1); +$inet_mock->redefine(new => $socket_mock); +$ipc_run_mock->redefine(pump => 1); + +ok my $s3270_console = consoles::s3270->new('s3270', undef), 's3270_console connection can be established'; + +subtest 's3270_console start' => sub { + my $bless_obj = bless({KIDS => [{VAL => '', PID => '0', NUM => 1, TYPE => 'cmd', RESULT => 1, OPS => []}]}, 'IPC::Run'); + $ipc_run_mock->redefine(start => sub ($self, $in, $out, $err) { + $$out = "success\nconnet($bmwqemu::vars{ZVM_HOST})\nstart to execute process\nok"; + return $bless_obj; + }); + $s3270_console->start(); + is_deeply $s3270_console->{connection}, $bless_obj, 's3270 console can be started'; +}; + +subtest 's3270 send' => sub { + my $ret = $s3270_console->send_3270("Connect($bmwqemu::vars{ZVM_HOST})", command_status => 'ok'); + is $s3270_console->{in}, "Connect($bmwqemu::vars{ZVM_HOST})\n", 'input command matches'; + is $ret->{terminal_status}, "start to execute process", 'terminal status matches'; + is $ret->{command_status}, "ok", 'command status matches'; + is_deeply $ret->{command_output}, ['success', "connet($bmwqemu::vars{ZVM_HOST})"], 'command output matches'; +}; + +subtest 's3270_console activate' => sub { + my $s3270_console_mock = Test::MockModule->new('consoles::s3270'); + $s3270_console_mock->redefine(send_3270 => sub ($self, $command = '', %arg) { + return {'command_output' => ['success'], 'command_status' => 'ok', 'terminal_status' => "Connection to C($bmwqemu::vars{ZVM_HOST}) OK"} unless $command =~ /Wait\([0-9],Output\)/; + return {'command_status' => 'ok'} if $command =~ /\b0\b/; + return {'command_output' => ['Wait: Timed out'], 'command_status' => 'any'}; + }); + combined_like { + throws_ok { $s3270_console->activate() } qr/expect_3270:/, 's3270_console connection time out' + } qr/expect_3270/, 'result empty'; +}; + +subtest 's3270_console connect_and_login' => sub { + my $count = 0; + my $s3270_console_mock = Test::MockModule->new('consoles::s3270'); + $s3270_console_mock->redefine(send_3270 => sub ($self, $command = '', %arg) { + return {terminal_status => "Connection to C($bmwqemu::vars{ZVM_HOST}) OK"} if $command =~ /Connect\(\w.+\)/; + }); + $s3270_console_mock->redefine(expect_3270 => sub ($self, %arg) { + return ['Fill in your USERID and PASSWORD and press ENTER'] unless keys %arg == 1 && exists $arg{buffer_ready}; + my $return_lines; + $return_lines = ['RECONNECT'] if $count == 0; + $return_lines = ['CONNECTED'] if $count == 1; + $count += 1; + return $return_lines; + }); + cmp_deeply( + [warnings { $s3270_console->connect_and_login(); }], + bag( + re(qr/connect_and_login.*\nRECONNECT.*\n/), re(qr/trying hard shutdown and reconnect.*/), + ), 'got reboot attempt', + ); +}; + +done_testing(); ++++++ os-autoinst.obsinfo ++++++ --- /var/tmp/diff_new_pack.w4ePm8/_old 2025-02-05 17:26:19.649439328 +0100 +++ /var/tmp/diff_new_pack.w4ePm8/_new 2025-02-05 17:26:19.653439493 +0100 @@ -1,5 +1,5 @@ name: os-autoinst -version: 4.6.1738604220.30e658a -mtime: 1738604220 -commit: 30e658ab7f30b813f234bc3d2982385d1404aa44 +version: 4.6.1738752967.6623798 +mtime: 1738752967 +commit: 66237987c9e69690e9e7836183ba36cdd1023f51