mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2026-11-09 02:13:38 +00:00
- Scheduled, encrypted backups to S3, SFTP, REST or a local folder (new restic-mailcow container) - Restore of mailboxes and whole domains in the UI, also deleted ones, for admins and domain admins - Scope set by RESTIC_BACKUP_MODE in mailcow.conf (all, data, config) - Optional backup before updates (update.sh), helper-scripts/restic.sh for a full restore
24 lines
1.0 KiB
Bash
Executable File
24 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Runs the Python unit tests of the backup runners (tests/python/backup) in a throwaway container of the locally built
|
|
# restic image: the backup runner (data/Dockerfiles/restic) and the dovecot restore runner (data/Dockerfiles/dovecot).
|
|
# No network, no database: the tests replace the database and the clock.
|
|
# Usage: helper-scripts/dev_tests/run_python_unit_tests.sh [unittest arguments, e.g. test_restic_runner]
|
|
|
|
set -euo pipefail
|
|
|
|
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
IMAGE="mailcow-restic-tests"
|
|
|
|
if [ $# -eq 0 ]; then
|
|
set -- discover -v
|
|
fi
|
|
|
|
docker build --quiet -t "${IMAGE}" "${REPO_DIR}/data/Dockerfiles/restic" > /dev/null
|
|
|
|
docker run --rm --network none --security-opt label=disable \
|
|
-v "${REPO_DIR}/data/Dockerfiles/restic:/app/restic:ro" \
|
|
-v "${REPO_DIR}/data/Dockerfiles/dovecot:/app/dovecot:ro" \
|
|
-v "${REPO_DIR}/tests/python/backup:/tests:ro" \
|
|
-w /tests -e PYTHONPATH=/app/restic:/app/dovecot:/tests -e PYTHONDONTWRITEBYTECODE=1 \
|
|
--entrypoint python3 "${IMAGE}" -m unittest "$@"
|