Files
@ 3722152897ec
Branch filter:
Location: majic-ansible-roles/roles/xmpp_server/molecule/default/tests/test_backup.py - annotation
3722152897ec
1.8 KiB
text/x-python
MAR-218: Disable Ansible lints for prefixed role variable names:
- At this point in time, it does not make much sense to introduce
prefixing and breaking every single role invocation.
- Might be worth revisting down the line, although it would require
understanding a bit more clearly if prefixing has any kind of
special logic handling or it's pure guidelines.
- At this point in time, it does not make much sense to introduce
prefixing and breaking every single role invocation.
- Might be worth revisting down the line, although it would require
understanding a bit more clearly if prefixing has any kind of
special logic handling or it's pure guidelines.
2ada86e90026 798fded7b618 2ada86e90026 da031f975c67 da031f975c67 da031f975c67 da031f975c67 d62b3adec462 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 da031f975c67 798fded7b618 798fded7b618 798fded7b618 3c51248b600c 28de9251c7aa 28de9251c7aa 28de9251c7aa 28de9251c7aa 3c51248b600c e970d4afbea4 da031f975c67 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 e970d4afbea4 da031f975c67 da031f975c67 798fded7b618 798fded7b618 798fded7b618 798fded7b618 798fded7b618 798fded7b618 798fded7b618 798fded7b618 798fded7b618 798fded7b618 798fded7b618 798fded7b618 798fded7b618 798fded7b618 798fded7b618 798fded7b618 798fded7b618 798fded7b618 | import os
import uuid
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('parameters-optional')
def test_backup(host):
"""
Tests if Prosody data directory is correctly backed-up.
"""
# Deliver a couple of messages in order to make sure the directory structure
# is created.
message = str(uuid.uuid1())
send = host.run("echo '%s' | go-sendxmpp --debug "
"--username jane.doe@domain2 --password janepassword --jserver domain3:5222 "
"mick.doe@domain3", message)
assert send.rc == 0
with host.sudo():
# Remove restore directory in order to make sure restore has worked
# correctly.
host.run("rm -rf /root/restore")
backup_run = host.run('duply main backup')
assert backup_run.rc == 0
restore_run = host.run('duply main restore /root/restore')
assert restore_run.rc == 0
directory = host.file("/root/restore/var/lib/prosody/domain3")
assert directory.is_directory
assert directory.user == "prosody"
assert directory.group == "prosody"
assert directory.mode == 0o750
directory = host.file("/root/restore/var/lib/prosody/domain3/offline")
assert directory.is_directory
assert directory.user == "prosody"
assert directory.group == "prosody"
assert directory.mode == 0o750
offline_messages = host.file("/root/restore/var/lib/prosody/domain3/offline/mick%2edoe.list")
assert offline_messages.is_file
assert offline_messages.user == 'prosody'
assert offline_messages.group == 'prosody'
assert offline_messages.mode == 0o640
assert message in offline_messages.content_string
|