scripts/PROXY_TESTING.md
This directory contains two testing scripts for the gt-proxy-server and gt-proxy-client:
For a fast verification that the proxy is functional:
./test-proxy-smoke.sh
What it does:
gt version command through the proxyBest for: Quick CI/CD checks, rapid iteration during development
For thorough validation with multiple test scenarios:
./test-proxy-manual.sh
What it does:
gt commands:
gt --versiongt statusgt convoy --helpBest for: Thorough verification, manual exploration, debugging
Exit: Press Ctrl+C to stop the server and cleanup.
Once a testing script is running, you can manually test from another terminal:
curl -s \
--cert /tmp/gt-proxy-quick-test/client.crt \
--key /tmp/gt-proxy-quick-test/client.key \
--cacert /tmp/gt-proxy-quick-test/ca-client.crt \
--resolve gt-proxy-server:9876:127.0.0.1 \
-X POST \
-H "Content-Type: application/json" \
-d '{"argv":["gt","version"]}' \
https://gt-proxy-server:9876/v1/exec
# List ready issues
curl -s --cert ... -d '{"argv":["bd","ready"]}' https://localhost:9876/v1/exec
# Show an issue
curl -s --cert ... -d '{"argv":["bd","show","123"]}' https://localhost:9876/v1/exec
# Check version
curl -s --cert ... -d '{"argv":["gt","version"]}' https://localhost:9876/v1/exec
The proxy has default rate limits configured:
You can trigger rate limiting with rapid requests and expect HTTP 429:
for i in {1..50}; do
curl -s --cert ... -d '{"argv":["version"]}' https://localhost:9876/v1/exec &
done
wait
# Smoke test logs
tail -f /tmp/gt-proxy-quick-test/server.log
# Manual test logs
tail -f /tmp/gt-proxy-test/logs/server.log
You can customize the test behavior with environment variables:
# Use a different port
PROXY_PORT=9999 ./test-proxy-smoke.sh
# Use a different town root (where gt/bd are located)
TOWN_ROOT=/custom/gt/path ./test-proxy-manual.sh
# Use a different CA directory
CA_DIR=/custom/ca/path ./test-proxy-manual.sh
lsof -i :9876GT_TOWN is set correctly (default: ~/gt)openssl versiongt-<rig>-<name>ps aux | grep gt-proxy-servernetstat -an | grep 9876gt-<rig>-<name>Before submitting a PR with proxy changes, verify:
For testing the proxy in a containerized environment:
# Build a test container image
docker build -f Dockerfile.e2e -t gastown-test:latest .
# Run tests in container
docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
gastown-test:latest \
go test -v ./internal/proxy/...
See Dockerfile.e2e and the CI workflows for more details.