Files @ 30d5b3fa5b93
Branch filter:

Location: majic-ansible-roles/roles/database_server/molecule/default/tests/test_default_jessie64.py

branko
MAR-132: Added support for Debian 9 (Stretch) to database_server role:

- Updated Molecule test configuration to include Debian 9 Stretch in
test matrix.
- Updated tests related to UTF-8 configuration (differences between
Debian 8 and 9).
- Deploy UTF-8 configuration in alternate locations depending on what
distro is being used.
- Force set-up of root password on Debian Stretch (default is to use
the unix_socket authentication).
import os

import testinfra.utils.ansible_runner


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


def test_utf8_configuration_file(host):
    """
    Tests if UTF-8 database server configuration file has been deployed
    correctly.
    """

    config = host.file('/etc/mysql/conf.d/utf8.cnf')

    assert config.is_file
    assert config.user == 'root'
    assert config.group == 'root'
    assert config.mode == 0o644


def test_stretch_utf8_configuration_file_absent(host):
    """
    Tests if the Stretch configuration file is absent.
    """

    config = host.file('/etc/mysql/mariadb.conf.d/90-utf8.cnf')

    assert not config.exists