Testing
Tests are located in the tests/ directory and run against a live backend instance.
Test Files
| File | Description |
|---|---|
test_e2e_api.py | End-to-end HTTP API tests for all backend endpoints |
test_issues_sanity.py | Issues page sanity and performance tests |
End-to-End API Tests (test_e2e_api.py)
Tests all backend API endpoints over HTTP. Generates a JWT token locally and calls each endpoint with auth headers.
What It Covers
- Authentication -- Generates a test JWT for
kiran.kamreddy@celerdata.comwithsuperadminrole - Issues KPIs --
GET /api/issues/kpis?days=0 - Issues List --
GET /api/issues?days=0&severities=Critical,Warning,Infowith pagination - Issue Detail --
GET /api/issues/<id>for the first issue, verifies alerts and performance (< 5s) - Additional endpoint coverage for all API routes
Running
# On bastion
cd ~/byocusage-app
source ~/app.env
PYTHONPATH=. ~/.venv/bin/python3 tests/test_e2e_api.py
Issues Sanity Tests (test_issues_sanity.py)
Tests database connectivity and data integrity for the issues pipeline.
What It Covers
- StarRocks connectivity -- Verifies the DB connection works
- Data presence -- Checks
alerts.issuestable has rows - Performance -- Ensures queries complete within acceptable time
Running
# On bastion
cd ~/byocusage-app
~/.venv/bin/python3 tests/test_issues_sanity.py
Notes
- Tests require a running backend (default:
http://localhost:8501) - Tests require a working StarRocks connection (SSH tunnel must be active)
- The JWT secret defaults to
byoc-ops-secret-key(fromJWT_SECRETenv var) - Output uses colored PASS/FAIL markers in the terminal