<commit_before>import os

import testinfra.utils.ansible_runner

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


# check if MongoDB package is installed
def test_mongodb_is_installed(host):
    package = host.package('mongodb-org')
    assert package.is_installed
    assert package.version.startswith('3.4.7')


# check if MongoDB is enabled and running
def test_mongod_is_running(host):
    mongo = host.service('mongod')
    assert mongo.is_running
    assert mongo.is_enabled


# check if configuration file contains the required line
def test_mongod_config_file(File):
    config_file = File('/etc/mongod.conf')
    assert config_file.contains('port: 27017')
    assert config_file.contains('bindIp: 127.0.0.1')
    assert config_file.is_file


# check if mongod process is listening on localhost
def test_mongod_is_listening(host):
    port = host.socket('tcp://127.0.0.1:27017')
    assert port.is_listening
<commit_msg>Rename service name in default test<commit_after>import os

import testinfra.utils.ansible_runner

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


# check if MongoDB package is installed
def test_mongodb_is_installed(host):
    package = host.package('mongodb-org')
    assert package.is_installed
    assert package.version.startswith('3.4.7')


# check if MongoDB is enabled and running
def test_mongod_is_running(host):
    mongod = host.service('mongod')
    assert mongod.is_running
    assert mongod.is_enabled


# check if configuration file contains the required line
def test_mongod_config_file(File):
    config_file = File('/etc/mongod.conf')
    assert config_file.contains('port: 27017')
    assert config_file.contains('bindIp: 127.0.0.1')
    assert config_file.is_file


# check if mongod process is listening on localhost
def test_mongod_is_listening(host):
    port = host.socket('tcp://127.0.0.1:27017')
    assert port.is_listening

{'fraction_non_alphanumeric': 0.0972972972972973, 'fraction_numerical': 0.02457002457002457, 'mean_word_length': 4.751412429378531, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5435545', 'n_tokens_mistral': 711, 'n_tokens_neox': 652, 'n_words': 145}