3166-T9-R3-e2e-juliamagan.html

Report generated on 29-Aug-2022 at 10:44:59 by pytest-html v3.1.1

Environment

Packages {"pluggy": "0.13.1", "py": "1.10.0", "pytest": "6.2.2"}
Platform Linux-5.18.10-76051810-generic-x86_64-with-glibc2.35
Plugins {"html": "3.1.1", "metadata": "2.0.1", "testinfra": "5.0.0"}
Python 3.9.7

Summary

0 tests ran in 35.52 seconds.

0 passed, 0 skipped, 0 failed, 1 errors, 0 expected failures, 0 unexpected passes

Results

Result Test Duration Links
Error tests/end_to_end/test_basic_cases/test_windows_defender/test_windows_defender.py::test_windows_defender[detect_windows_defender_disable]::setup 35.43
request = <SubRequest 'validate_environments' for <Function test_windows_defender[detect_windows_defender_disable]>>

@pytest.fixture(scope='session', autouse=True)
def validate_environments(request):
"""Fixture with session scope to validate the environments before run the E2E tests.

This phase is divided into 4 steps:
Step 1: Collect the data related to the selected tests that will be executed.
Step 2: Generate a playbook containing cross-checks for selected tests.
Step 3: Run the generated playbook.

Args:
request (fixture): Gives access to the requesting test context.
"""
collected_items = request.session.items
roles_path = request.config.getoption('--roles-path')
inventory_path = request.config.getoption('--inventory_path')
playbook_generator = os.path.join(suite_path, 'data', 'validation_playbooks', 'generate_general_play.yaml')
playbook_template = os.path.join(suite_path, 'data', 'validation_templates', 'general_validation.j2')
general_playbook = os.path.join(suite_path, 'data', 'validation_playbooks', 'general_validation.yaml')

if not inventory_path:
raise ValueError('Inventory not specified')

# --------------------------------------- Step 1: Prepare the necessary data ---------------------------------------
test_suites_paths = []
target_hosts = []
target_distros = []

# Get the path of the tests from collected items.
collected_paths = [item.fspath for item in collected_items]
# Remove duplicates caused by the existence of 2 or more test cases
collected_paths = list(dict.fromkeys(collected_paths))

for path in collected_paths:
# Remove the name of the file from the path
path = str(path).rsplit('/', 1)[0]
# Add the test suite path
test_suites_paths.append(path)
# Get the test suite name
test_suite_name = path.split('/')[-1:][0]
# Set target hosts and distros
target_hosts, target_distros = get_target_hosts_and_distros(test_suite_name, target_distros, target_hosts)
# -------------------------------------------------- End of Step 1 -------------------------------------------------

# ---------------------- Step 2: Run the playbook to generate the general validation playbook ----------------------
gen_parameters = {
'playbook': playbook_generator, 'inventory': inventory_path,
'extravars': {
'template_path': playbook_template,
'dest_path': general_playbook,
'target_hosts': ','.join(target_hosts),
'distros': target_distros
}
}
ansible_runner.run(**gen_parameters)
# -------------------------------------------------- End of Step 2 -------------------------------------------------

# ----------------------------------- Step 3: Run the general validation playbook ----------------------------------
parameters = {
'playbook': general_playbook,
'inventory': inventory_path,
'envvars': {'ANSIBLE_ROLES_PATH': roles_path}
}
general_validation_runner = ansible_runner.run(**parameters)
# Remove the generated playbook
remove_file(general_playbook)
# If the general validations have failed, then abort the execution finishing with an error. Else, continue.
if general_validation_runner.status == 'failed':
# Collect inventory_hostnames with errors
hosts_with_errors = [key for key in general_validation_runner.stats['failures']]
# Collect list of errors
errors = []
errors.extend([general_validation_runner.get_fact_cache(host)['phase_results'] for host in hosts_with_errors])
errors = ''.join(errors)
# Raise the exception with errors details
> raise Exception(f"The general validations have failed. Please check that the environments meet the expected "
f"requirements. Result:\n{errors}")
E Exception: The general validations have failed. Please check that the environments meet the expected requirements. Result:
E The Ubuntu distro isn't supported for the selected tests currently.

tests/end_to_end/conftest.py:111: Exception
-----------------------------Captured stdout setup------------------------------
PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Generate a general validation playbook] ********************************** changed: [localhost] PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 PLAY [General validation phase] ************************************************ TASK [Gathering Facts] ********************************************************* ok: [windows-agent] ok: [centos-manager] TASK [host_checker : Set flag and informative variable] ************************ ok: [centos-manager] ok: [windows-agent] TASK [host_checker : Check default Python version (Linux)] ********************* skipping: [centos-manager] skipping: [windows-agent] TASK [host_checker : Get Python version (Windows)] ***************************** skipping: [centos-manager] skipping: [windows-agent] TASK [host_checker : Check default Python version (Windows)] ******************* skipping: [centos-manager] skipping: [windows-agent] TASK [host_checker : Check OS (Linux)] ***************************************** skipping: [centos-manager] ok: [windows-agent] TASK [host_checker : Check OS (Windows)] *************************************** skipping: [centos-manager] skipping: [windows-agent] TASK [Get Wazuh installation] ************************************************** TASK [service_controller : Get installation type] ****************************** changed: [windows-agent] changed: [centos-manager] TASK [host_checker : Populate services facts] ********************************** ok: [centos-manager] ok: [windows-agent] TASK [host_checker : Check the status of Wazuh components (Manager)] *********** skipping: [centos-manager] => (item=wazuh-manager.service) skipping: [centos-manager] => (item=wazuh-indexer.service) skipping: [centos-manager] => (item=filebeat.service) skipping: [windows-agent] => (item=wazuh-manager.service) skipping: [windows-agent] => (item=wazuh-indexer.service) skipping: [windows-agent] => (item=filebeat.service) TASK [host_checker : set_fact] ************************************************* skipping: [centos-manager] ok: [windows-agent] TASK [host_checker : Check the status of Wazuh Agent] ************************** skipping: [centos-manager] skipping: [windows-agent] TASK [Get Wazuh installation] ************************************************** TASK [service_controller : Get installation type] ****************************** changed: [centos-manager] changed: [windows-agent] TASK [host_checker : Run filebeat test] **************************************** skipping: [windows-agent] changed: [centos-manager] TASK [host_checker : Check the connection between Filebeat and Wazuh Indexer] *** skipping: [centos-manager] skipping: [windows-agent] TASK [Get Wazuh installation] ************************************************** TASK [service_controller : Get installation type] ****************************** changed: [centos-manager] changed: [windows-agent] TASK [host_checker : Test connection with Wazuh Indexer] *********************** skipping: [windows-agent] fatal: [centos-manager -> localhost]: FAILED! => {"changed": false, "msg": "The shell action failed to execute in the expected time frame (3) and was terminated"} ...ignoring TASK [host_checker : Check the connection between Controller node and Wazuh Indexer] *** skipping: [centos-manager] skipping: [windows-agent] TASK [host_checker : set_fact] ************************************************* ok: [centos-manager] ok: [windows-agent] TASK [host_checker : Verify if any check have failed] ************************** skipping: [centos-manager] fatal: [windows-agent]: FAILED! => {"changed": false, "msg": "Some validations were fail:\n'The Ubuntu distro isn't supported for the selected tests currently.\n'"} NO MORE HOSTS LEFT ************************************************************* PLAY RECAP ********************************************************************* centos-manager : ok=9 changed=4 unreachable=0 failed=0 skipped=11 rescued=0 ignored=1 windows-agent : ok=9 changed=3 unreachable=0 failed=1 skipped=10 rescued=0 ignored=0