From 9bf77ee3e80bd7d23f29640f268aabb75a267667 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Sun, 27 Sep 2020 12:43:18 +0200 Subject: [PATCH] backups test: simplify and speed up --- test/tests.py | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/test/tests.py b/test/tests.py index 284dfd8..c0f6d8c 100644 --- a/test/tests.py +++ b/test/tests.py @@ -166,32 +166,19 @@ def run_tests(): succeed("systemctl stop bitcoind") succeed("systemctl start duplicity") 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( - "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", ) - # Make sure duplicity backup includes important files - assert_matches( - "export $(cat /secrets/backup-encryption-env); duplicity list-current-files 'file:///var/lib/localBackups'", - "var/lib/clightning/bitcoin/hsm_secret", - ) - assert_matches( - "export $(cat /secrets/backup-encryption-env); duplicity list-current-files 'file:///var/lib/localBackups'", - "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", - ) + # 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 def test_security():