Skip to content

Commit 81b5376

Browse files
committed
fix ci
1 parent 86505e1 commit 81b5376

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

system_tests/cluster.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def dsn(self, *, dbname: str | None = None) -> str:
287287
def truncate_log(self) -> None:
288288
if self.logfile.exists():
289289
self.logfile.write_text("", encoding="utf-8")
290-
log_dir = self.data_dir / "log"
290+
log_dir = self.data_dir / "pg_log"
291291
if log_dir.exists():
292292
for path in log_dir.glob("postgresql-*.log"):
293293
path.unlink()
@@ -296,7 +296,7 @@ def read_log(self) -> str:
296296
chunks: list[str] = []
297297
if self.logfile.exists():
298298
chunks.append(self.logfile.read_text(encoding="utf-8"))
299-
log_dir = self.data_dir / "log"
299+
log_dir = self.data_dir / "pg_log"
300300
if log_dir.exists():
301301
for path in sorted(log_dir.glob("postgresql-*.log")):
302302
chunks.append(path.read_text(encoding="utf-8"))

system_tests/test_pgreplay_integration.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
@pytest.mark.pgreplay
14-
def test_pgreplay_infrastructure_available(pg_cluster):
14+
def test_pgreplay_infrastructure_available(pg_cluster): # noqa: ARG001
1515
"""Test that pgreplay binary is available and can be invoked."""
1616
pgreplay_bin = shutil.which("pgreplay")
1717
assert pgreplay_bin is not None, "pgreplay binary not found in PATH - pgreplay tests require pgreplay to be installed"
@@ -43,8 +43,8 @@ def _run_pgreplay_replay(pg_cluster, require_csv: bool = False) -> None:
4343
try:
4444
# Drop any statements captured from prior tests to keep the replay log small.
4545
pg_cluster.truncate_log()
46-
source_dsn = pg_cluster.dsn().replace("pg_retry_system_tests", source_db)
47-
target_dsn = pg_cluster.dsn().replace("pg_retry_system_tests", target_db)
46+
source_dsn = pg_cluster.dsn(dbname=source_db)
47+
target_dsn = pg_cluster.dsn(dbname=target_db)
4848

4949
# Set up source database with retry operations
5050
with psycopg.connect(source_dsn) as conn:
@@ -142,13 +142,21 @@ def _run_pgreplay_replay(pg_cluster, require_csv: bool = False) -> None:
142142
cmd.append(str(log_file))
143143

144144
timeout_seconds = int(os.getenv("PG_REPLAY_TIMEOUT", "120"))
145-
completed = subprocess.run(
146-
cmd,
147-
env=env,
148-
text=True,
149-
capture_output=True,
150-
timeout=timeout_seconds
151-
)
145+
try:
146+
completed = subprocess.run(
147+
cmd,
148+
env=env,
149+
text=True,
150+
capture_output=True,
151+
timeout=timeout_seconds,
152+
)
153+
except subprocess.TimeoutExpired as exc:
154+
stdout = exc.output or ""
155+
stderr = exc.stderr or ""
156+
pytest.fail(
157+
"pgreplay did not finish within "
158+
f"{timeout_seconds}s.\nCommand: {cmd}\nSTDOUT:\n{stdout}\nSTDERR:\n{stderr}"
159+
)
152160

153161
# pgreplay should successfully replay the logs
154162
# Note: pgreplay may return non-zero even on success for some log formats
@@ -190,7 +198,7 @@ def test_pgreplay_basic_functionality(pg_cluster):
190198
conn.execute(f"CREATE DATABASE {test_db}")
191199

192200
try:
193-
test_dsn = pg_cluster.dsn().replace("pg_retry_system_tests", test_db)
201+
test_dsn = pg_cluster.dsn(dbname=test_db)
194202

195203
# Set up database with basic retry functionality
196204
with psycopg.connect(test_dsn) as conn:

0 commit comments

Comments
 (0)