Skip to content

Commit

Permalink
Normalize container names for backups
Browse files Browse the repository at this point in the history
  • Loading branch information
RealOrangeOne committed Aug 1, 2023
1 parent 34c3e41 commit 2afb0a3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ def import_file(path: Path) -> Any:
return mod


def normalize_container_name(container_name: str) -> str:
return container_name.replace("_", "-")


# HACK: The filename isn't compatible with `import foo` syntax
db_auto_backup = import_file(Path.cwd() / "db-auto-backup.py")

Expand All @@ -28,7 +32,7 @@ def test_backup_runs(run_backup: Callable) -> None:
exit_code, _ = run_backup({})
assert exit_code == 0
assert BACKUP_DIR.is_dir()
assert sorted(f.name for f in BACKUP_DIR.glob("*")) == [
assert sorted(normalize_container_name(f.name) for f in BACKUP_DIR.glob("*")) == [
"docker-db-auto-backup-mariadb-1.sql",
"docker-db-auto-backup-mysql-1.sql",
"docker-db-auto-backup-psql-1.sql",
Expand Down

0 comments on commit 2afb0a3

Please sign in to comment.