Skip to content

Commit

Permalink
experiment: Unify perl linting rules
Browse files Browse the repository at this point in the history
Testing the perltidy config from os-autoinst/os-autoinst-common#30
  • Loading branch information
josegomezr committed Oct 25, 2023
1 parent 576c710 commit 2afb471
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion OpenQA/Qemu/BlockDevConf.pm
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ sub gen_qemu_img_cmdlines ($self) { map { $_->gen_qemu_img_cmdlines() } @{$self-

sub gen_qemu_img_convert ($self, $filter, $img_dir, $name, $qemu_compress_qcow) {
map { $_->gen_qemu_img_convert($img_dir, $name, $qemu_compress_qcow) }
grep { $_->id =~ $filter } @{$self->_drives};
grep { $_->id =~ $filter } @{$self->_drives};
}

=head3 gen_unlink_list
Expand Down
2 changes: 1 addition & 1 deletion t/10-virtio_terminal.t
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ subtest "Test open_pipe() error condition" => sub {

$term = consoles::virtio_terminal->new('unit-test-console', {socked_path => $socket_path});
combined_like { throws_ok { $term->open_pipe() } qr/No such file or directory/, "Throw exception if pipe doesn't exists" }
qr/\[debug\].*open_pipe/, 'log for open_pipe on non-existent pipe';
qr/\[debug\].*open_pipe/, 'log for open_pipe on non-existent pipe';

$vterminal_mock = Test::MockModule->new('consoles::virtio_terminal');
$vterminal_mock->redefine("get_pipe_sz", sub { 1 });
Expand Down
12 changes: 6 additions & 6 deletions t/18-backend-qemu.t
Original file line number Diff line number Diff line change
Expand Up @@ -589,24 +589,24 @@ subtest 'special cases when starting QEMU' => sub {
subtest 'various error cases' => sub {
$bmwqemu::vars{NICTYPE} = 'foo';
combined_like { throws_ok { $backend->start_qemu } qr/unknown NICTYPE foo/, 'dies on unknown NICTYPE' }
qr/qemu version.*Initializing block device images/si, 'expected logs until exception thrown (1)';
qr/qemu version.*Initializing block device images/si, 'expected logs until exception thrown (1)';
$bmwqemu::vars{BOOTFROM} = 'punch-card';
combined_like { throws_ok { $backend->start_qemu } qr{unsupported boot order: punch-card}, 'dies on unsupported boot order' }
qr/qemu version/si, 'expected logs until exception thrown (2)';
qr/qemu version/si, 'expected logs until exception thrown (2)';
$bmwqemu::vars{LAPTOP} = '..';
combined_like { throws_ok { $backend->start_qemu } qr{invalid characters in LAPTOP}, 'dies on invalid characters in LAPTOP' }
qr/qemu version/si, 'expected logs until exception thrown (3)';
qr/qemu version/si, 'expected logs until exception thrown (3)';
$bmwqemu::vars{LAPTOP} = 'auslaufmoDELL';
combined_like { throws_ok { $backend->start_qemu } qr{no dmi data for 'auslaufmoDELL'}, 'dies on unknown LAPTOP' }
qr/qemu version/si, 'expected logs until exception thrown (4)';
qr/qemu version/si, 'expected logs until exception thrown (4)';
$bmwqemu::vars{KERNEL} = 'does-not-exist';
combined_like { throws_ok { $backend->start_qemu } qr{'/.*/does-not-exist' missing, check KERNEL}, 'dies on non-existant BOOT/KERNEL/INITRD' }
qr/qemu version/si, 'expected logs until exception thrown (5)';
qr/qemu version/si, 'expected logs until exception thrown (5)';
$bmwqemu::vars{UEFI_PFLASH} = 0;
$bmwqemu::vars{UEFI} = 1;
$bmwqemu::vars{UEFI_PFLASH_CODE} = 0;
combined_like { throws_ok { $backend->start_qemu } qr{No UEFI firmware can be found}, 'dies if UEFI firmware not found' }
qr/qemu version/si, 'expected logs until exception thrown (6)';
qr/qemu version/si, 'expected logs until exception thrown (6)';
};
};

Expand Down
4 changes: 2 additions & 2 deletions t/27-consoles-vnc.t
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ subtest 'setting socket timeout' => sub {
$inet_mock->redefine(new => sub ($class, @args) { %socket_args = @args; $s });
$c->hostname('10.161.145.95');
combined_like { throws_ok { $c->login } qr/unexpected end of data/, 'login dies on unexpected end of data' }
qr/warn.*login.*Unable to set VNC socket timeout: .+/, 'timeout would have been passed to socket';
qr/warn.*login.*Unable to set VNC socket timeout: .+/, 'timeout would have been passed to socket';
is $socket_args{Timeout}, 6, 'remote timeout passed to socket constructor' or diag explain \%socket_args;
@printed = ();
};
Expand All @@ -99,7 +99,7 @@ subtest 'handling connect timeout' => sub {
_setup_rfb_magic;
combined_like {
throws_ok { $c->login } 'OpenQA::Exception::VNCSetupError', 'dies on connect timeout' }
qr/.*Error connecting to.*/, 'error logged';
qr/.*Error connecting to.*/, 'error logged';
is $attempts, 7, 'login attempts for local hostname';
$attempts = 0;
$c->hostname('10.161.145.95');
Expand Down
2 changes: 1 addition & 1 deletion t/29-backend-ipmi.t
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ subtest 'cold reset' => sub {

$ipmi->redefine(ipmitool => sub { die 'fake error' });
throws_ok { combined_like { $backend->do_mc_reset } qr/IPMI mc reset failure: fake error/, 'error logged' }
qr/IPMI mc reset failure after 3 tries/, 'dies when retries exhausted';
qr/IPMI mc reset failure after 3 tries/, 'dies when retries exhausted';
};

subtest 'dell sleep' => sub {
Expand Down

0 comments on commit 2afb471

Please sign in to comment.