improve backup test
Only check enabled services. This allows running the backup test with a custom subset of other tests. Also, show a meaningful error on test failure. Previously, just an AssertionError without a message was shown. Because the test code is evaluated from a string and not a file, there was also no backtrace to the tests file.
This commit is contained in:
parent
9a67a32779
commit
fc40776689
@ -296,12 +296,18 @@ def _():
|
||||
"0 differences found",
|
||||
)
|
||||
# Backup should include important files
|
||||
files = succeed(f"{run_duplicity} list-current-files file:///var/lib/localBackups")
|
||||
assert "var/lib/clightning/bitcoin/hsm_secret" in files
|
||||
assert "secrets/lnd-seed-mnemonic" in files
|
||||
assert "secrets/jm-wallet-seed" in files
|
||||
assert "var/lib/bitcoind/wallet.dat" in files
|
||||
assert "var/backup/postgresql/btcpaydb.sql.gz" in files
|
||||
files = {
|
||||
"bitcoind": "var/lib/bitcoind/wallet.dat",
|
||||
"clightning": "var/lib/clightning/bitcoin/hsm_secret",
|
||||
"lnd": "secrets/lnd-seed-mnemonic",
|
||||
"joinmarket": "secrets/jm-wallet-seed",
|
||||
"btcpayserver": "var/backup/postgresql/btcpaydb.sql.gz",
|
||||
}
|
||||
actual_files = succeed(f"{run_duplicity} list-current-files file:///var/lib/localBackups")
|
||||
|
||||
for test, file in files.items():
|
||||
if test in enabled_tests and file not in actual_files:
|
||||
raise Exception(f"Backup file '{file}' is missing.")
|
||||
|
||||
|
||||
# Impure: restarts services
|
||||
|
Loading…
Reference in New Issue
Block a user