This document explains how to use the automated admin control-plane test script:
tests/admin-test.sh.
The script spins up a local server and client, generates traffic, and validates
the JSON contract for http-proxy-admin ping, node, metrics, and auth flows.
Group and relay commands are covered by the Rust integration test
crates/proxy-server/tests/http_proxy_admin_cli.rs.
- Rust toolchain (
cargo,rustc) curllsofpython3(used for JSON validation)
Ports 12080 (client) and 12081 (server) must be free, unless you override them.
From the repo root:
./tests/admin-test.shThe script builds binaries (release if possible), launches server + client, executes admin CLI calls, and prints pass/fail results.
Phase 1 (default key, no admin token):
pingnodes list/add/removemetrics realtimemetrics connections --limitmetrics buckets --granularity {minute,hour,day}metrics top-n --category {hosts,ips}- Invalid parameters rejected by Clap parsing
Phase 2 (admin token + session key from env):
- Unauthorized request without token
- Unauthorized request with wrong token
- Authorized request with correct token
Additional coverage from Rust integration tests:
groups list/create/delete/add-node/remove-noderelay get/status/enable/disable/add-target/remove-target/set-algo
You can override defaults by exporting environment variables before running:
SERVER_PORT=13081 \
CLIENT_PORT=13080 \
CONTROL_KEY='control-session-key-32-bytes!!!!' \
ADMIN_TOKEN='my-admin-token' \
./tests/admin-test.shSERVER_PORT(default:12081)CLIENT_PORT(default:12080)CONTROL_KEY(default:control-session-key-32-bytes!!!!)- Must be exactly 32 bytes
ADMIN_TOKEN(default:admin-token-for-tests)
http-proxy-admin control payloads are encrypted. The server uses the following
fallback order when encryption is required:
CONTROL_SESSION_KEYSECRET_KEY- Built-in default key (
my-secret-key123my-secret-key123)
If you have a custom SECRET_KEY in your shell environment, Phase 1 will fail
because the admin CLI uses the built-in default key. Either:
- Unset
SECRET_KEYbefore running, or - Set
SECRET_KEYto the built‑in default key for the test run
Example:
SECRET_KEY='my-secret-key123my-secret-key123' ./tests/admin-test.shThe script prints a green check for each test and exits non‑zero on failure. On errors, it prints the raw admin response for debugging.
- "unrecognized subcommand 'topn'"
- Use
metrics top-n(with a dash), nottopn.
- Use
- "unauthorized"
- You started the server with
CONTROL_ADMIN_TOKENbut didn’t pass--token.
- You started the server with
- "invalid value"
- Allowed granularity:
minute,hour,day(orm,h,d). - Allowed category:
ips/iporhosts/host.
- Allowed granularity:
- Port already in use
- Change
SERVER_PORT/CLIENT_PORTor stop the conflicting process.
- Change
The script traps EXIT and cleans up server/client processes automatically.
It also uses a temporary HOME directory to avoid modifying your real
~/.proxy-everything/nodes.json.