"""Defautl test module."""
import os

import testinfra.utils.ansible_runner

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


def test_group(host):
    """Test group."""
    group = host.group("prometheus")
    assert group.exists


def test_user(host):
    """Test user."""
    user = host.user("prometheus")
    assert user.exists
    assert "prometheus" in user.groups


def test_config(host):
    """Test config."""
    config = host.file("/etc/prometheus/prometheus.yml")
    assert config.exists
    assert config.is_file
    assert config.user == "root"
    assert config.group == "prometheus"
    assert config.mode == 0o640


def test_service(host):
    """Test service."""
    service = host.service("prometheus")
    assert service.is_enabled
    assert service.is_running


def test_socket(host):
    """Test socket connection."""
    socket = host.socket("tcp://0.0.0.0:9090")
    assert socket.is_listening


def test_version(host):
    """Test version."""
    version = os.getenv('PROMETHEUS', "2.3.2")
    out = host.run("/opt/prometheus/prometheus --version").stderr
    assert "prometheus, version " + version in out

79cfdcef980c7c9c6353c9bd7ec412226602dc97
<mask token>


def test_service(host):
    """Test service."""
    service = host.service('prometheus')
    assert service.is_enabled
    assert service.is_running


<mask token>


def test_version(host):
    """Test version."""
    version = os.getenv('PROMETHEUS', '2.3.2')
    out = host.run('/opt/prometheus/prometheus --version').stderr
    assert 'prometheus, version ' + version in out

<mask token>


def test_config(host):
    """Test config."""
    config = host.file('/etc/prometheus/prometheus.yml')
    assert config.exists
    assert config.is_file
    assert config.user == 'root'
    assert config.group == 'prometheus'
    assert config.mode == 416


def test_service(host):
    """Test service."""
    service = host.service('prometheus')
    assert service.is_enabled
    assert service.is_running


def test_socket(host):
    """Test socket connection."""
    socket = host.socket('tcp://0.0.0.0:9090')
    assert socket.is_listening


def test_version(host):
    """Test version."""
    version = os.getenv('PROMETHEUS', '2.3.2')
    out = host.run('/opt/prometheus/prometheus --version').stderr
    assert 'prometheus, version ' + version in out

<mask token>


def test_group(host):
    """Test group."""
    group = host.group('prometheus')
    assert group.exists


def test_user(host):
    """Test user."""
    user = host.user('prometheus')
    assert user.exists
    assert 'prometheus' in user.groups


def test_config(host):
    """Test config."""
    config = host.file('/etc/prometheus/prometheus.yml')
    assert config.exists
    assert config.is_file
    assert config.user == 'root'
    assert config.group == 'prometheus'
    assert config.mode == 416


def test_service(host):
    """Test service."""
    service = host.service('prometheus')
    assert service.is_enabled
    assert service.is_running


def test_socket(host):
    """Test socket connection."""
    socket = host.socket('tcp://0.0.0.0:9090')
    assert socket.is_listening


def test_version(host):
    """Test version."""
    version = os.getenv('PROMETHEUS', '2.3.2')
    out = host.run('/opt/prometheus/prometheus --version').stderr
    assert 'prometheus, version ' + version in out

<mask token>
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(os.environ[
    'MOLECULE_INVENTORY_FILE']).get_hosts('all')


def test_group(host):
    """Test group."""
    group = host.group('prometheus')
    assert group.exists


def test_user(host):
    """Test user."""
    user = host.user('prometheus')
    assert user.exists
    assert 'prometheus' in user.groups


def test_config(host):
    """Test config."""
    config = host.file('/etc/prometheus/prometheus.yml')
    assert config.exists
    assert config.is_file
    assert config.user == 'root'
    assert config.group == 'prometheus'
    assert config.mode == 416


def test_service(host):
    """Test service."""
    service = host.service('prometheus')
    assert service.is_enabled
    assert service.is_running


def test_socket(host):
    """Test socket connection."""
    socket = host.socket('tcp://0.0.0.0:9090')
    assert socket.is_listening


def test_version(host):
    """Test version."""
    version = os.getenv('PROMETHEUS', '2.3.2')
    out = host.run('/opt/prometheus/prometheus --version').stderr
    assert 'prometheus, version ' + version in out

"""Defautl test module."""
import os

import testinfra.utils.ansible_runner

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


def test_group(host):
    """Test group."""
    group = host.group("prometheus")
    assert group.exists


def test_user(host):
    """Test user."""
    user = host.user("prometheus")
    assert user.exists
    assert "prometheus" in user.groups


def test_config(host):
    """Test config."""
    config = host.file("/etc/prometheus/prometheus.yml")
    assert config.exists
    assert config.is_file
    assert config.user == "root"
    assert config.group == "prometheus"
    assert config.mode == 0o640


def test_service(host):
    """Test service."""
    service = host.service("prometheus")
    assert service.is_enabled
    assert service.is_running


def test_socket(host):
    """Test socket connection."""
    socket = host.socket("tcp://0.0.0.0:9090")
    assert socket.is_listening


def test_version(host):
    """Test version."""
    version = os.getenv('PROMETHEUS', "2.3.2")
    out = host.run("/opt/prometheus/prometheus --version").stderr
    assert "prometheus, version " + version in out
