| title | Testing Guide |
|---|---|
| category | developer |
| order | 1 |
| description | Guide for running tests, test database isolation, and platform verification |
| published | true |
Created: 2025-12-09
Last Updated: 2026-03-10
Status: Active
Category: Guide
Related Docs:
developers/testing-auth-guide.md-- authenticated testing withbusibox_common.testingadministrators/02-install.mdarchitecture/08-tests.md
All tests run against dedicated test databases, separate from production:
| Service | Test Database | Owner |
|---|---|---|
| Agent | test_agent |
busibox_test_user |
| AuthZ | test_authz |
busibox_test_user |
| Data / Search | test_files |
busibox_test_user |
| Config | test_config |
busibox_test_user |
This ensures tests never pollute production data. The make test commands
automatically connect to the appropriate test databases.
All integration tests use real JWT tokens obtained from the authz service.
The shared busibox_common.testing package provides the AuthTestClient
which handles user creation, token exchange, and cleanup.
See Authenticated Testing Guide for:
- How to set up
conftest.pyfor a new service AuthTestClientAPI reference- When to use real auth vs mocks
- Test database routing (
X-Test-Modeheader) - Troubleshooting
- Smoke/health:
cd provision/ansible make verify # health checks across services make verify-health # service health subset make verify-smoke # DB and container basics
- Unit/integration (inside repo or container):
cd srv/data pip install -r requirements.txt pytest tests/api # API routes incl. upload/status/search pytest tests/integration -m "not slow" # pipeline coverage pytest tests/test_pdf_splitting.py -v # PDF splitting tests (uses real PDFs from busibox-testdocs)
- End-to-end upload + SSE + indexing:
- Use
tests/integration/test_full_pipeline.py(requires MinIO, Redis, Milvus running).
- Use
- PDF Splitting Tests: Tests validate that large PDFs (>5 pages) are automatically split into 5-page chunks before processing. Uses real PDF files from the
busibox-testdocsrepository.
- Run search tests:
cd srv/search pip install -r requirements.txt pytest tests/integration/test_search_api.py - Ensure Milvus is seeded with ingest-produced partitions before running.
-
Quick start:
cd srv/agent source venv/bin/activate make test # All tests make test-unit # Fast unit tests only make test-integration # Integration tests with DB make test-cov # With coverage report
-
Deployed testing (via MCP):
cd provision/ansible make test-agent INV=inventory/staging make test-agent-coverage INV=inventory/staging -
Test structure:
- Unit tests: Auth, tokens, agents, workflows, scoring (117 tests)
- Integration tests: API endpoints, SSE streaming, RBAC (40+ tests)
- See
guides/agent-server-testing.mdfor complete details
- Integration tests:
cd srv/authz source venv/bin/activate pytest tests/ -v
- Test coverage:
- OAuth2 token exchange
- RBAC management
- Admin endpoints
- Client credentials flow
Test databases and the bootstrap test user are initialised automatically:
# Docker development -- run once after first `docker compose up`
make test-db-init
# Or from within the manager container
python scripts/docker/bootstrap-test-databases.pyThis creates:
- Signing keys in
test_authz - Test email domains (
test.example.com,busibox.local) - Test user
00000000-0000-0000-0000-000000000001 - Schemas for
test_filesandtest_agent
For Proxmox/staging/production, the Ansible postgres role handles test
database creation when enable_pytest_databases: true.
The AuthTestClient in busibox_common.testing automatically bootstraps
the Admin role for the test user on first use, so no manual credential
setup is needed.
- App-specific tests live in their repos (Busibox Portal, Busibox Agents). Run
npm test/npm run test:watchper repo after wiring env vars to container endpoints.
- Ingest
/healthand Search/healthreturn 200. - Upload via ingest returns
queuedorcompletedfor images/videos; status stream reachescompleted. - Search returns results limited to the user's partitions (use different JWTs to confirm access control).
- AuthZ token issuance works and audit rows are written.
- Agent server responds to
/healthand can execute runs.
- Authenticated Testing Guide —
AuthTestClientAPI, conftest patterns, DB routing - Python Test Import Gotchas — Common import and path issues in pytest
- Test Environment Containers — Staging container IPs, DB names, bootstrap
- Auth testing library:
srv/shared/busibox_common/testing/(install:pip install busibox-common[testing]) - Test strategy:
guides/testing/TEST_STRATEGY.md - Service testing:
guides/testing/master-guide.md