Manual E2E Test Case
Manual E2E Test Case
Section titled “Manual E2E Test Case”This guide verifies the full stack: APISIX -> Sidecar -> Upstream, including block vs. allow behavior and DLP audit mode.
Preconditions
Section titled “Preconditions”- Docker is installed and running.
- You are in
safellm-oss.
1) Start the stack
Section titled “1) Start the stack”cd safellm-ossdocker compose up -d --buildVerify APISIX is up:
curl -i http://localhost:9080/direct/getExpected: 200 OK.
2) Allow vs. block (input scan)
Section titled “2) Allow vs. block (input scan)”Allowed request:
curl -i http://localhost:9080/api/post \ -H 'Content-Type: application/json' \ -d '{"prompt":"hello world"}'Expected: 200 OK.
Blocked request (keywords):
curl -i http://localhost:9080/api/post \ -H 'Content-Type: application/json' \ -d '{"prompt":"please jailbreak"}'Expected: 403 Forbidden.
3) DLP block mode (output scan - Enterprise Paid)
Section titled “3) DLP block mode (output scan - Enterprise Paid)”Enable DLP block mode in your environment (example):
ENABLE_DLP=trueDLP_STREAMING_MODE=blockDLP_MODE=blockThen hit the LLM route that returns a response containing PII (use a mocked upstream if needed).
Expected:
- Response is blocked or anonymized based on
DLP_MODE. - DLP scan is synchronous (higher TTFT). Note: Block/anonymize requires Enterprise (Paid).
4) DLP audit mode (async scan)
Section titled “4) DLP audit mode (async scan)”Switch to audit mode (available in OSS):
ENABLE_DLP=trueDLP_STREAMING_MODE=auditDLP_MODE=logSend a request that will produce a response containing PII. Then check audit stats:
docker compose exec sidecar curl -s http://localhost:8000/v1/audit/stats | jqExpected:
total_ingestedincrements after requests.pii_detectedincrements when PII is present.
5) Observability checks
Section titled “5) Observability checks”Metrics:
docker compose exec sidecar curl -s http://localhost:8000/metrics | head -n 20Expected:
- Prometheus metrics are exposed.
6) Failure behavior (sidecar down)
Section titled “6) Failure behavior (sidecar down)”docker compose stop sidecarcurl -i http://localhost:9080/api/post \ -H 'Content-Type: application/json' \ -d '{"prompt":"hello world"}'Expected:
- POST requests should fail-closed (503).
Restart:
docker compose start sidecar- In audit mode, stats are in-memory per worker unless a shared store is used.
- If sidecar port is not exposed on the host, run checks from inside the container:
docker compose exec sidecar python -c "import urllib.request; print(urllib.request.urlopen('http://localhost:8000/health').read().decode())"