feat: add backup.retain_days config and local docker-compose for integration tests

- Add [backup] retain_days to config (default 1); --days becomes optional
- Add scripts/docker-compose.yml (azurite) for local integration testing
- Integration tests now use assets/local.toml and localhost endpoints
- Update .gitignore and CLAUDE.md accordingly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-22 13:27:24 +08:00
parent 673ad95bcb
commit bc119ff2ae
10 changed files with 38 additions and 7 deletions

View File

@@ -29,7 +29,10 @@ uv run pytest tests/ -v -m "not integration"
# Run a single test file
uv run pytest tests/test_backup.py -v
# Run integration tests (requires Azure Storage emulator at 192.168.9.101)
# Start Azure Storage emulator (required for integration tests)
docker compose -f scripts/docker-compose.yml up -d
# Run integration tests (requires emulator running via docker compose above)
uv run pytest tests/test_integration.py -v
# Seed test data into the emulator
@@ -72,4 +75,4 @@ Override config path with `order-bak --config /path/to/config.toml <command>`.
### Integration Tests
The integration test (`tests/test_integration.py`) hits a real Azure Storage emulator at `192.168.9.101:10002`. Override the endpoint via `ORDER_BAK_TEST_CONNECTION_STRING` env var. Tests are gated by the `integration` pytest marker.
Integration tests (`tests/test_integration.py`) require the Azure Storage emulator running locally via `scripts/docker-compose.yml` (azurite on `localhost:10002`). Start it with `docker compose -f scripts/docker-compose.yml up -d` before running. Tests are gated by the `integration` pytest marker. Override the endpoint via `ORDER_BAK_TEST_CONNECTION_STRING` env var if needed.