Borg backup role
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_client_restore.py 938B

123456789101112131415161718192021222324
  1. import os
  2. import pytest
  3. from testinfra.utils.ansible_runner import AnsibleRunner
  4. testinfra_hosts = ["ansible://all:!borgbackup_servers"]
  5. def test_client_sample_file(host):
  6. sample = host.file("/root/sample.txt")
  7. assert sample.is_file
  8. @pytest.mark.parametrize('server', AnsibleRunner(os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('borgbackup_servers'))
  9. def test_client_dir(host, server):
  10. command = host.run("diff -s /root/sample.txt /root/restore/%s/root/sample.txt" % server)
  11. assert command.rc == 0
  12. assert "Files /root/sample.txt and /root/restore/%s/root/sample.txt are identical" % server in command.stdout
  13. @pytest.mark.parametrize('server', AnsibleRunner(os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('borgbackup_servers'))
  14. def test_client_verify(host, server):
  15. vcommand = host.run("/root/restore.sh verify")
  16. assert vcommand.rc == 0
  17. assert vcommand.stdout.rstrip("verifying on %s" % server)