From 8375bb543a08974801860aec8b0fd131f5891626 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 7 Jun 2026 23:36:02 -0400 Subject: [PATCH] chore: drop debug scaffolding from proxy-route bats files Removes the per-step docker inspect label dumps in the caddy/traefik/openresty backend tests, the kubectl get service/ingress/endpoints dumps in the k3s T1 tests, the openresty T2 sidecar log fallback that became unnecessary once 0.12.1 fixed the upstream cache regression, and the trailing cat of /tmp/route-removed-body in every T3. The output/status echoes that match the project's bats convention stay, as does the file-based grep in T3 and every assertion-bearing kubectl call. --- tests/unit/proxy-route-caddy.bats | 40 ---------------------- tests/unit/proxy-route-k3s-nginx.bats | 9 ----- tests/unit/proxy-route-k3s-traefik.bats | 9 ----- tests/unit/proxy-route-nginx.bats | 3 -- tests/unit/proxy-route-openresty.bats | 45 ++----------------------- tests/unit/proxy-route-traefik.bats | 33 ------------------ 6 files changed, 3 insertions(+), 136 deletions(-) diff --git a/tests/unit/proxy-route-caddy.bats b/tests/unit/proxy-route-caddy.bats index f9c4ca33f..ee2db14de 100644 --- a/tests/unit/proxy-route-caddy.bats +++ b/tests/unit/proxy-route-caddy.bats @@ -37,18 +37,6 @@ teardown() { echo "status: $status" assert_success - # Surface the actual labels attached to the api container so CI logs show - # whether docker-args-process-deploy emitted them correctly. - run /bin/bash -c "docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1 | jq . 2>/dev/null || docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1" - echo "api labels: $output" - - # Also dump the web container's labels so we can compare site declarators - # between web and api - caddy treats DOMAIN and DOMAIN:80 as separate - # sites, and a mismatch keeps caddy-docker-proxy from merging the two - # containers' directives into a single site block. - run /bin/bash -c "docker inspect ${TEST_APP}.web.1 --format '{{json .Config.Labels}}' 2>&1 | jq . 2>/dev/null || docker inspect ${TEST_APP}.web.1 --format '{{json .Config.Labels}}' 2>&1" - echo "web labels: $output" - # Give the daemon a moment to read the new labels. sleep 5 @@ -72,11 +60,6 @@ teardown() { echo "status: $status" assert_success - # Surface the actual labels attached to the api container so CI logs show - # whether docker-args-process-deploy emitted them correctly. - run /bin/bash -c "docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1 | jq . 2>/dev/null || docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1" - echo "api labels: $output" - # Give the daemon a moment to read the new labels. sleep 5 assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404" @@ -88,11 +71,6 @@ teardown() { echo "status: $status" assert_success - # Surface the actual labels attached to the api container so CI logs show - # whether docker-args-process-deploy emitted them correctly. - run /bin/bash -c "docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1 | jq . 2>/dev/null || docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1" - echo "api labels: $output" - # Give the daemon a moment to read the new labels. sleep 5 assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "python3 -m http.server" @@ -113,11 +91,6 @@ teardown() { echo "status: $status" assert_success - # Surface the actual labels attached to the api container so CI logs show - # whether docker-args-process-deploy emitted them correctly. - run /bin/bash -c "docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1 | jq . 2>/dev/null || docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1" - echo "api labels: $output" - # Give the daemon a moment to read the new labels. sleep 5 assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404" @@ -129,11 +102,6 @@ teardown() { echo "status: $status" assert_success - # Surface the actual labels attached to the api container so CI logs show - # whether docker-args-process-deploy emitted them correctly. - run /bin/bash -c "docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1 | jq . 2>/dev/null || docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1" - echo "api labels: $output" - # Give the daemon a moment to read the new labels. sleep 5 assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "python3 -m http.server" @@ -154,11 +122,6 @@ teardown() { echo "status: $status" assert_success - # Surface the actual labels attached to the api container so CI logs show - # whether docker-args-process-deploy emitted them correctly. - run /bin/bash -c "docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1 | jq . 2>/dev/null || docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1" - echo "api labels: $output" - # Give the daemon a moment to read the new labels. sleep 5 @@ -173,9 +136,6 @@ teardown() { fi sleep 1 done - 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" } diff --git a/tests/unit/proxy-route-k3s-nginx.bats b/tests/unit/proxy-route-k3s-nginx.bats index 518cb060b..c09389166 100644 --- a/tests/unit/proxy-route-k3s-nginx.bats +++ b/tests/unit/proxy-route-k3s-nginx.bats @@ -49,15 +49,6 @@ teardown() { echo "status: $status" assert_success - # Diagnostic: dump the cluster state so CI logs show whether the api - # Service and the Ingress are wired correctly. - run /bin/bash -c "kubectl get service -o yaml 2>&1" - echo "services: $output" - run /bin/bash -c "kubectl get ingress -o yaml 2>&1" - echo "ingresses: $output" - run /bin/bash -c "kubectl get endpoints -o yaml 2>&1" - echo "endpoints: $output" - # Without --strip-prefix, /api/v0/Procfile reaches api as /api/v0/Procfile # which python's http.server returns 404 for. 404 proves the route reaches # api (web's catch-all would have returned 200). diff --git a/tests/unit/proxy-route-k3s-traefik.bats b/tests/unit/proxy-route-k3s-traefik.bats index afecac6e0..89dbae262 100644 --- a/tests/unit/proxy-route-k3s-traefik.bats +++ b/tests/unit/proxy-route-k3s-traefik.bats @@ -49,15 +49,6 @@ teardown() { echo "status: $status" assert_success - # Diagnostic: dump the cluster state so CI logs show whether the api - # Service and the IngressRoute are wired correctly. - run /bin/bash -c "kubectl get service -o yaml 2>&1" - echo "services: $output" - run /bin/bash -c "kubectl get ingressroute.traefik.io -o yaml 2>&1" - echo "ingressroutes: $output" - run /bin/bash -c "kubectl get endpoints -o yaml 2>&1" - echo "endpoints: $output" - # Without --strip-prefix, /api/v0/Procfile reaches api as /api/v0/Procfile # which python's http.server returns 404 for. 404 proves the route reaches # api (web's catch-all would have returned 200). diff --git a/tests/unit/proxy-route-nginx.bats b/tests/unit/proxy-route-nginx.bats index 988762e6a..8cf993301 100644 --- a/tests/unit/proxy-route-nginx.bats +++ b/tests/unit/proxy-route-nginx.bats @@ -110,9 +110,6 @@ teardown() { fi sleep 1 done - 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" } diff --git a/tests/unit/proxy-route-openresty.bats b/tests/unit/proxy-route-openresty.bats index 98b02d5d3..db7e321a2 100644 --- a/tests/unit/proxy-route-openresty.bats +++ b/tests/unit/proxy-route-openresty.bats @@ -37,11 +37,6 @@ teardown() { echo "status: $status" assert_success - # Surface the actual labels attached to the api container so CI logs show - # whether docker-args-process-deploy emitted them correctly. - run /bin/bash -c "docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1 | jq . 2>/dev/null || docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1" - echo "api labels: $output" - # Give the daemon a moment to read the new labels. sleep 5 @@ -65,11 +60,6 @@ teardown() { echo "status: $status" assert_success - # Surface the actual labels attached to the api container so CI logs show - # whether docker-args-process-deploy emitted them correctly. - run /bin/bash -c "docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1 | jq . 2>/dev/null || docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1" - echo "api labels: $output" - # Give the daemon a moment to read the new labels. sleep 5 assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404" @@ -81,20 +71,9 @@ teardown() { echo "status: $status" assert_success - # Surface the actual labels attached to the api container so CI logs show - # whether docker-args-process-deploy emitted them correctly. - run /bin/bash -c "docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1 | jq . 2>/dev/null || docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1" - echo "api labels: $output" - - # openresty-docker-proxy 0.12.0 has a polling/caching delay before it - # re-renders the config after labels on an existing route key change. - # Give it a longer window than the default HTTP retry. If this still - # times out, dump the sidecar logs so we can file an upstream bug. - HTTP_ASSERT_RETRIES=60 assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "python3 -m http.server" || { - run /bin/bash -c "dokku openresty:logs --num 200 2>&1 || docker logs openresty-openresty-1 --tail 200 2>&1" - echo "openresty sidecar logs: $output" - return 1 - } + # Give the sidecar a longer window than the default HTTP retry to detect + # and re-render after a route's labels change on the api container. + HTTP_ASSERT_RETRIES=60 assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "python3 -m http.server" } @test "(proxy-route:openresty) removing a route falls back to web" { @@ -112,11 +91,6 @@ teardown() { echo "status: $status" assert_success - # Surface the actual labels attached to the api container so CI logs show - # whether docker-args-process-deploy emitted them correctly. - run /bin/bash -c "docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1 | jq . 2>/dev/null || docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1" - echo "api labels: $output" - # Give the daemon a moment to read the new labels. sleep 5 assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404" @@ -128,11 +102,6 @@ teardown() { echo "status: $status" assert_success - # Surface the actual labels attached to the api container so CI logs show - # whether docker-args-process-deploy emitted them correctly. - run /bin/bash -c "docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1 | jq . 2>/dev/null || docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1" - echo "api labels: $output" - # Give the daemon a moment to read the new labels. sleep 5 assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "python3 -m http.server" @@ -153,11 +122,6 @@ teardown() { echo "status: $status" assert_success - # Surface the actual labels attached to the api container so CI logs show - # whether docker-args-process-deploy emitted them correctly. - run /bin/bash -c "docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1 | jq . 2>/dev/null || docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1" - echo "api labels: $output" - # Give the daemon a moment to read the new labels. sleep 5 @@ -172,9 +136,6 @@ teardown() { fi sleep 1 done - 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" } diff --git a/tests/unit/proxy-route-traefik.bats b/tests/unit/proxy-route-traefik.bats index 0c19d48b4..19609105e 100644 --- a/tests/unit/proxy-route-traefik.bats +++ b/tests/unit/proxy-route-traefik.bats @@ -39,11 +39,6 @@ teardown() { echo "status: $status" assert_success - # Surface the actual labels attached to the api container so CI logs show - # whether docker-args-process-deploy emitted them correctly. - run /bin/bash -c "docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1 | jq . 2>/dev/null || docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1" - echo "api labels: $output" - # Give the daemon a moment to read the new labels. sleep 5 @@ -67,11 +62,6 @@ teardown() { echo "status: $status" assert_success - # Surface the actual labels attached to the api container so CI logs show - # whether docker-args-process-deploy emitted them correctly. - run /bin/bash -c "docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1 | jq . 2>/dev/null || docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1" - echo "api labels: $output" - # Give the daemon a moment to read the new labels. sleep 5 assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404" @@ -83,11 +73,6 @@ teardown() { echo "status: $status" assert_success - # Surface the actual labels attached to the api container so CI logs show - # whether docker-args-process-deploy emitted them correctly. - run /bin/bash -c "docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1 | jq . 2>/dev/null || docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1" - echo "api labels: $output" - # Give the daemon a moment to read the new labels. sleep 5 assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "python3 -m http.server" @@ -109,11 +94,6 @@ teardown() { echo "status: $status" assert_success - # Surface the actual labels attached to the api container so CI logs show - # whether docker-args-process-deploy emitted them correctly. - run /bin/bash -c "docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1 | jq . 2>/dev/null || docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1" - echo "api labels: $output" - # Give the daemon a moment to read the new labels. sleep 5 assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404" @@ -126,11 +106,6 @@ teardown() { echo "status: $status" assert_success - # Surface the actual labels attached to the api container so CI logs show - # whether docker-args-process-deploy emitted them correctly. - run /bin/bash -c "docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1 | jq . 2>/dev/null || docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1" - echo "api labels: $output" - # Give the daemon a moment to read the new labels. sleep 5 assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "python3 -m http.server" @@ -152,11 +127,6 @@ teardown() { echo "status: $status" assert_success - # Surface the actual labels attached to the api container so CI logs show - # whether docker-args-process-deploy emitted them correctly. - run /bin/bash -c "docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1 | jq . 2>/dev/null || docker inspect ${TEST_APP}.api.1 --format '{{json .Config.Labels}}' 2>&1" - echo "api labels: $output" - # Give the daemon a moment to read the new labels. sleep 5 @@ -173,9 +143,6 @@ teardown() { fi sleep 1 done - 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" }