diff --git a/xCAT-test/autotest/testcase/commoncmd/check_provisioning_source.sh b/xCAT-test/autotest/testcase/commoncmd/check_provisioning_source.sh index 9b6f7f632..ea18505a7 100755 --- a/xCAT-test/autotest/testcase/commoncmd/check_provisioning_source.sh +++ b/xCAT-test/autotest/testcase/commoncmd/check_provisioning_source.sh @@ -202,10 +202,11 @@ if [ "$SN_STATE" != ok ]; then RC=1 fi -# The management node provisioned the service node over http, so its log gains lines on every -# hierarchical run. A log with nothing new cannot show that the management node served nothing. -if [ "$MN_STATE" != ok ] || [ "$MN_NEW" -eq 0 ]; then - echo "provisioning source error: no httpd access log with new entries could be read on $MN" >&2 +# An empty log makes "the management node served nothing" a property of the file, not a +# measurement. New lines are NOT required: the service node is provisioned before the baseline, so +# after it a correct hierarchical run leaves the management node's log unchanged. +if [ "$MN_STATE" != ok ] || [ "$MN_LINES" -eq 0 ]; then + echo "provisioning source error: no httpd access log with entries could be read on $MN" >&2 RC=1 fi diff --git a/xCAT-test/bats/check_provisioning_source.bats b/xCAT-test/bats/check_provisioning_source.bats index bcf5b76f9..4f05322ce 100644 --- a/xCAT-test/bats/check_provisioning_source.bats +++ b/xCAT-test/bats/check_provisioning_source.bats @@ -198,14 +198,31 @@ seed_logs() [[ "$output" == *"no httpd access log could be read on $SN"* ]] } -@test "a management node log with nothing new fails the check instead of reading as silence" { +# The service node is provisioned before the baseline, so on a correct hierarchical run the +# management node serves nothing after it and its log does not grow. Every other case here appends +# a management-node line after the baseline, so none of them reaches this state. +@test "a management node log that does not grow after the baseline still passes" { seed_logs take_baseline access_line "$CN_IP" 12345678 /tftpboot/xcat/genesis.kernel >>"$SN_LOG" + run_check + [ "$status" -eq 0 ] + [[ "$output" == *"provisioning source ok"* ]] +} + +# The guard the case above relaxes still has a job. An empty log makes "the management node served +# nothing" a property of the file, not a measurement. +@test "an empty management node log fails the check instead of passing it" { + : >"$MN_LOG" + access_line 192.0.2.30 512 /install/rh/x86_64/ >"$SN_LOG" + take_baseline + access_line "$CN_IP" 12345678 /tftpboot/xcat/genesis.kernel >>"$SN_LOG" + run_check [ "$status" -ne 0 ] - [[ "$output" == *"no httpd access log with new entries could be read on mn01"* ]] + [[ "$output" == *"no httpd access log with entries could be read on"* ]] + [[ "$output" != *"provisioning source ok"* ]] } @test "the Debian per-vhost log format is read as the client address" {