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_mgt.py 762B

123456789101112131415161718
  1. import os
  2. import pytest
  3. from testinfra.utils.ansible_runner import AnsibleRunner
  4. testinfra_hosts = ["ansible://borgbackup_management"]
  5. # to do read inventory variable : export BORG_PASSPHRASE="{{ borgbackup_passphrase }}"
  6. @pytest.mark.parametrize('client', AnsibleRunner(os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all:!borgbackup_management:!borgbackup_servers'))
  7. def test_prune_script(host, client):
  8. prune = host.file("/root/prune.sh")
  9. assert prune.user == "root"
  10. assert prune.group == "root"
  11. assert prune.mode == 0o700
  12. assert prune.contains("/usr/local/bin/borg prune")
  13. assert prune.contains("export BORG_PASSPHRASE=")
  14. assert prune.contains("Host: %s" % client)
  15. assert prune.contains(":/var/backup/repos/%s" % client)