From 2afb0a3f42ac37eece463963785234d48cb5ea4b Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 1 Aug 2023 11:17:13 +0100 Subject: [PATCH] Normalize container names for backups --- tests/tests.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/tests.py b/tests/tests.py index fa5dbbd..3915a2c 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -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") @@ -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",