2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-07-31 18:19:40 +00:00

test(httpd): cover package activation across distros

This commit is contained in:
Vinícius Ferrão
2026-07-27 16:49:22 -03:00
parent 4c82e02a7b
commit f8267cb8f3
9 changed files with 72 additions and 0 deletions
@@ -100,6 +100,9 @@ gettab_key_table
getmacs_d
getmacs_f_D
getmacs_noderange
httpd_security_headers_install
httpd_security_headers_tftpboot
httpd_server_banner_masked
tabdump_servicenode
lsdef_a
lsdef_null
@@ -106,6 +106,9 @@ gettab_H
gettab_err
gettab_h
gettab_key_table
httpd_security_headers_install
httpd_security_headers_tftpboot
httpd_server_banner_masked
lsdef_a
lsdef_null
lsdef_t
@@ -106,6 +106,9 @@ gettab_H
gettab_err
gettab_h
gettab_key_table
httpd_security_headers_install
httpd_security_headers_tftpboot
httpd_server_banner_masked
lsdef_a
lsdef_null
lsdef_t
@@ -68,6 +68,9 @@ gettab_H
gettab_err
gettab_h
gettab_key_table
httpd_security_headers_install
httpd_security_headers_tftpboot
httpd_server_banner_masked
lsdef_a
lsdef_null
lsdef_t
@@ -72,6 +72,9 @@ gettab_H
gettab_err
gettab_h
gettab_key_table
httpd_security_headers_install
httpd_security_headers_tftpboot
httpd_server_banner_masked
lsdef_a
lsdef_null
lsdef_t
@@ -72,6 +72,9 @@ gettab_H
gettab_err
gettab_h
gettab_key_table
httpd_security_headers_install
httpd_security_headers_tftpboot
httpd_server_banner_masked
lsdef_a
lsdef_null
lsdef_t
@@ -48,6 +48,9 @@ gettab_H
gettab_err
gettab_h
gettab_key_table
httpd_security_headers_install
httpd_security_headers_tftpboot
httpd_server_banner_masked
lsdef_a
lsdef_null
lsdef_t
@@ -48,6 +48,9 @@ gettab_H
gettab_err
gettab_h
gettab_key_table
httpd_security_headers_install
httpd_security_headers_tftpboot
httpd_server_banner_masked
lsdef_a
lsdef_null
lsdef_t
+48
View File
@@ -0,0 +1,48 @@
#!/usr/bin/env perl
use strict;
use warnings;
use File::Spec;
use FindBin;
use Test::More;
my $repo_root = File::Spec->catdir( $FindBin::Bin, '..', '..' );
sub read_file {
my ($relative_path) = @_;
my $path = File::Spec->catfile( $repo_root, split( '/', $relative_path ) );
open( my $fh, '<', $path ) or die "Unable to read $path: $!";
my $contents = do { local $/; <$fh> };
close($fh);
return $contents;
}
my $xcat_spec = read_file('xCAT/xCAT.spec');
like( $xcat_spec, qr{a2enmod headers},
'management RPM enables mod_headers where Apache requires it' );
like( $xcat_spec,
qr{if \[ "\$1" = "1" \]; then.*?xcatconfig -i.*?else.*?xcatconfig -u -V.*?systemctl is-active --quiet "\$apachedaemon".*?systemctl reload "\$apachedaemon".*?/etc/init\.d/\$apachedaemon reload}s,
'management RPM reloads an active Apache service after upgrades' );
like( $xcat_spec, qr{apachedaemon='httpd'.*?apachedaemon='apache2'}s,
'management RPM covers both EL and SUSE Apache service names' );
like( $xcat_spec,
qr{/proc/1/root/\. 2>/dev/null.*?systemctl is-active --quiet "\$apachedaemon"}s,
'management RPM skips service management inside image chroots' );
my $xcatsn_spec = read_file('xCATsn/xCATsn.spec');
like( $xcatsn_spec, qr{a2enmod headers},
'service-node RPM enables mod_headers where Apache requires it' );
like( $xcatsn_spec,
qr{# for install or upgrade restart the daemon.*?/etc/init\.d/\$apachedaemon reload.*?systemctl reload \$apacheserviceunit}s,
'service-node RPM reloads Apache after installs and upgrades' );
my $xcat_postinst = read_file('xCAT/debian/postinst');
like( $xcat_postinst, qr{a2enmod -q headers.*?/etc/init\.d/apache2 restart}s,
'management Debian package enables mod_headers before restarting Apache' );
my $xcatsn_postinst = read_file('xCATsn/debian/postinst');
like( $xcatsn_postinst,
qr{a2enmod -q headers.*?/etc/init\.d/\$apachedaemon reload}s,
'service-node Debian package enables mod_headers before reloading Apache' );
done_testing();