This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
после restore проверяем, что их нет.
|
||||
|
||||
Все psql-вызовы идут через docker run postgres:18-alpine в compose-сети проекта
|
||||
(--network <project>_default), DSN указывает на хост postgres.
|
||||
(--network mtuci2026lab2_default), DSN указывает на хост postgres.
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
@@ -37,9 +37,8 @@ EVIDENCE.mkdir(exist_ok=True)
|
||||
|
||||
SEED_SQL = ROOT / "student-tests" / "track2_seed.sql"
|
||||
|
||||
# Имя compose-сети проекта: <папка-проекта>_default.
|
||||
# Проверить: docker network ls | findstr default
|
||||
COMPOSE_NETWORK = os.environ.get("COMPOSE_NETWORK", "mtusi2026lab2_default")
|
||||
# Имя compose-сети проекта: mtuci2026lab2_default (зафиксировано в compose.yaml networks.default.name).
|
||||
COMPOSE_NETWORK = os.environ.get("COMPOSE_NETWORK", "mtuci2026lab2_default")
|
||||
|
||||
|
||||
# ---------- helpers ----------
|
||||
@@ -244,7 +243,7 @@ def step_backup_restore(dsn: str):
|
||||
|
||||
# новый контейнер как отдельное хранилище — в той же compose-сети,
|
||||
# порт наружу не публикуем
|
||||
restore_container = "mtusi-pg-restore"
|
||||
restore_container = "mtuci-pg-restore"
|
||||
subprocess.run(["docker", "rm", "-f", restore_container], capture_output=True)
|
||||
subprocess.run(
|
||||
["docker", "run", "-d", "--name", restore_container,
|
||||
@@ -273,7 +272,7 @@ def step_backup_restore(dsn: str):
|
||||
"--network", COMPOSE_NETWORK,
|
||||
"-v", f"{EVIDENCE}:/in",
|
||||
"postgres:18-alpine",
|
||||
"pg_restore", "-d", "postgresql://postgres:restore@mtusi-pg-restore:5432/high_load_messenger",
|
||||
"pg_restore", "-d", "postgresql://postgres:restore@mtuci-pg-restore:5432/high_load_messenger",
|
||||
"--no-owner", "--no-privileges", "/in/lab2_track2_dump.dump"],
|
||||
capture_output=True, text=True, timeout=600,
|
||||
)
|
||||
@@ -373,7 +372,7 @@ def step_rpo(dsn: str, base_url: str, ca_file):
|
||||
check(code == 0, "pg_dump для RPO упал")
|
||||
|
||||
# Временный restore-контейнер: в compose-сети, без публикации портов.
|
||||
restore_container = "mtusi-pg-rpo"
|
||||
restore_container = "mtuci-pg-rpo"
|
||||
subprocess.run(["docker", "rm", "-f", restore_container], capture_output=True)
|
||||
subprocess.run(
|
||||
["docker", "run", "-d", "--name", restore_container,
|
||||
@@ -401,7 +400,7 @@ def step_rpo(dsn: str, base_url: str, ca_file):
|
||||
"-v", f"{EVIDENCE}:/in",
|
||||
"postgres:18-alpine",
|
||||
"pg_restore", "-d",
|
||||
"postgresql://postgres:restore@mtusi-pg-rpo:5432/high_load_messenger",
|
||||
"postgresql://postgres:restore@mtuci-pg-rpo:5432/high_load_messenger",
|
||||
"--no-owner", "--no-privileges", "/in/lab2_track2_rpo.dump"],
|
||||
capture_output=True, text=True, timeout=600,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user