diff --git a/xCAT-test/autotest/testcase/commoncmd/check_provisioning_source.sh b/xCAT-test/autotest/testcase/commoncmd/check_provisioning_source.sh index fec31edd3..0fb2c7ac8 100755 --- a/xCAT-test/autotest/testcase/commoncmd/check_provisioning_source.sh +++ b/xCAT-test/autotest/testcase/commoncmd/check_provisioning_source.sh @@ -21,7 +21,8 @@ # Run --baseline before provisioning: an earlier flat run leaves management-node requests for the # same address, and counting the whole log fails a later hierarchical run for them. And only a # request under /install or /tftpboot is a boot payload: a 404 for /favicon.ico is a request from -# the compute node that carries no payload, and it must not stand for one. +# the compute node that carries no payload, and it must not stand for one. wget asks for the root +# image as //install/..., so the leading slash repeats. # # Scope: the PXE ROM exchange hands out xcat/xnba.kpxe over TFTP and httpd never sees it. # xnba.kpxe is the same binary on both servers, so it decides nothing about the fetch source. @@ -108,7 +109,7 @@ count_local_requests() if ($1 != ip && $2 != ip) next path = "" for (i = 1; i <= NF; i++) if ($i ~ /^"(GET|HEAD|POST)$/) { path = $(i + 1); break } - if (path ~ /^\/(install|tftpboot)\//) payload++ + if (path ~ /^\/+(install|tftpboot)\//) payload++ } END { print token, "ok", payload + 0, fresh + 0, total + 0 } ' $logs diff --git a/xCAT-test/bats/check_provisioning_source.bats b/xCAT-test/bats/check_provisioning_source.bats index 6a1d78637..c3d4ab94e 100644 --- a/xCAT-test/bats/check_provisioning_source.bats +++ b/xCAT-test/bats/check_provisioning_source.bats @@ -198,10 +198,9 @@ seed_logs() [[ "$output" == *"no httpd access log could be read on $SN"* ]] } -# 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" { +# The management node provisions the service node BEFORE this baseline, so it can serve nothing +# after it. That is the hierarchical result, and it was read as a broken log. +@test "a management node that serves nothing after the baseline passes" { seed_logs take_baseline access_line "$CN_IP" 12345678 /tftpboot/xcat/genesis.kernel >>"$SN_LOG" @@ -211,9 +210,7 @@ seed_logs() [[ "$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" { +@test "a management node log with no entry at all fails the check instead of reading as silence" { : >"$MN_LOG" access_line 192.0.2.30 512 /install/rh/x86_64/ >"$SN_LOG" take_baseline @@ -221,8 +218,34 @@ seed_logs() run_check [ "$status" -ne 0 ] - [[ "$output" == *"no httpd access log with entries could be read on"* ]] - [[ "$output" != *"provisioning source ok"* ]] + [[ "$output" == *"no httpd access log with entries could be read on mn01"* ]] +} + +# The compute node fetches the root image with wget from a URL that carries a double slash, so +# the path in the log reads //install/... and the payload filter did not match it. +@test "a boot payload requested under a doubled slash counts" { + seed_logs + take_baseline + access_line "$CN_IP" 978729607 //install/netboot/ubuntu/x86_64/compute/rootimg.cpio.gz >>"$SN_LOG" + access_line 192.0.2.21 4096 /install/rh/x86_64/ >>"$MN_LOG" + + run_check + [ "$status" -eq 0 ] + [[ "$output" == *"provisioning source ok"* ]] +} + +@test "a doubled-slash boot payload from the management node reads as a flat provision" { + seed_logs + take_baseline + access_line "$CN_IP" 12345678 /tftpboot/xcat/genesis.kernel >>"$SN_LOG" + { + access_line 192.0.2.21 4096 /install/rh/x86_64/ + access_line "$CN_IP" 978729607 //install/netboot/ubuntu/x86_64/compute/rootimg.cpio.gz + } >>"$MN_LOG" + + run_check + [ "$status" -ne 0 ] + [[ "$output" == *"this provision was flat"* ]] } @test "the Debian per-vhost log format is read as the client address" {