mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-08-27 00:56:43 +00:00
test(genesis): cover logging failures
This commit is contained in:
@@ -612,6 +612,8 @@ my $init_recipe = read_file(
|
||||
);
|
||||
like( $init_recipe, qr/\bcoreutils\b/,
|
||||
'runtime status dependencies are explicit' );
|
||||
like( $init_recipe, qr/\butil-linux-logger\b/,
|
||||
'runtime logging dependency is explicit' );
|
||||
like( $init_recipe, qr/file:\/\/genesis-status/,
|
||||
'runtime status helper is packaged' );
|
||||
like( $init_recipe, qr/file:\/\/genesis-maintenance-shell/,
|
||||
|
||||
@@ -136,7 +136,10 @@ XCAT_SOURCE_ADDRESS=192.0.2.98
|
||||
ENV
|
||||
|
||||
write_file( File::Spec->catfile( $bin, 'logger' ),
|
||||
"#!/bin/sh\nexit 0\n", 0755 );
|
||||
<<'SH', 0755 );
|
||||
#!/bin/sh
|
||||
[ -z "${XCAT_TEST_LOGGER_FAIL-}" ]
|
||||
SH
|
||||
write_file( File::Spec->catfile( $bin, 'uname' ), <<'SH', 0755 );
|
||||
#!/bin/sh
|
||||
[ "$1" = "-m" ] && printf '%s\n' "${XCAT_TEST_ARCH-x86_64}"
|
||||
@@ -320,6 +323,10 @@ like(
|
||||
qr/^STATE=READY$/m,
|
||||
'discovery publishes completion'
|
||||
);
|
||||
$environment{XCAT_TEST_LOGGER_FAIL} = 1;
|
||||
is( run_script( $discover_script, \%environment ), 0,
|
||||
'successful discovery does not depend on logging' );
|
||||
delete $environment{XCAT_TEST_LOGGER_FAIL};
|
||||
|
||||
$environment{XCAT_TEST_NO_SOL} = 1;
|
||||
is( run_script( $discover_script, \%environment ), 0,
|
||||
@@ -446,6 +453,10 @@ like(
|
||||
qr/^STATE=READY$/m,
|
||||
'certificate client publishes completion'
|
||||
);
|
||||
$environment{XCAT_TEST_LOGGER_FAIL} = 1;
|
||||
is( run_script( $getcert_script, \%environment ), 0,
|
||||
'certificate enrollment does not depend on logging' );
|
||||
delete $environment{XCAT_TEST_LOGGER_FAIL};
|
||||
|
||||
write_file( $metadata_file, "XCAT_NODE_NAME=invalid/name\n" );
|
||||
isnt( run_script( $getcert_script, \%environment ), 0,
|
||||
@@ -474,7 +485,7 @@ isnt( run_script( $credential_callback_script, \%environment, "unknown" ), 0,
|
||||
my $recipe = read_file(
|
||||
File::Spec->catfile( $discovery_dir, 'xcat-genesis-discovery_1.0.bb' )
|
||||
);
|
||||
like( $recipe, qr/^RDEPENDS:\$\{PN\} = "bash coreutils gzip iproute2 openssl-bin util-linux-lsblk"$/m,
|
||||
like( $recipe, qr/^RDEPENDS:\$\{PN\} = "bash coreutils gzip iproute2 openssl-bin util-linux-logger util-linux-lsblk"$/m,
|
||||
'discovery dependencies are explicit' );
|
||||
like( $recipe, qr/xcat-genesis-discovery\.socket/,
|
||||
'discovery callback socket is packaged' );
|
||||
|
||||
@@ -134,7 +134,11 @@ write_file( File::Spec->catfile( $eth0, 'operstate' ), "up\n" );
|
||||
write_file( $uptime, "123.45 456.78\n" );
|
||||
write_file(
|
||||
File::Spec->catfile( $bin, 'logger' ),
|
||||
"#!/bin/sh\nexit 0\n", 0755
|
||||
<<'SH', 0755
|
||||
#!/bin/sh
|
||||
printf 'logger %s\n' "$*" >>"$XCAT_TEST_LOG"
|
||||
[ -z "${XCAT_TEST_LOGGER_FAIL-}" ]
|
||||
SH
|
||||
);
|
||||
write_file(
|
||||
File::Spec->catfile( $bin, 'ip' ),
|
||||
@@ -402,6 +406,14 @@ VERIFIED_SECONDS=123
|
||||
ENV
|
||||
'network readiness publishes status'
|
||||
);
|
||||
{
|
||||
my %failed_logger_environment = (
|
||||
%environment,
|
||||
XCAT_TEST_LOGGER_FAIL => 1,
|
||||
);
|
||||
is( run_script( $network_script, \%failed_logger_environment ), 0,
|
||||
'network readiness does not depend on logging' );
|
||||
}
|
||||
|
||||
my $safe_network_state = read_file(
|
||||
File::Spec->catfile( $state_dir, 'genesis.env' )
|
||||
@@ -538,6 +550,14 @@ like(
|
||||
qr/^ACTION=shell\nTARGET=\nNODE_NAME=node042$/m,
|
||||
'registration publishes confirmed identity and the selected action'
|
||||
);
|
||||
{
|
||||
my %failed_logger_environment = (
|
||||
%environment,
|
||||
XCAT_TEST_LOGGER_FAIL => 1,
|
||||
);
|
||||
is( run_script( $register_script, \%failed_logger_environment ), 0,
|
||||
'successful registration does not depend on logging' );
|
||||
}
|
||||
|
||||
write_file( $command_log, '' );
|
||||
write_file( $cmdline, "xcatd=192.0.2.213:3001\n" );
|
||||
|
||||
Reference in New Issue
Block a user