<commit_before>"""
Validate the virt module
"""
import logging
from numbers import Number
from xml.etree import ElementTree

import pytest
from tests.support.virt import SaltVirtMinionContainerFactory

docker = pytest.importorskip("docker")

log = logging.getLogger(__name__)

pytestmark = [
    pytest.mark.slow_test,
    pytest.mark.skip_if_binaries_missing("docker"),
]


@pytest.fixture(scope="module")
def virt_minion_0_id():
    return "virt-minion-0"


@pytest.fixture(scope="module")
def virt_minion_1_id():
    return "virt-minion-1"


@pytest.fixture(scope="module")
def virt_minion_0(
    salt_master,
    virt_minion_0_id,
    virt_minion_1_id,
):
    config_defaults = {
        "id": virt_minion_0_id,
        "open_mode": True,
        "transport": salt_master.config["transport"],
    }
    config_overrides = {"user": "root"}
    factory = salt_master.salt_minion_daemon(
        virt_minion_0_id,
        name=virt_minion_0_id,
        image="quay.io/rst0git/virt-minion",
        factory_class=SaltVirtMinionContainerFactory,
        defaults=config_defaults,
        overrides=config_overrides,
        container_run_kwargs={
            "extra_hosts": {
                virt_minion_0_id: "127.0.0.1",
                virt_minion_1_id: "127.0.0.1",
            }
        },
        pull_before_start=True,
        skip_on_pull_failure=True,
        skip_if_docker_client_not_connectable=True,
    )
    factory.after_terminate(
        pytest.helpers.remove_stale_minion_key, salt_master, factory.id
    )
    with factory.started():
        yield factory


@pytest.fixture(scope="module")
def virt_minion_1(
    salt_master,
    virt_minion_0_id,
    virt_minion_1_id,
):
    config_defaults = {
        "id": virt_minion_1_id,
        "open_mode": True,
        "transport": salt_master.config["transport"],
    }
    config_overrides = {"user": "root"}
    factory = salt_master.salt_minion_daemon(
        virt_minion_1_id,
        name=virt_minion_1_id,
        image="quay.io/rst0git/virt-minion",
        factory_class=SaltVirtMinionContainerFactory,
        defaults=config_defaults,
        overrides=config_overrides,
        container_run_kwargs={
            "extra_hosts": {
                virt_minion_0_id: "127.0.0.1",
                virt_minion_1_id: "127.0.0.1",
            }
        },
        pull_before_start=True,
        skip_on_pull_failure=True,<commit_msg>Switch to the SaltStack ORG on quay.io<commit_after>"""
Validate the virt module
"""
import logging
from numbers import Number
from xml.etree import ElementTree

import pytest
from tests.support.virt import SaltVirtMinionContainerFactory

docker = pytest.importorskip("docker")

log = logging.getLogger(__name__)

pytestmark = [
    pytest.mark.slow_test,
    pytest.mark.skip_if_binaries_missing("docker"),
]


@pytest.fixture(scope="module")
def virt_minion_0_id():
    return "virt-minion-0"


@pytest.fixture(scope="module")
def virt_minion_1_id():
    return "virt-minion-1"


@pytest.fixture(scope="module")
def virt_minion_0(
    salt_master,
    virt_minion_0_id,
    virt_minion_1_id,
):
    config_defaults = {
        "id": virt_minion_0_id,
        "open_mode": True,
        "transport": salt_master.config["transport"],
    }
    config_overrides = {"user": "root"}
    factory = salt_master.salt_minion_daemon(
        virt_minion_0_id,
        name=virt_minion_0_id,
        image="quay.io/saltstack/virt-minion",
        factory_class=SaltVirtMinionContainerFactory,
        defaults=config_defaults,
        overrides=config_overrides,
        container_run_kwargs={
            "extra_hosts": {
                virt_minion_0_id: "127.0.0.1",
                virt_minion_1_id: "127.0.0.1",
            }
        },
        pull_before_start=True,
        skip_on_pull_failure=True,
        skip_if_docker_client_not_connectable=True,
    )
    factory.after_terminate(
        pytest.helpers.remove_stale_minion_key, salt_master, factory.id
    )
    with factory.started():
        yield factory


@pytest.fixture(scope="module")
def virt_minion_1(
    salt_master,
    virt_minion_0_id,
    virt_minion_1_id,
):
    config_defaults = {
        "id": virt_minion_1_id,
        "open_mode": True,
        "transport": salt_master.config["transport"],
    }
    config_overrides = {"user": "root"}
    factory = salt_master.salt_minion_daemon(
        virt_minion_1_id,
        name=virt_minion_1_id,
        image="quay.io/saltstack/virt-minion",
        factory_class=SaltVirtMinionContainerFactory,
        defaults=config_defaults,
        overrides=config_overrides,
        container_run_kwargs={
            "extra_hosts": {
                virt_minion_0_id: "127.0.0.1",
                virt_minion_1_id: "127.0.0.1",
            }
        },
        pull_before_start=True,
        skip_on_pull_failure=True,
{'fraction_non_alphanumeric': 0.10518702211200662, 'fraction_numerical': 0.018598884066955982, 'mean_word_length': 2.8412698412698414, 'pattern_counts': {'":': 20, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 8, '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': '6532566', 'n_tokens_mistral': 1716, 'n_tokens_neox': 1689, 'n_words': 227}