- Introduced a new job in the CI workflow to run backend tests before the build process. - Configured Python environment and installed dependencies from the backend requirements. - Added a check for the TEST_DATABASE_URL secret to ensure it is defined before running tests. - The test job must pass for the build job to execute, enhancing the reliability of the CI pipeline.
905 B
905 B
Backend test strategy (Anexo24)
Test suites
tests/e2e/: full business flow (catalogs -> import -> export -> balances/discharges).tests/integration/: process API behavior and edge cases.tests/unit/: critical algorithms only (no trivial CRUD tests).
Prerequisites
- PostgreSQL test database available.
- Environment variable:
TEST_DATABASE_URL=postgresql://user:pass@host:5432/db_name
Run commands
- Fast subset (CI gate):
pytest -q tests/unit tests/integration
- Full suite:
pytest -q testspytest tests -v -rapytest tests -v -ra -s
- E2E only:
pytest -q tests/e2e
CI recommendations
- Pull request gate:
- Run unit + integration on every PR.
- Nightly / main branch:
- Run full suite including E2E.
- Keep Celery eager mode for deterministic process endpoint tests:
task_always_eager=Truetask_eager_propagates=True