test(e2e): SPOT db images, PG18 mount layout, drop removed flags

Add a single source of truth in tests/e2e/helpers.py for the database
images and their in-container data dirs (POSTGRES_IMAGE=postgres:alpine,
POSTGRES_DATA_DIR=/var/lib/postgresql, MARIADB_IMAGE=mariadb:latest,
MARIADB_DATA_DIR=/var/lib/mysql) and route every test through it.
postgres:alpine now tracks 18+, which refuses a mount at
/var/lib/postgresql/data and stores data under /var/lib/postgresql, so
the mounts and the marker path move there. Drop the --rsync-image and the
renamed hard-restart flag from the invocations.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-12 14:54:16 +02:00
parent e5da813a9f
commit 82913291b6
11 changed files with 44 additions and 24 deletions

View File

@@ -7,6 +7,14 @@ import time
import uuid import uuid
from pathlib import Path from pathlib import Path
# SPOT for the database images and their in-container data dirs the e2e
# suite runs against. postgres:alpine tracks latest (18+), which mounts at
# /var/lib/postgresql (not /var/lib/postgresql/data); bump here only.
POSTGRES_IMAGE = "postgres:alpine"
POSTGRES_DATA_DIR = "/var/lib/postgresql"
MARIADB_IMAGE = "mariadb:latest"
MARIADB_DATA_DIR = "/var/lib/mysql"
def run( def run(
cmd: list[str], cmd: list[str],
@@ -172,7 +180,7 @@ def backup_run(
"baudolo", "baudolo",
"--compose-dir", "--compose-dir",
compose_dir, compose_dir,
"--docker-compose-hard-restart-required", "--hard-compose-restart",
"mailu", "mailu",
"--repo-name", "--repo-name",
repo_name, repo_name,

View File

@@ -2,6 +2,8 @@
import unittest import unittest
from .helpers import ( from .helpers import (
POSTGRES_IMAGE,
POSTGRES_DATA_DIR,
backup_path, backup_path,
cleanup_docker, cleanup_docker,
create_minimal_compose_dir, create_minimal_compose_dir,
@@ -50,8 +52,8 @@ class TestE2EDumpOnlyFallbackToFiles(unittest.TestCase):
"-e", "-e",
"POSTGRES_USER=postgres", "POSTGRES_USER=postgres",
"-v", "-v",
f"{cls.pg_volume}:/var/lib/postgresql/data", f"{cls.pg_volume}:{POSTGRES_DATA_DIR}",
"postgres:16", POSTGRES_IMAGE,
] ]
) )
wait_for_postgres(cls.pg_container, user="postgres", timeout_s=90) wait_for_postgres(cls.pg_container, user="postgres", timeout_s=90)
@@ -65,7 +67,7 @@ class TestE2EDumpOnlyFallbackToFiles(unittest.TestCase):
cls.pg_container, cls.pg_container,
"sh", "sh",
"-lc", "-lc",
f"echo '{cls.marker}' > /var/lib/postgresql/data/marker.txt", f"echo '{cls.marker}' > {POSTGRES_DATA_DIR}/marker.txt",
] ]
) )
@@ -79,7 +81,7 @@ class TestE2EDumpOnlyFallbackToFiles(unittest.TestCase):
"baudolo", "baudolo",
"--compose-dir", "--compose-dir",
cls.compose_dir, cls.compose_dir,
"--docker-compose-hard-restart-required", "--hard-compose-restart",
"mailu", "mailu",
"--repo-name", "--repo-name",
cls.repo_name, cls.repo_name,
@@ -116,8 +118,6 @@ class TestE2EDumpOnlyFallbackToFiles(unittest.TestCase):
cls.repo_name, cls.repo_name,
"--source-volume", "--source-volume",
cls.pg_volume, cls.pg_volume,
"--rsync-image",
"ghcr.io/kevinveenbirkenbach/alpine-rsync",
] ]
) )

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from .helpers import ( from .helpers import (
POSTGRES_IMAGE,
POSTGRES_DATA_DIR,
backup_path, backup_path,
cleanup_docker, cleanup_docker,
create_minimal_compose_dir, create_minimal_compose_dir,
@@ -70,8 +72,8 @@ class TestE2EDumpOnlySqlMixedRun(unittest.TestCase):
"-e", "-e",
f"POSTGRES_PASSWORD={cls.pg_password}", f"POSTGRES_PASSWORD={cls.pg_password}",
"-v", "-v",
f"{cls.db_volume}:/var/lib/postgresql/data", f"{cls.db_volume}:{POSTGRES_DATA_DIR}",
"postgres:16-alpine", POSTGRES_IMAGE,
] ]
) )
wait_for_postgres(cls.pg_container, user="postgres", timeout_s=90) wait_for_postgres(cls.pg_container, user="postgres", timeout_s=90)

View File

@@ -94,8 +94,6 @@ class TestE2EFilesFull(unittest.TestCase):
self.repo_name, self.repo_name,
"--source-volume", "--source-volume",
self.volume_src, self.volume_src,
"--rsync-image",
"ghcr.io/kevinveenbirkenbach/alpine-rsync",
] ]
) )

View File

@@ -76,7 +76,7 @@ class TestE2EImagesNoBackupRequiredEarlySkip(unittest.TestCase):
"baudolo", "baudolo",
"--compose-dir", "--compose-dir",
cls.compose_dir, cls.compose_dir,
"--docker-compose-hard-restart-required", "--hard-compose-restart",
"mailu", "mailu",
"--repo-name", "--repo-name",
cls.repo_name, cls.repo_name,

View File

@@ -30,6 +30,8 @@ import pandas
from baudolo.backup import db as db_mod from baudolo.backup import db as db_mod
from .helpers import ( from .helpers import (
MARIADB_IMAGE,
MARIADB_DATA_DIR,
cleanup_docker, cleanup_docker,
require_docker, require_docker,
run, run,
@@ -69,8 +71,8 @@ class TestE2EMariaDBAnonymousPreemption(unittest.TestCase):
"-e", "-e",
f"MARIADB_ROOT_PASSWORD={cls.root_password}", f"MARIADB_ROOT_PASSWORD={cls.root_password}",
"-v", "-v",
f"{cls.db_volume}:/var/lib/mysql", f"{cls.db_volume}:{MARIADB_DATA_DIR}",
"mariadb:12.2", MARIADB_IMAGE,
] ]
) )

View File

@@ -2,6 +2,8 @@
import unittest import unittest
from .helpers import ( from .helpers import (
MARIADB_IMAGE,
MARIADB_DATA_DIR,
backup_run, backup_run,
backup_path, backup_path,
cleanup_docker, cleanup_docker,
@@ -56,8 +58,8 @@ class TestE2EMariaDBFull(unittest.TestCase):
"-e", "-e",
f"MARIADB_PASSWORD={cls.db_password}", f"MARIADB_PASSWORD={cls.db_password}",
"-v", "-v",
f"{cls.db_volume}:/var/lib/mysql", f"{cls.db_volume}:{MARIADB_DATA_DIR}",
"mariadb:11", MARIADB_IMAGE,
] ]
) )

View File

@@ -2,6 +2,8 @@
import unittest import unittest
from .helpers import ( from .helpers import (
MARIADB_IMAGE,
MARIADB_DATA_DIR,
backup_run, backup_run,
backup_path, backup_path,
cleanup_docker, cleanup_docker,
@@ -55,8 +57,8 @@ class TestE2EMariaDBNoCopy(unittest.TestCase):
"-e", "-e",
f"MARIADB_PASSWORD={cls.db_password}", f"MARIADB_PASSWORD={cls.db_password}",
"-v", "-v",
f"{cls.db_volume}:/var/lib/mysql", f"{cls.db_volume}:{MARIADB_DATA_DIR}",
"mariadb:11", MARIADB_IMAGE,
] ]
) )

View File

@@ -2,6 +2,8 @@
import unittest import unittest
from .helpers import ( from .helpers import (
POSTGRES_IMAGE,
POSTGRES_DATA_DIR,
backup_run, backup_run,
backup_path, backup_path,
cleanup_docker, cleanup_docker,
@@ -47,8 +49,8 @@ class TestE2EPostgresFull(unittest.TestCase):
"-e", "-e",
"POSTGRES_USER=postgres", "POSTGRES_USER=postgres",
"-v", "-v",
f"{cls.pg_volume}:/var/lib/postgresql/data", f"{cls.pg_volume}:{POSTGRES_DATA_DIR}",
"postgres:16", POSTGRES_IMAGE,
] ]
) )
wait_for_postgres(cls.pg_container, user="postgres", timeout_s=90) wait_for_postgres(cls.pg_container, user="postgres", timeout_s=90)

View File

@@ -2,6 +2,8 @@
import unittest import unittest
from .helpers import ( from .helpers import (
POSTGRES_IMAGE,
POSTGRES_DATA_DIR,
backup_run, backup_run,
backup_path, backup_path,
cleanup_docker, cleanup_docker,
@@ -46,8 +48,8 @@ class TestE2EPostgresNoCopy(unittest.TestCase):
"-e", "-e",
"POSTGRES_USER=postgres", "POSTGRES_USER=postgres",
"-v", "-v",
f"{cls.pg_volume}:/var/lib/postgresql/data", f"{cls.pg_volume}:{POSTGRES_DATA_DIR}",
"postgres:16", POSTGRES_IMAGE,
] ]
) )
wait_for_postgres(cls.pg_container, user="postgres", timeout_s=90) wait_for_postgres(cls.pg_container, user="postgres", timeout_s=90)

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from .helpers import ( from .helpers import (
POSTGRES_IMAGE,
POSTGRES_DATA_DIR,
backup_path, backup_path,
cleanup_docker, cleanup_docker,
create_minimal_compose_dir, create_minimal_compose_dir,
@@ -66,8 +68,8 @@ class TestE2ESeedStarAndDbEntriesBackupPostgres(unittest.TestCase):
"-e", "-e",
f"POSTGRES_PASSWORD={cls.pg_password}", f"POSTGRES_PASSWORD={cls.pg_password}",
"-v", "-v",
f"{cls.db_volume}:/var/lib/postgresql/data", f"{cls.db_volume}:{POSTGRES_DATA_DIR}",
"postgres:16-alpine", POSTGRES_IMAGE,
] ]
) )
wait_for_postgres(cls.pg_container, user="postgres", timeout_s=90) wait_for_postgres(cls.pg_container, user="postgres", timeout_s=90)