| name | wiremock-test |
| description | Manage WireMock proxy for RPC testing. Starts the proxy, arms scenarios to simulate transient errors (timeouts, 500s, connection resets, and network-specific errors like Stellar TRY_AGAIN_LATER), and checks metrics. Use to verify relayer behavior under failure conditions. |
| allowed-tools | Bash, Read, Grep, Glob, Agent |
| argument-hint | <scenario> | setup <network> [rpc-url] | teardown | status | check-metrics |
WireMock RPC Test Proxy
You manage a WireMock proxy that sits between the relayer and an RPC endpoint. It forwards traffic normally, but can inject mock error responses on demand.
Project paths
- Docker compose:
testing/wiremock/docker-compose.yaml
- Generic mappings:
testing/wiremock/mappings/generic/ (work with any JSON-RPC network)
- Stellar mappings:
testing/wiremock/mappings/stellar/
- Future EVM mappings:
testing/wiremock/mappings/evm/ (not yet created)
- Helper scripts:
testing/wiremock/scripts/
Available scenarios
Generic (any network)
| Scenario name | Shorthand | What it does |
|---|
rpc-timeout | timeout | 30s delay on next RPC call (any method) |
rpc-500 | 500 | HTTP 500 on next RPC call |
rpc-connection-reset | reset | TCP connection reset on next RPC call |
Stellar-specific
| Scenario name | Shorthand | What it does |
|---|
stellar-try-again-later | tal, try-again-later | Returns TRY_AGAIN_LATER on next sendTransaction |
stellar-insufficient-fee | fee, insufficient-fee | Returns ERROR with TxInsufficientFee on next sendTransaction |
stellar-get-transaction-not-found | not-found, get-tx-not-found | Returns NOT_FOUND for next getTransaction |
All scenarios fire exactly once then revert to proxying real traffic.
How to handle user arguments ($ARGUMENTS)
Based on the argument, execute the matching flow:
setup — requires a network argument
Syntax: setup <network> [rpc-url]
A bare setup with no network is not allowed — ask the user which network they want (stellar or evm).
- Determine target RPC:
setup stellar → default: https://soroban-testnet.stellar.org
setup evm or setup anvil → default: http://host.docker.internal:8545
setup stellar <url> or setup evm <url> → use the provided URL as WIREMOCK_PROXY_TARGET
- Start WireMock:
WIREMOCK_PROXY_TARGET=<target> docker compose -f testing/wiremock/docker-compose.yaml up -d
For stellar with default target, just: docker compose -f testing/wiremock/docker-compose.yaml up -d
- Wait for health: poll
curl -sf http://localhost:9090/__admin/health (retry up to 10 times with 2s sleep)
- Verify scenarios loaded:
curl -s http://localhost:9090/__admin/scenarios
- Remind the user:
- WireMock proxy is running on
http://localhost:9090 proxying to <target>
- To use it, update the relevant network config
rpc_urls to ["http://localhost:9090"]
- If the relayer runs in Docker, use
http://host.docker.internal:9090 instead
- Show only the relevant scenarios: generic + the chosen network's specific scenarios
- For Stellar: mention updating
config/networks/stellar.json testnet entry
- For EVM: mention updating the relevant EVM network config
teardown or stop
- Run:
docker compose -f testing/wiremock/docker-compose.yaml down
- Confirm stopped
status
- Check if WireMock is running:
docker compose -f testing/wiremock/docker-compose.yaml ps
- If running, show scenario states:
curl -s http://localhost:9090/__admin/scenarios
- Show recent requests:
curl -s 'http://localhost:9090/__admin/requests?limit=10'
- Parse and display in a readable format
check-metrics or metrics
- Fetch relayer metrics:
curl -s http://localhost:8081/debug/metrics/scrape
- Filter and display lines matching:
insufficient_fee|try_again_later|transactions_success|transactions_failed|stellar_submission_failures|stellar_try_again_later|rpc_call_latency|api_rpc_failures
- Summarize what the metrics show
A scenario name or shorthand
- First ensure WireMock is running (check health endpoint, start if needed)
- Resolve the scenario name — the user may use shorthand:
- Generic:
timeout → rpc-timeout, 500 → rpc-500, reset → rpc-connection-reset
- Stellar:
try-again-later or tal → stellar-try-again-later, insufficient-fee or fee → stellar-insufficient-fee, not-found or get-tx-not-found → stellar-get-transaction-not-found
- Arm the scenario:
curl -s -X PUT "http://localhost:9090/__admin/scenarios/{scenario-name}/state" \
-H 'Content-Type: application/json' -d '{"state": "armed"}'
- Verify it's armed by checking the scenario state
- Tell the user what will happen on the next matching RPC call
chaos or all-chaos
- Ensure WireMock is running
- Arm ALL scenarios simultaneously
- Explain what will happen: scenarios are priority-based, so the most specific one fires first
reset
- Reset all scenarios:
curl -s -X POST http://localhost:9090/__admin/scenarios/reset
- Clear request log:
curl -s -X DELETE http://localhost:9090/__admin/requests
- Confirm all scenarios are back to initial (inactive) state
Important reminders
Always remind the user about these when relevant:
- The relayer's network
rpc_urls must point to http://localhost:9090 (or http://host.docker.internal:9090 from Docker) for WireMock to intercept traffic
- After testing, they should revert
rpc_urls back to the real RPC endpoint
- Scenarios are one-shot: they fire once and revert. Re-arm to test again.
- The relayer's metrics endpoint is at
http://localhost:8081/debug/metrics/scrape (configurable via METRICS_PORT)
- Generic scenarios (timeout, 500, connection-reset) work with any network — no need to change them when switching between Stellar and EVM testing
Adding new network support
When adding EVM or other network-specific scenarios:
- Create
testing/wiremock/mappings/<network>/ directory
- Add scenario JSON files following the existing pattern (use
"requiredScenarioState": "armed")
- Mount the directory in
docker-compose.yaml (uncomment or add the volume line)
- Update this skill's scenario tables above
- Restart WireMock to load new mappings