fix: drop shell-quoted body grep and add docker label diagnostic
The retry loop in T3 fed the response body through `bash -c "grep <<<\"$body\""`. When the body contains JSON env vars with embedded double quotes (PS1, paths with `$`, etc.), the inner `"$body"` terminates the outer `bash -c "..."` quoting prematurely and bash tries to execute the JSON content as commands. grep itself returns 0 but the subsequent error messages get appended to bats's `$output`, breaking `assert_output "0"`. Each T3 now curls into a file and greps the file directly, so the body never crosses a shell-quote boundary. Each label-based backend file additionally echoes `docker inspect <app>.api.1 --format '{{json .Config.Labels}}'` after `ps:rebuild`, surfacing the actual labels emitted onto the api container so the CI log shows whether the docker-args-process-deploy emission matches what the proxy daemon expects. A 5s sleep after rebuild gives the proxy daemon time to read the new labels before the HTTP retry loop starts.
This commit is contained in:
4 files changed
+184
-26
No files matched your search
@@ -99,18 +99,21 @@ teardown() {
|
||||
# return 200 for /api/v0/Procfile so the polling loop in
|
||||
# assert_http_localhost_response_contains exits on status alone before
|
||||
# nginx picks up the new config. Hand-roll a retry that polls the BODY
|
||||
# until it no longer contains api's marker.
|
||||
local body=""
|
||||
# written to a file (avoids shell-quoting issues with JSON bodies that
|
||||
# contain embedded double quotes).
|
||||
rm -f /tmp/route-removed-body
|
||||
local attempt=0
|
||||
for attempt in $(seq 1 30); do
|
||||
run curl --connect-to "${TEST_APP}.${DOKKU_DOMAIN}:80:localhost:80" -kSs "http://${TEST_APP}.${DOKKU_DOMAIN}:80/api/v0/Procfile"
|
||||
body="$output"
|
||||
if ! grep -q 'python3 -m http.server' <<<"$body"; then
|
||||
curl --connect-to "${TEST_APP}.${DOKKU_DOMAIN}:80:localhost:80" -kSso /tmp/route-removed-body "http://${TEST_APP}.${DOKKU_DOMAIN}:80/api/v0/Procfile" || true
|
||||
if ! grep -q 'python3 -m http.server' /tmp/route-removed-body 2>/dev/null; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
echo "final body attempt $attempt: $body"
|
||||
run /bin/bash -c "grep -c 'python3 -m http.server' <<<\"$body\" || true"
|
||||
echo "final body attempt $attempt:"
|
||||
cat /tmp/route-removed-body
|
||||
echo
|
||||
run /bin/bash -c "grep -c 'python3 -m http.server' /tmp/route-removed-body || true"
|
||||
assert_output "0"
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user