The previous self-test started a plain nginx with no VIRTUAL_HOST and only
checked that dig exited 0, so it never exercised routing and a pass did not mean
a container was reachable.
self-test now: requires the http-proxy and dns services to be running; starts a
throwaway container with VIRTUAL_HOST set to a test domain derived from the first
configured TLD; asserts DNS resolves that domain to the configured target IP;
probes the proxy over HTTP and HTTPS (via curl --resolve, retrying while routes
propagate) and requires HTTP 200 on both; and always removes the test container
via a RETURN trap. It exits non-zero with a per-check report when any check
fails.
Verified against the dev stack: DNS, HTTP, and HTTPS checks pass and the test
container is cleaned up.
Closes: #104
Assisted-by: claude-code/claude-opus-4-8
User description
Closes #104
Problem
spark-http-proxy self-teststarted a plainnginxwith noVIRTUAL_HOST, so the proxy never managed it and routing was never exercised. The only assertion was thatdigexited 0 (it didn't even check the returned IP). A passing self-test therefore did not mean a container was actually reachable.Change
run_self_testis now a real end-to-end check:http-proxyanddnsservices to be running.VIRTUAL_HOST=<test-domain>(derived from the first configured TLD, e.g.spark-http-proxy-selftest.loc).curl --resolve(so both the connection target and TLS SNI match the host), retrying while routes propagate, and requires200on both.RETURNtrap.Exits non-zero with a per-check report on failure.
Verification
Ran against the dev stack (
make dev-up):Test container cleaned up by the trap (0 leftovers).
bash -nand shellcheck clean for the changed function.PR Type
Enhancement
Description
self-testupgraded from DNS-only check to full end-to-end routing verificationAdds HTTP and HTTPS proxy routing checks with retry logic via
curl --resolveValidates DNS resolves test domain to configured target IP (value comparison)
Test container now uses
VIRTUAL_HOSTand is cleaned up viaRETURNtrapDiagram Walkthrough
File Walkthrough
spark-http-proxy
Upgrade self-test to end-to-end HTTP/HTTPS routing checkbin/spark-http-proxy
self_test_http_probehelper that polls HTTP/HTTPS viacurl--resolvewith retries until 200 or timeoutrun_self_testnow checks bothhttp-proxyanddnsservices are runningbefore proceeding
VIRTUAL_HOST=(derived from firstconfigured TLD)
HTTP_PROXY_DNS_TARGET_IPinstead of just checking exit codeRETURNtrap to always clean up the test container; tracksper-check failures with clear report
CHANGELOG.md
Document self-test end-to-end routing change in changelogCHANGELOG.md
self-testend-to-endrouting improvement referencing issue self-test only checks DNS liveness, not routing #104