Files @ 8902cd5aa66b
Branch filter:

Location: majic-ansible-roles/roles/backup/molecule/default/tests/test_parameters_mandatory.py - annotation

branko
MAR-218: Improve mail server role test reliability:

- Introduce sleep after sending out mails in order to ensure that
Postfix has had enough time to process the messages.
- Relevant only for tests that take care of parsing the mail log.
- Solves the false negatives caused by timing issues.
- It might be a good idea down the line to implement some kind of
retry/backoff mechanism instead.
import os

import testinfra.utils.ansible_runner


testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
    os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('parameters-mandatory')


def test_backup_patterns_content(host):
    """
    Tests if content of file containing backup patterns is correct.
    """

    with host.sudo():

        backup_pattern = host.file('/etc/duply/main/patterns/test')

        assert backup_pattern.content_string == ''


def test_include_content(host):
    """
    Tests if content of assembled include file containing backup patterns is
    correct.
    """

    with host.sudo():

        include = host.file('/etc/duply/main/include')

        assert include.content_string == ''