backups: add feature test

This commit is contained in:
nixbitcoin 2020-06-23 11:03:16 +00:00
parent e4fb7a52de
commit 22c3fd52e1
No known key found for this signature in database
GPG Key ID: DD11F9AD5308B3BA
4 changed files with 31 additions and 5 deletions

View File

@ -25,7 +25,7 @@ def web_index():
assert_matches("curl -L localhost/store", "tshirt")
def final():
def prestop():
pass
@ -35,7 +35,7 @@ extra_tests = {
"lightning-charge": lightning_charge,
"nanopos": nanopos,
"web-index": web_index,
"final": final,
"prestop": prestop,
}
run_tests(extra_tests)

View File

@ -127,7 +127,31 @@ def run_tests(extra_tests):
)
assert_no_failure("bitcoind-import-banlist")
extra_tests.pop("final")()
extra_tests.pop("prestop")()
### Test duplicity
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
assert_matches(
"export $(cat /secrets/backup-encryption-env); 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'",
"var/lib/bitcoind/wallet.dat",
)
### Check that all extra_tests have been run
assert len(extra_tests) == 0

View File

@ -47,7 +47,7 @@ def web_index():
assert_matches("ip netns exec nb-nginx curl -L localhost/store", "tshirt")
def final():
def prestop():
ping_bitcoind = "ip netns exec nb-bitcoind ping -c 1 -w 1"
ping_nanopos = "ip netns exec nb-nanopos ping -c 1 -w 1"
@ -98,7 +98,7 @@ extra_tests = {
"lightning-charge": lightning_charge,
"nanopos": nanopos,
"web-index": web_index,
"final": final,
"prestop": prestop,
}
run_tests(extra_tests)

View File

@ -54,6 +54,8 @@ import ./make-test.nix rec {
ledger = true;
};
services.backups.enable = true;
# to test that unused secrets are made inaccessible by 'setup-secrets'
systemd.services.generate-secrets.postStart = ''
install -o nobody -g nogroup -m777 <(:) /secrets/dummy