mirror of
https://github.com/kevinveenbirkenbach/docker-volume-backup.git
synced 2025-12-29 11:43:17 +00:00
test(e2e): add dump-only-sql mixed-run + CLI contract coverage
- rename dump-only flag to --dump-only-sql across docs and tests - update backup logic: skip files/ only for DB volumes when dumps succeed; fallback to files when dumps fail - extend e2e helpers to support dump_only_sql - add e2e mixed-run regression test (DB dump => no files/, non-DB => files/) - add e2e CLI/argparse contract test (--dump-only-sql present, --dump-only rejected) - fix e2e files test to expect file backups for non-DB volumes in dump-only-sql mode and verify restore - update changelog + README flag table https://chatgpt.com/share/69522d9c-ce08-800f-9070-71df3bd779ae
This commit is contained in:
38
tests/e2e/test_e2e_cli_contract_dump_only_sql.py
Normal file
38
tests/e2e/test_e2e_cli_contract_dump_only_sql.py
Normal file
@@ -0,0 +1,38 @@
|
||||
import unittest
|
||||
|
||||
from .helpers import run
|
||||
|
||||
|
||||
class TestE2ECLIContractDumpOnlySql(unittest.TestCase):
|
||||
def test_help_mentions_new_flag(self) -> None:
|
||||
cp = run(["baudolo", "--help"], capture=True, check=True)
|
||||
out = (cp.stdout or "") + "\n" + (cp.stderr or "")
|
||||
self.assertIn(
|
||||
"--dump-only-sql",
|
||||
out,
|
||||
f"Expected '--dump-only-sql' to appear in --help output. Output:\n{out}",
|
||||
)
|
||||
|
||||
def test_help_does_not_mention_old_flag(self) -> None:
|
||||
cp = run(["baudolo", "--help"], capture=True, check=True)
|
||||
out = (cp.stdout or "") + "\n" + (cp.stderr or "")
|
||||
self.assertNotIn(
|
||||
"--dump-only",
|
||||
out,
|
||||
f"Did not expect legacy '--dump-only' to appear in --help output. Output:\n{out}",
|
||||
)
|
||||
|
||||
def test_old_flag_is_rejected(self) -> None:
|
||||
cp = run(["baudolo", "--dump-only"], capture=True, check=False)
|
||||
self.assertEqual(
|
||||
cp.returncode,
|
||||
2,
|
||||
f"Expected exitcode 2 for unknown args, got {cp.returncode}\n"
|
||||
f"STDOUT={cp.stdout}\nSTDERR={cp.stderr}",
|
||||
)
|
||||
err = (cp.stderr or "") + "\n" + (cp.stdout or "")
|
||||
# Argparse typically prints "unrecognized arguments"
|
||||
self.assertTrue(
|
||||
("unrecognized arguments" in err) or ("usage:" in err.lower()),
|
||||
f"Expected argparse-style error output. Output:\n{err}",
|
||||
)
|
||||
Reference in New Issue
Block a user