mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-08-26 00:26:40 +00:00
32b99b9d64
The guard held the exact unbounded apt-get install text, so the new timeout wrapper failed it. Require the timeout command and allow the apt transfer options, so an unbounded install now fails the guard.
48 lines
1.3 KiB
Perl
48 lines
1.3 KiB
Perl
#!/usr/bin/env perl
|
|
use strict;
|
|
use warnings;
|
|
|
|
use File::Spec;
|
|
use FindBin;
|
|
use Test::More;
|
|
|
|
my $script = File::Spec->catfile(
|
|
$FindBin::Bin, '..', '..', 'github_action_xcat_test.pl'
|
|
);
|
|
open( my $fh, '<', $script ) or die "Unable to read $script: $!";
|
|
my $contents = do { local $/; <$fh> };
|
|
close($fh);
|
|
|
|
my $workflow = File::Spec->catfile(
|
|
$FindBin::Bin, '..', '..', '.github', 'workflows', 'xcat_test.yml'
|
|
);
|
|
open( my $workflow_fh, '<', $workflow )
|
|
or die "Unable to read $workflow: $!";
|
|
my $workflow_contents = do { local $/; <$workflow_fh> };
|
|
close($workflow_fh);
|
|
|
|
for my $package (qw(xcat xcat-probe xcat-test)) {
|
|
like(
|
|
$contents,
|
|
qr{sudo timeout \d+ env DEBIAN_FRONTEND=noninteractive apt-get (?:-o \S+ )*install -y \Q$package\E },
|
|
"$package installation is noninteractive and bounded"
|
|
);
|
|
}
|
|
|
|
unlike( $contents, qr{yes\s*\|\s*(?:sudo\s+)?apt-get},
|
|
'package input is not piped into maintainer scripts' );
|
|
|
|
like(
|
|
$workflow_contents,
|
|
qr{sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y\b},
|
|
'workflow dependency installation is noninteractive'
|
|
);
|
|
|
|
like(
|
|
$contents,
|
|
qr{next if\(\$file =~ /\\/opt\\/xcat\\/share\\/xcat\\/tools\\/autotest\\/unit\\//\);},
|
|
'installed source-layout tests are excluded from syntax checks'
|
|
);
|
|
|
|
done_testing();
|