backups test: simplify and speed up

This commit is contained in:
Erik Arvstedt 2020-09-27 12:43:18 +02:00
parent fcda69e8b6
commit 9bf77ee3e8
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -166,32 +166,19 @@ def run_tests():
succeed("systemctl stop bitcoind") succeed("systemctl stop bitcoind")
succeed("systemctl start duplicity") succeed("systemctl start duplicity")
machine.wait_until_succeeds(log_has_string("duplicity", "duplicity.service: Succeeded.")) machine.wait_until_succeeds(log_has_string("duplicity", "duplicity.service: Succeeded."))
# Make sure files in duplicity backup and /var/lib are identical run_duplicity = "export $(cat /secrets/backup-encryption-env); duplicity"
# Files in backup and /var/lib should be identical
assert_matches( assert_matches(
"export $(cat /secrets/backup-encryption-env); duplicity verify '--archive-dir' '/var/lib/duplicity' 'file:///var/lib/localBackups' '/var/lib'", f"{run_duplicity} verify --archive-dir /var/lib/duplicity file:///var/lib/localBackups /var/lib",
"0 differences found", "0 differences found",
) )
# Make sure duplicity backup includes important files # Backup should include important files
assert_matches( files = succeed(f"{run_duplicity} list-current-files file:///var/lib/localBackups")
"export $(cat /secrets/backup-encryption-env); duplicity list-current-files 'file:///var/lib/localBackups'", assert "var/lib/clightning/bitcoin/hsm_secret" in files
"var/lib/clightning/bitcoin/hsm_secret", assert "secrets/lnd-seed-mnemonic" in files
) assert "secrets/jm-wallet-seed" in files
assert_matches( assert "var/lib/bitcoind/wallet.dat" in files
"export $(cat /secrets/backup-encryption-env); duplicity list-current-files 'file:///var/lib/localBackups'", assert "var/backup/postgresql/btcpaydb.sql.gz" in files
"secrets/lnd-seed-mnemonic",
)
assert_matches(
"export $(cat /secrets/backup-encryption-env); duplicity list-current-files 'file:///var/lib/localBackups'",
"secrets/jm-wallet-seed",
)
assert_matches(
"export $(cat /secrets/backup-encryption-env); duplicity list-current-files 'file:///var/lib/localBackups'",
"var/lib/bitcoind/wallet.dat",
)
assert_matches(
"export $(cat /secrets/backup-encryption-env); duplicity list-current-files 'file:///var/lib/localBackups'",
"var/backup/postgresql/btcpaydb.sql.gz",
)
def test_security(): def test_security():