Test_e2e_system_357_test_vulnerability_detector.html

Report generated on 29-Aug-2024 at 16:47:05 by pytest-html v3.1.1

Environment

Packages {"pluggy": "0.13.1", "py": "1.10.0", "pytest": "7.1.2"}
Platform Linux-5.10.198-187.748.amzn2.x86_64-x86_64-with-glibc2.26
Plugins {"html": "3.1.1", "metadata": "2.0.1", "testinfra": "5.0.0"}
Python 3.9.18

Summary

16 tests ran in 31999.80 seconds.

5 passed, 0 skipped, 11 failed, 0 errors, 0 expected failures, 0 unexpected passes
Tests Failed Success XFail Error
test_vulnerability_detector/test_vulnerability_detector.py 11 5 0 0

Results

Result Test Description Duration Links
Failed test_vulnerability_detector/test_vulnerability_detector.py::TestInitialScans::test_first_syscollector_scan[vd_disabled_when_agents_registration] description: Validates the initiation of the first Syscollector scans across all agents in the environment. 5982.48

Test function details

Extended Summary

This test ensures that Syscollector first scans are started in all agents in the environment.
tier: 0
parameters:
- request: pytest request object
- host_manager:
type: fixture
brief: Get the host manager of the environment
- vulnerability_detection_previously_enabled:
type: fixture
brief: Whether the vulnerability detection was previously enabled
- configure_environment:
type: fixture
brief: Configure the environment with the given configurations
- get_results: fixture to get the results of global class tests
assertions:
- Verify that all agents has been scanned

Parameters

self = <test_vulnerability_detector.TestInitialScans object at 0x7fdf6b773c10>
request = <FixtureRequest for <Function test_first_syscollector_scan[vd_disabled_when_agents_registration]>>
host_manager = <wazuh_testing.tools.system.HostManager object at 0x7fdf6b835040>
save_indexer_credentials_keystore = None
vulnerability_detection_previously_enabled = False
configure_vulnerability_detection_test_environment = '2024-08-29T07:54:45'
record_property = <function record_property.<locals>.append_property at 0x7fdf6afaf5e0>
clean_environment_logs = None, delete_states_vulnerability_index = None

@pytest.mark.parametrize(
"vulnerability_detection_previously_enabled",
[False, True],
ids=[
"vd_disabled_when_agents_registration",
"vd_enabled_when_agents_registration",
],
)
def test_first_syscollector_scan(
self,
request,
host_manager,
save_indexer_credentials_keystore,
vulnerability_detection_previously_enabled,
configure_vulnerability_detection_test_environment,
record_property,
clean_environment_logs,
delete_states_vulnerability_index,
):
"""
description: Validates the initiation of the first Syscollector scans across all agents in the environment.

This test ensures that Syscollector first scans are started in all agents in the environment.

tier: 0

parameters:
- request: pytest request object
- host_manager:
type: fixture
brief: Get the host manager of the environment
- vulnerability_detection_previously_enabled:
type: fixture
brief: Whether the vulnerability detection was previously enabled
- configure_environment:
type: fixture
brief: Configure the environment with the given configurations
- get_results: fixture to get the results of global class tests

assertions:
- Verify that all agents has been scanned
"""
global AGENTS_SCANNED_FIRST_SCAN
global FIRST_SCAN_TIME
global FIRST_SCAN_VULNERABILITIES_INDEX
global INITIAL_VULNERABILITIES

FIRST_SCAN_TIME = configure_vulnerability_detection_test_environment

test_result = TestResult(request.node.name)
test_result.add_check(self.all_agents_scanned_syscollector_first_scan_check)
test_result.add_check(self.all_agents_scanned_vulnerability_first_scan_check)
test_result.add_check(self.no_errors_check)

record_property("test_result", test_result)

# Store the agents scanned by syscollector in a global variable.
# Only the last test case result is retained for comparison with the second scan.
agents_not_scanned_first_scan = monitoring_syscollector_scan_agents(host_manager,
VD_E2E_TIMEOUT_SYSCOLLECTOR_SCAN)

AGENTS_SCANNED_FIRST_SCAN = [
agent
for agent in host_manager.get_group_hosts("agent")
if agent not in agents_not_scanned_first_scan
]

test_result.validate_check(
"all_agents_scanned_syscollector_first_scan",
[
Evidence(
"agents_not_scanned_syscollector_first_scan",
agents_not_scanned_first_scan,
)
],
)

if len(AGENTS_SCANNED_FIRST_SCAN) == 0:
logging.critical("Critical error. Test can not continue")
pytest.fail(
"Syscollector scan not started in any agent. Check agent logs for more information"
)

logging.critical("Waiting 30 minutes to avoid Indexer abuseControl.")
time.sleep(MINIMUM_TIMEOUT_RESCAN)

logging.critical("Waiting until agent all agents have been scanned.")
time.sleep(TIMEOUT_PER_AGENT_VULNERABILITY_FIRST_SCAN * len(AGENTS_SCANNED_FIRST_SCAN))

logging.critical("Checking vulnerabilities in the index")
vuln_by_agent_index = get_vulnerabilities_from_states_by_agent(
host_manager,
AGENTS_SCANNED_FIRST_SCAN,
greater_than_timestamp=FIRST_SCAN_TIME,
)

# Store the vulnerabilities in the global variable to make the comparision in test_consistency_initial_scans
if not vulnerability_detection_previously_enabled:
INITIAL_VULNERABILITIES["vd_disabled_when_agents_registration"] = (
vuln_by_agent_index
)
else:
INITIAL_VULNERABILITIES["vd_enabled_when_agents_registration"] = (
vuln_by_agent_index
)

FIRST_SCAN_VULNERABILITIES_INDEX = vuln_by_agent_index

logging.critical(
"Checking that all agents has been scanned and generated vulnerabilities in the index"
)

agent_not_scanned = []
# We expect at least one vulnerability in each agent
for agent, vulnerabilities in vuln_by_agent_index.items():
if len(vulnerabilities) == 0:
logging.critical(f"No vulnerabilities found for {agent}")
agent_not_scanned.append(agent)

# Validate that all agents has been scanned and generated vulnerabilities in the index
test_result.validate_check(
"all_agents_scanned_vulnerability_first_scan",
[
Evidence(
"agents_not_scanned_vulnerability_first_scan", agent_not_scanned
),
Evidence(
"vulnerabilities_index_first_scan", vuln_by_agent_index, debug=True
),
],
)

logging.critical("Checking for errors in the environment")
unexpected_errors = check_errors_in_environment(
host_manager, expected_errors=VULNERABILITY_DETECTION_E2E_EXPECTED_ERRORS
)

test_result.validate_check(
"no_errors", [Evidence("error_level_messages", unexpected_errors)]
)

> assert test_result.get_test_result(), test_result.report()
E AssertionError:
E Test test_first_syscollector_scan[vd_disabled_when_agents_registration] failed
E
E Check all_agents_scanned_syscollector_first_scan succeeded
E Check all_agents_scanned_vulnerability_first_scan succeeded
E Check no_errors failed. Evidences (['error_level_messages']) can be found in the report.
E -----
E
E assert False
E + where False = <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf6ae6df70>>()
E + where <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf6ae6df70>> = <wazuh_testing.end_to_end.TestResult object at 0x7fdf6ae6df70>.get_test_result

end_to_end/test_vulnerability_detector/test_vulnerability_detector.py:381: AssertionError
-------------------------------Captured log setup-------------------------------
ERROR root:conftest.py:278 Save the Wazuh indexer username and password into the Wazuh manager keystore ERROR root:test_vulnerability_detector.py:111 Configuring the environment: Vulnerability Detection Enabled: False ERROR root:test_vulnerability_detector.py:130 Restarting managers ERROR root:test_vulnerability_detector.py:144 Starting agents ERROR root:test_vulnerability_detector.py:147 Wait until agents are connected ERROR root:test_vulnerability_detector.py:111 Configuring the environment: Vulnerability Detection Enabled: True ERROR root:test_vulnerability_detector.py:130 Restarting managers ERROR root:test_vulnerability_detector.py:134 Wait until Vulnerability Detector has update all the feeds
-------------------------------Captured log call--------------------------------
ERROR root:__init__.py:237 Marked check all_agents_scanned_syscollector_first_scan result to True with evidences ['agents_not_scanned_syscollector_first_scan'] CRITICAL root:test_vulnerability_detector.py:323 Waiting 30 minutes to avoid Indexer abuseControl. CRITICAL root:test_vulnerability_detector.py:326 Waiting until agent all agents have been scanned. CRITICAL root:test_vulnerability_detector.py:329 Checking vulnerabilities in the index CRITICAL root:test_vulnerability_detector.py:348 Checking that all agents has been scanned and generated vulnerabilities in the index ERROR root:__init__.py:237 Marked check all_agents_scanned_vulnerability_first_scan result to True with evidences ['agents_not_scanned_vulnerability_first_scan', 'vulnerabilities_index_first_scan'] CRITICAL root:test_vulnerability_detector.py:372 Checking for errors in the environment ERROR root:__init__.py:237 Marked check no_errors result to False with evidences ['error_level_messages']
Failed test_vulnerability_detector/test_vulnerability_detector.py::TestInitialScans::test_first_syscollector_scan[vd_enabled_when_agents_registration] description: Validates the initiation of the first Syscollector scans across all agents in the environment. 5659.66

Test function details

Extended Summary

This test ensures that Syscollector first scans are started in all agents in the environment.
tier: 0
parameters:
- request: pytest request object
- host_manager:
type: fixture
brief: Get the host manager of the environment
- vulnerability_detection_previously_enabled:
type: fixture
brief: Whether the vulnerability detection was previously enabled
- configure_environment:
type: fixture
brief: Configure the environment with the given configurations
- get_results: fixture to get the results of global class tests
assertions:
- Verify that all agents has been scanned

Parameters

self = <test_vulnerability_detector.TestInitialScans object at 0x7fdf6b7737f0>
request = <FixtureRequest for <Function test_first_syscollector_scan[vd_enabled_when_agents_registration]>>
host_manager = <wazuh_testing.tools.system.HostManager object at 0x7fdf6b835040>
save_indexer_credentials_keystore = None
vulnerability_detection_previously_enabled = True
configure_vulnerability_detection_test_environment = '2024-08-29T09:33:54'
record_property = <function record_property.<locals>.append_property at 0x7fdf6ae7bca0>
clean_environment_logs = None, delete_states_vulnerability_index = None

@pytest.mark.parametrize(
"vulnerability_detection_previously_enabled",
[False, True],
ids=[
"vd_disabled_when_agents_registration",
"vd_enabled_when_agents_registration",
],
)
def test_first_syscollector_scan(
self,
request,
host_manager,
save_indexer_credentials_keystore,
vulnerability_detection_previously_enabled,
configure_vulnerability_detection_test_environment,
record_property,
clean_environment_logs,
delete_states_vulnerability_index,
):
"""
description: Validates the initiation of the first Syscollector scans across all agents in the environment.

This test ensures that Syscollector first scans are started in all agents in the environment.

tier: 0

parameters:
- request: pytest request object
- host_manager:
type: fixture
brief: Get the host manager of the environment
- vulnerability_detection_previously_enabled:
type: fixture
brief: Whether the vulnerability detection was previously enabled
- configure_environment:
type: fixture
brief: Configure the environment with the given configurations
- get_results: fixture to get the results of global class tests

assertions:
- Verify that all agents has been scanned
"""
global AGENTS_SCANNED_FIRST_SCAN
global FIRST_SCAN_TIME
global FIRST_SCAN_VULNERABILITIES_INDEX
global INITIAL_VULNERABILITIES

FIRST_SCAN_TIME = configure_vulnerability_detection_test_environment

test_result = TestResult(request.node.name)
test_result.add_check(self.all_agents_scanned_syscollector_first_scan_check)
test_result.add_check(self.all_agents_scanned_vulnerability_first_scan_check)
test_result.add_check(self.no_errors_check)

record_property("test_result", test_result)

# Store the agents scanned by syscollector in a global variable.
# Only the last test case result is retained for comparison with the second scan.
agents_not_scanned_first_scan = monitoring_syscollector_scan_agents(host_manager,
VD_E2E_TIMEOUT_SYSCOLLECTOR_SCAN)

AGENTS_SCANNED_FIRST_SCAN = [
agent
for agent in host_manager.get_group_hosts("agent")
if agent not in agents_not_scanned_first_scan
]

test_result.validate_check(
"all_agents_scanned_syscollector_first_scan",
[
Evidence(
"agents_not_scanned_syscollector_first_scan",
agents_not_scanned_first_scan,
)
],
)

if len(AGENTS_SCANNED_FIRST_SCAN) == 0:
logging.critical("Critical error. Test can not continue")
pytest.fail(
"Syscollector scan not started in any agent. Check agent logs for more information"
)

logging.critical("Waiting 30 minutes to avoid Indexer abuseControl.")
time.sleep(MINIMUM_TIMEOUT_RESCAN)

logging.critical("Waiting until agent all agents have been scanned.")
time.sleep(TIMEOUT_PER_AGENT_VULNERABILITY_FIRST_SCAN * len(AGENTS_SCANNED_FIRST_SCAN))

logging.critical("Checking vulnerabilities in the index")
vuln_by_agent_index = get_vulnerabilities_from_states_by_agent(
host_manager,
AGENTS_SCANNED_FIRST_SCAN,
greater_than_timestamp=FIRST_SCAN_TIME,
)

# Store the vulnerabilities in the global variable to make the comparision in test_consistency_initial_scans
if not vulnerability_detection_previously_enabled:
INITIAL_VULNERABILITIES["vd_disabled_when_agents_registration"] = (
vuln_by_agent_index
)
else:
INITIAL_VULNERABILITIES["vd_enabled_when_agents_registration"] = (
vuln_by_agent_index
)

FIRST_SCAN_VULNERABILITIES_INDEX = vuln_by_agent_index

logging.critical(
"Checking that all agents has been scanned and generated vulnerabilities in the index"
)

agent_not_scanned = []
# We expect at least one vulnerability in each agent
for agent, vulnerabilities in vuln_by_agent_index.items():
if len(vulnerabilities) == 0:
logging.critical(f"No vulnerabilities found for {agent}")
agent_not_scanned.append(agent)

# Validate that all agents has been scanned and generated vulnerabilities in the index
test_result.validate_check(
"all_agents_scanned_vulnerability_first_scan",
[
Evidence(
"agents_not_scanned_vulnerability_first_scan", agent_not_scanned
),
Evidence(
"vulnerabilities_index_first_scan", vuln_by_agent_index, debug=True
),
],
)

logging.critical("Checking for errors in the environment")
unexpected_errors = check_errors_in_environment(
host_manager, expected_errors=VULNERABILITY_DETECTION_E2E_EXPECTED_ERRORS
)

test_result.validate_check(
"no_errors", [Evidence("error_level_messages", unexpected_errors)]
)

> assert test_result.get_test_result(), test_result.report()
E AssertionError:
E Test test_first_syscollector_scan[vd_enabled_when_agents_registration] failed
E
E Check all_agents_scanned_syscollector_first_scan succeeded
E Check all_agents_scanned_vulnerability_first_scan succeeded
E Check no_errors failed. Evidences (['error_level_messages']) can be found in the report.
E -----
E
E assert False
E + where False = <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf6af82520>>()
E + where <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf6af82520>> = <wazuh_testing.end_to_end.TestResult object at 0x7fdf6af82520>.get_test_result

end_to_end/test_vulnerability_detector/test_vulnerability_detector.py:381: AssertionError
-------------------------------Captured log setup-------------------------------
ERROR root:test_vulnerability_detector.py:111 Configuring the environment: Vulnerability Detection Enabled: True ERROR root:test_vulnerability_detector.py:130 Restarting managers ERROR root:test_vulnerability_detector.py:134 Wait until Vulnerability Detector has update all the feeds ERROR root:test_vulnerability_detector.py:144 Starting agents ERROR root:test_vulnerability_detector.py:147 Wait until agents are connected
-------------------------------Captured log call--------------------------------
ERROR root:__init__.py:237 Marked check all_agents_scanned_syscollector_first_scan result to True with evidences ['agents_not_scanned_syscollector_first_scan'] CRITICAL root:test_vulnerability_detector.py:323 Waiting 30 minutes to avoid Indexer abuseControl. CRITICAL root:test_vulnerability_detector.py:326 Waiting until agent all agents have been scanned. CRITICAL root:test_vulnerability_detector.py:329 Checking vulnerabilities in the index CRITICAL root:test_vulnerability_detector.py:348 Checking that all agents has been scanned and generated vulnerabilities in the index ERROR root:__init__.py:237 Marked check all_agents_scanned_vulnerability_first_scan result to True with evidences ['agents_not_scanned_vulnerability_first_scan', 'vulnerabilities_index_first_scan'] CRITICAL root:test_vulnerability_detector.py:372 Checking for errors in the environment ERROR root:__init__.py:237 Marked check no_errors result to False with evidences ['error_level_messages']
Failed test_vulnerability_detector/test_vulnerability_detector.py::TestInitialScans::test_consistency_initial_scans description: Ensure the consistency of the agent's vulnerabilities neither the agent was registered nor. 0.00

Test function details

Extended Summary

This test ensures that the agent's vulnerabilities are consistent with the initial scan.
tier: 0
parameters:
- request: pytest request object
- host_manager:
type: fixture
brief: Get the host manager of the environment
assertions:
- Verify that the number of vulnerabilities is the same between scans

Parameters

self = <test_vulnerability_detector.TestInitialScans object at 0x7fdf6b773580>
request = <FixtureRequest for <Function test_consistency_initial_scans>>
record_property = <function record_property.<locals>.append_property at 0x7fdf6ae863a0>

def test_consistency_initial_scans(self, request, record_property):
"""
description: Ensure the consistency of the agent's vulnerabilities neither the agent was registered nor.

This test ensures that the agent's vulnerabilities are consistent with the initial scan.

tier: 0

parameters:
- request: pytest request object
- host_manager:
type: fixture
brief: Get the host manager of the environment

assertions:
- Verify that the number of vulnerabilities is the same between scans
"""
test_result = TestResult(request.node.name)
test_result.add_check(self.initial_vulnerabilities_consistent)

record_property("test_result", test_result)
test_result.validate_check(
"initial_vulnerabilities_consistent",
[
Evidence(
"vd_disabled_when_agents_registration",
INITIAL_VULNERABILITIES["vd_disabled_when_agents_registration"],
),
Evidence(
"vd_enabled_when_agents_registration",
INITIAL_VULNERABILITIES["vd_enabled_when_agents_registration"],
),
],
)

> assert test_result.get_test_result(), test_result.report()
E AssertionError:
E Test test_consistency_initial_scans failed
E
E Check initial_vulnerabilities_consistent failed. Evidences (['vd_disabled_when_agents_registration', 'vd_enabled_when_agents_registration']) can be found in the report.
E -----
E
E assert False
E + where False = <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf6b21ec10>>()
E + where <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf6b21ec10>> = <wazuh_testing.end_to_end.TestResult object at 0x7fdf6b21ec10>.get_test_result

end_to_end/test_vulnerability_detector/test_vulnerability_detector.py:418: AssertionError
-------------------------------Captured log call--------------------------------
ERROR root:__init__.py:237 Marked check initial_vulnerabilities_consistent result to False with evidences ['vd_disabled_when_agents_registration', 'vd_enabled_when_agents_registration']
Failed test_vulnerability_detector/test_vulnerability_detector.py::TestScanSyscollectorCases::test_install_vulnerable_package_when_agent_down[install_package] description: Install a vulnerable package when the agent is down. 2277.40

Test function details

Extended Summary

This test ensures that the Vulnerability Detector detects the vulnerability when the agent is down.
tier: 0
parameters:
- request: pytest request object
- host_manager:
type: fixture
brief: Get the host manager of the environment
- configure_environment:
type: fixture
brief: Configure the environment with the given configurations
- get_results: fixture to get the results of global class tests
assertions:

Parameters

self = <test_vulnerability_detector.TestScanSyscollectorCases object at 0x7fdf6b828790>
host_manager = <wazuh_testing.tools.system.HostManager object at 0x7fdf6b835040>
request = <FixtureRequest for <Function test_install_vulnerable_package_when_agent_down[install_package]>>
record_property = <function record_property.<locals>.append_property at 0x7fdf6b89f8b0>
preconditions = None
body = {'operation': 'install_package', 'package': {'centos': {'amd64': 'grafana-8.5.5-1', 'arm64v8': 'grafana-8.5.5-1'}, 'ma...proxy-0.5.9'}, 'ubuntu': {'amd64': 'grafana-8.5.5', 'arm64v8': 'grafana-8.5.5'}, 'windows': {'amd64': 'node-v17.0.1'}}}
teardown = {'operation': 'remove_package', 'package': {'centos': {'amd64': 'grafana-8.5.5-1', 'arm64v8': 'grafana-8.5.5-1'}, 'mac...proxy-0.5.9'}, 'ubuntu': {'amd64': 'grafana-8.5.5', 'arm64v8': 'grafana-8.5.5'}, 'windows': {'amd64': 'node-v17.0.1'}}}
setup = [], clean_environment_logs = None
delete_states_vulnerability_index = None, clean_environment_logs_function = None

@pytest.mark.parametrize("preconditions, body, teardown", single_vulnerable_case_complete_list,
ids=single_vulnerable_case_list_ids,)
def test_install_vulnerable_package_when_agent_down(self, host_manager, request, record_property, preconditions,
body, teardown, setup, clean_environment_logs,
delete_states_vulnerability_index,
clean_environment_logs_function):
"""
description: Install a vulnerable package when the agent is down.

This test ensures that the Vulnerability Detector detects the vulnerability when the agent is down.

tier: 0

parameters:
- request: pytest request object
- host_manager:
type: fixture
brief: Get the host manager of the environment
- configure_environment:
type: fixture
brief: Configure the environment with the given configurations
- get_results: fixture to get the results of global class tests

assertions:
"""
# Is mandatory to launch this test along with the first scan test'
global AGENTS_SCANNED_FIRST_SCAN
if len(AGENTS_SCANNED_FIRST_SCAN) == 0:
pytest.skip("No agent was scanned in the first scan. Skipping test.")

target_to_ignore = list(
set(host_manager.get_group_hosts("agent")) - set(AGENTS_SCANNED_FIRST_SCAN)
)

utc_now_timestamp = datetime.datetime.now(datetime.timezone.utc)
test_timestamp = utc_now_timestamp.strftime("%Y-%m-%dT%H:%M:%S")

test_result = TestResult(request.node.name)
test_result.add_check(self.no_errors_check)
test_result.add_check(self.operation_successfull_for_all_agents_check)
test_result.add_check(self.expected_vulnerabilities_found_in_index_check)
test_result.add_check(self.no_unexpected_vulnerabilities_found_in_index_check)
test_result.add_check(self.no_duplicated_vulnerabilities_check)

record_property("test_result", test_result)

host_manager.control_environment("stop", ["agent"], parallel=True)

# Install Vulnerable package
operations_result = launch_parallel_operations(
body, host_manager, target_to_ignore
)

logging.critical(f"Remote operation results: {operations_result}")
test_result.validate_check(
"operation_successfull_for_all_agents",
[Evidence("operation_results", operations_result)],
)

host_manager.control_environment("start", ["agent"], parallel=True)

time.sleep(AGENT_REGISTRATION_TIMEOUT * len(AGENTS_SCANNED_FIRST_SCAN))
time.sleep(VD_E2E_TIMEOUT_SYSCOLLECTOR_SCAN + PACKAGE_VULNERABILITY_SCAN_TIME * len(AGENTS_SCANNED_FIRST_SCAN))

package_data = [body["package"]]

vulnerabilities = get_vulnerabilities_index(host_manager, AGENTS_SCANNED_FIRST_SCAN, package_data)
expected_vulnerabilities = get_expected_index(host_manager, AGENTS_SCANNED_FIRST_SCAN, body["operation"],
body["package"])
duplicated_vulnerabilities = get_duplicated_vulnerabilities(vulnerabilities)

logging.critical("Validating found vulnerabilities")
test_result.validate_check('no_duplicated_vulnerabilities',
[Evidence('duplicated_vulnerabilities', duplicated_vulnerabilities),
Evidence('vulnerabilities', vulnerabilities)
])

result = compare_expected_found_vulnerabilities(vulnerabilities, expected_vulnerabilities)

vulnerabilities_not_found = result["vulnerabilities_not_found"]
vulnerabilities_unexpected = result["vulnerabilities_unexpected"]

logging.critical("Validating found vulnerabilities")
test_result.validate_check(
"expected_vulnerabilities_found_in_index",
[
Evidence("missing_vulnerabilities", vulnerabilities_not_found),
Evidence("vulnerabilities_found_in_index", vulnerabilities),
Evidence("expected_vulnerabilities", expected_vulnerabilities),
],
)

logging.critical("Validating unexpected vulnerabilities")
test_result.validate_check(
"no_unexpected_vulnerabilities_found_in_index",
[
Evidence("unexpected_vulnerabilities", vulnerabilities_unexpected),
Evidence("vulnerabilities_found_in_index", vulnerabilities),
Evidence("expected_vulnerabilities", expected_vulnerabilities),
],
)

errors_environment = check_errors_in_environment(
host_manager,
expected_errors=VULNERABILITY_DETECTION_E2E_EXPECTED_ERRORS,
greater_than_timestamp=test_timestamp,
)
test_result.validate_check("no_errors", [Evidence("error_level_messages", errors_environment)])

> assert test_result.get_test_result(), test_result.report()
E AssertionError:
E Test test_install_vulnerable_package_when_agent_down[install_package] failed
E
E Check no_errors succeeded
E Check operation_successfull_for_all_agents succeeded
E Check expected_vulnerabilities_found_in_index failed. Evidences (['missing_vulnerabilities']) can be found in the report.
E Check no_unexpected_vulnerabilities_found_in_index succeeded
E Check no_duplicated_vulnerabilities succeeded
E -----
E
E assert False
E + where False = <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf6ae75b20>>()
E + where <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf6ae75b20>> = <wazuh_testing.end_to_end.TestResult object at 0x7fdf6ae75b20>.get_test_result

end_to_end/test_vulnerability_detector/test_vulnerability_detector.py:754: AssertionError
-------------------------------Captured log call--------------------------------
CRITICAL root:test_vulnerability_detector.py:698 Remote operation results: {'agent5': True, 'agent6': True, 'agent3': True, 'agent2': True, 'agent4': True, 'agent1': True} ERROR root:__init__.py:237 Marked check operation_successfull_for_all_agents result to True with evidences ['operation_results'] CRITICAL root:test_vulnerability_detector.py:716 Validating found vulnerabilities ERROR root:__init__.py:237 Marked check no_duplicated_vulnerabilities result to True with evidences ['duplicated_vulnerabilities', 'vulnerabilities'] CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent2: Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.0.1', architecture='x86_64') CRITICAL root:check_validators.py:50 Vulnerabilities not found: {'agent1': [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='x86_64')], 'agent4': [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='arm64')], 'agent2': [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.0.1', architecture='x86_64')]} CRITICAL root:check_validators.py:51 Vulnerabilities unexpected: {} CRITICAL root:test_vulnerability_detector.py:727 Validating found vulnerabilities CRITICAL root:check_validators.py:145 agent1 is not empty: [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='x86_64')] CRITICAL root:check_validators.py:145 agent4 is not empty: [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='arm64')] CRITICAL root:check_validators.py:145 agent2 is not empty: [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.0.1', architecture='x86_64')] ERROR root:__init__.py:237 Marked check expected_vulnerabilities_found_in_index result to False with evidences ['missing_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:737 Validating unexpected vulnerabilities ERROR root:__init__.py:237 Marked check no_unexpected_vulnerabilities_found_in_index result to True with evidences ['unexpected_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] ERROR root:__init__.py:237 Marked check no_errors result to True with evidences ['error_level_messages']
-----------------------------Captured log teardown------------------------------
ERROR root:conftest.py:152 Truncate managers and agents logs CRITICAL root:conftest.py:353 Running teardown for agent: ['agent1', 'agent3', 'agent4', 'agent5', 'agent6', 'agent2'] CRITICAL root:conftest.py:356 Teardown Results: {'agent6': True, 'agent4': True, 'agent1': True, 'agent5': True, 'agent3': True, 'agent2': True}
Failed test_vulnerability_detector/test_vulnerability_detector.py::TestScanSyscollectorCases::test_change_agent_manager[install_package] 2236.92

Test function details

Extended Summary

Parameters

self = <test_vulnerability_detector.TestScanSyscollectorCases object at 0x7fdf6b828ac0>
permutate_agents_managers = None
request = <FixtureRequest for <Function test_change_agent_manager[install_package]>>
preconditions = None
body = {'operation': 'install_package', 'package': {'centos': {'amd64': 'grafana-8.5.5-1', 'arm64v8': 'grafana-8.5.5-1'}, 'ma...proxy-0.5.9'}, 'ubuntu': {'amd64': 'grafana-8.5.5', 'arm64v8': 'grafana-8.5.5'}, 'windows': {'amd64': 'node-v17.0.1'}}}
teardown = {'operation': 'remove_package', 'package': {'centos': {'amd64': 'grafana-8.5.5-1', 'arm64v8': 'grafana-8.5.5-1'}, 'mac...proxy-0.5.9'}, 'ubuntu': {'amd64': 'grafana-8.5.5', 'arm64v8': 'grafana-8.5.5'}, 'windows': {'amd64': 'node-v17.0.1'}}}
setup = []
host_manager = <wazuh_testing.tools.system.HostManager object at 0x7fdf6b835040>
record_property = <function record_property.<locals>.append_property at 0x7fdf53dca700>
clean_environment_logs = None, delete_states_vulnerability_index = None
clean_environment_logs_function = None

@pytest.mark.parametrize("preconditions, body, teardown", test_cases_change_manager,
ids=list_ids_change_manager,)
def test_change_agent_manager(self, permutate_agents_managers, request, preconditions, body,
teardown, setup, host_manager, record_property, clean_environment_logs,
delete_states_vulnerability_index, clean_environment_logs_function):
# Is mandatory to launch this test along with the first scan test'
global AGENTS_SCANNED_FIRST_SCAN
if len(AGENTS_SCANNED_FIRST_SCAN) == 0:
pytest.skip("No agent was scanned in the first scan. Skipping test.")

target_to_ignore = list(
set(host_manager.get_group_hosts("agent")) - set(AGENTS_SCANNED_FIRST_SCAN)
)

utc_now_timestamp = datetime.datetime.now(datetime.timezone.utc)
test_timestamp = utc_now_timestamp.strftime("%Y-%m-%dT%H:%M:%S")

test_result = TestResult(request.node.name)
test_result.add_check(self.no_errors_check)
test_result.add_check(self.operation_successfull_for_all_agents_check)
test_result.add_check(self.expected_vulnerabilities_found_in_index_check)
test_result.add_check(self.no_unexpected_vulnerabilities_found_in_index_check)
test_result.add_check(self.expected_vulnerability_affected_alert_check)
test_result.add_check(self.expected_vulnerability_mitigated_alert_check)
test_result.add_check(self.no_duplicated_vulnerabilities_check)

record_property("test_result", test_result)

# Install Vulnerable package
operations_result = launch_parallel_operations(
body, host_manager, target_to_ignore
)

logging.critical(f"Remote operation results: {operations_result}")
test_result.validate_check(
"operation_successfull_for_all_agents",
[Evidence("operation_results", operations_result)],
)

# Wait for Syscollector and VD Scan
time.sleep(VD_E2E_TIMEOUT_SYSCOLLECTOR_SCAN + PACKAGE_VULNERABILITY_SCAN_TIME * len(AGENTS_SCANNED_FIRST_SCAN))

package_data = [body["package"]]

vulnerabilities = get_vulnerabilities_index(host_manager, AGENTS_SCANNED_FIRST_SCAN, package_data)
expected_vulnerabilities = get_expected_index(host_manager, AGENTS_SCANNED_FIRST_SCAN, body["operation"],
body["package"])

result = compare_expected_found_vulnerabilities(vulnerabilities, expected_vulnerabilities)

vulnerabilities_not_found = result["vulnerabilities_not_found"]
vulnerabilities_unexpected = result["vulnerabilities_unexpected"]
duplicated_vulnerabilities = get_duplicated_vulnerabilities(vulnerabilities)

logging.critical("Validating found vulnerabilities")
test_result.validate_check('no_duplicated_vulnerabilities',
[Evidence('duplicated_vulnerabilities', duplicated_vulnerabilities),
Evidence('vulnerabilities', vulnerabilities)
])

test_result.validate_check(
"expected_vulnerabilities_found_in_index",
[
Evidence("missing_vulnerabilities", vulnerabilities_not_found),
Evidence("vulnerabilities_found_in_index", vulnerabilities),
Evidence("expected_vulnerabilities", expected_vulnerabilities),
],
)

logging.critical("Validating unexpected vulnerabilities")
test_result.validate_check(
"no_unexpected_vulnerabilities_found_in_index",
[
Evidence("unexpected_vulnerabilities", vulnerabilities_unexpected),
Evidence("vulnerabilities_found_in_index", vulnerabilities),
Evidence("expected_vulnerabilities", expected_vulnerabilities),
],
)

alerts = get_vulnerability_alerts(
host_manager, AGENTS_SCANNED_FIRST_SCAN, package_data, test_timestamp
)
expected_alerts = get_expected_alerts(
host_manager, AGENTS_SCANNED_FIRST_SCAN, body["operation"], body["package"]
)

result_alert = compare_expected_found_vulnerabilities_alerts(
alerts, expected_alerts
)

logging.critical("Validating found alerts")
test_result.validate_check(
"expected_vulnerability_affected_alert",
[
Evidence(
"missing_affected_alerts",
result_alert["vulnerabilities_affected_not_found"],
),
Evidence("alerts_found_in_index", alerts),
Evidence("expected_alerts", expected_alerts),
],
)

logging.critical("Validating unexpected alerts")
test_result.validate_check(
"expected_vulnerability_mitigated_alert",
[
Evidence(
"missing_mitigated_alerts",
result_alert["vulnerabilities_mitigated_not_found"],
),
Evidence("alerts_found_in_index", alerts),
Evidence("expected_alerts", expected_alerts),
],
)

errors_environment = check_errors_in_environment(
host_manager,
expected_errors=VULNERABILITY_DETECTION_E2E_EXPECTED_ERRORS,
greater_than_timestamp=test_timestamp,
)

test_result.validate_check("no_errors", [Evidence("error_level_messages", errors_environment)])

> assert test_result.get_test_result(), test_result.report()
E AssertionError:
E Test test_change_agent_manager[install_package] failed
E
E Check no_errors succeeded
E Check operation_successfull_for_all_agents succeeded
E Check expected_vulnerabilities_found_in_index failed. Evidences (['missing_vulnerabilities']) can be found in the report.
E Check no_unexpected_vulnerabilities_found_in_index succeeded
E Check expected_vulnerability_affected_alert failed. Evidences (['missing_affected_alerts']) can be found in the report.
E Check expected_vulnerability_mitigated_alert succeeded
E Check no_duplicated_vulnerabilities succeeded
E -----
E
E assert False
E + where False = <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf6af82220>>()
E + where <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf6af82220>> = <wazuh_testing.end_to_end.TestResult object at 0x7fdf6af82220>.get_test_result

end_to_end/test_vulnerability_detector/test_vulnerability_detector.py:880: AssertionError
-------------------------------Captured log setup-------------------------------
ERROR root:test_vulnerability_detector.py:627 Changing manager for agent agent1 to manager2 (172.31.11.130) ERROR root:test_vulnerability_detector.py:627 Changing manager for agent agent3 to manager2 (172.31.11.130) ERROR root:test_vulnerability_detector.py:627 Changing manager for agent agent4 to manager2 (172.31.11.130) ERROR root:test_vulnerability_detector.py:627 Changing manager for agent agent5 to manager1 (172.31.10.191) ERROR root:test_vulnerability_detector.py:627 Changing manager for agent agent6 to manager2 (54.91.36.245) ERROR root:test_vulnerability_detector.py:627 Changing manager for agent agent2 to manager1 (172.31.10.191) ERROR root:test_vulnerability_detector.py:633 Restarting agents
-------------------------------Captured log call--------------------------------
CRITICAL root:test_vulnerability_detector.py:789 Remote operation results: {'agent6': True, 'agent5': True, 'agent3': True, 'agent4': True, 'agent1': True, 'agent2': True} ERROR root:__init__.py:237 Marked check operation_successfull_for_all_agents result to True with evidences ['operation_results'] CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent2: Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.0.1', architecture='x86_64') CRITICAL root:check_validators.py:50 Vulnerabilities not found: {'agent1': [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='x86_64')], 'agent4': [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='arm64')], 'agent2': [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.0.1', architecture='x86_64')]} CRITICAL root:check_validators.py:51 Vulnerabilities unexpected: {} CRITICAL root:test_vulnerability_detector.py:810 Validating found vulnerabilities ERROR root:__init__.py:237 Marked check no_duplicated_vulnerabilities result to True with evidences ['duplicated_vulnerabilities', 'vulnerabilities'] CRITICAL root:check_validators.py:145 agent1 is not empty: [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='x86_64')] CRITICAL root:check_validators.py:145 agent4 is not empty: [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='arm64')] CRITICAL root:check_validators.py:145 agent2 is not empty: [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.0.1', architecture='x86_64')] ERROR root:__init__.py:237 Marked check expected_vulnerabilities_found_in_index result to False with evidences ['missing_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:825 Validating unexpected vulnerabilities ERROR root:__init__.py:237 Marked check no_unexpected_vulnerabilities_found_in_index result to True with evidences ['unexpected_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:check_validators.py:123 Vulnerabilities affected not found: {'agent2': [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.0.1', architecture='x86_64')]} CRITICAL root:check_validators.py:124 Vulnerabilities mitigated not found: {} CRITICAL root:test_vulnerability_detector.py:846 Validating found alerts CRITICAL root:check_validators.py:145 agent2 is not empty: [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.0.1', architecture='x86_64')] ERROR root:__init__.py:237 Marked check expected_vulnerability_affected_alert result to False with evidences ['missing_affected_alerts', 'alerts_found_in_index', 'expected_alerts'] CRITICAL root:test_vulnerability_detector.py:859 Validating unexpected alerts ERROR root:__init__.py:237 Marked check expected_vulnerability_mitigated_alert result to True with evidences ['missing_mitigated_alerts', 'alerts_found_in_index', 'expected_alerts'] ERROR root:__init__.py:237 Marked check no_errors result to True with evidences ['error_level_messages']
-----------------------------Captured log teardown------------------------------
ERROR root:conftest.py:152 Truncate managers and agents logs CRITICAL root:conftest.py:353 Running teardown for agent: ['agent1', 'agent3', 'agent4', 'agent5', 'agent6', 'agent2'] CRITICAL root:conftest.py:356 Teardown Results: {'agent6': True, 'agent4': True, 'agent1': True, 'agent5': True, 'agent3': True, 'agent2': True} ERROR root:test_vulnerability_detector.py:642 Restarting agents
Failed test_vulnerability_detector/test_vulnerability_detector.py::TestScanSyscollectorCases::test_vulnerability_detector_scans_cases[install_package] 1091.62

Test function details

Extended Summary

Parameters

self = <test_vulnerability_detector.TestScanSyscollectorCases object at 0x7fdf6b828be0>
request = <FixtureRequest for <Function test_vulnerability_detector_scans_cases[install_package]>>
preconditions = None
body = {'operation': 'install_package', 'package': {'centos': {'amd64': 'grafana-8.5.5-1', 'arm64v8': 'grafana-8.5.5-1'}, 'ma...proxy-0.5.9'}, 'ubuntu': {'amd64': 'grafana-8.5.5', 'arm64v8': 'grafana-8.5.5'}, 'windows': {'amd64': 'node-v17.0.1'}}}
teardown = None, setup = []
host_manager = <wazuh_testing.tools.system.HostManager object at 0x7fdf6b835040>
record_property = <function record_property.<locals>.append_property at 0x7fdf53dca310>
clean_environment_logs = None, delete_states_vulnerability_index = None
clean_environment_logs_function = None

@pytest.mark.parametrize("preconditions, body, teardown", complete_list, ids=list_ids)
def test_vulnerability_detector_scans_cases(self, request, preconditions, body, teardown, setup, host_manager,
record_property, clean_environment_logs,
delete_states_vulnerability_index,
clean_environment_logs_function):
# Is mandatory to launch this test along with the first scan test'
global AGENTS_SCANNED_FIRST_SCAN
if len(AGENTS_SCANNED_FIRST_SCAN) == 0:
pytest.skip("No agent was scanned in the first scan. Skipping test.")

target_to_ignore = list(
set(host_manager.get_group_hosts("agent")) - set(AGENTS_SCANNED_FIRST_SCAN)
)

utc_now_timestamp = datetime.datetime.now(datetime.timezone.utc)
test_timestamp = utc_now_timestamp.strftime("%Y-%m-%dT%H:%M:%S")

test_result = TestResult(request.node.name)
test_result.add_check(self.no_errors_check)
test_result.add_check(self.operation_successfull_for_all_agents_check)
test_result.add_check(self.expected_vulnerabilities_found_in_index_check)
test_result.add_check(self.no_unexpected_vulnerabilities_found_in_index_check)
test_result.add_check(self.expected_vulnerability_affected_alert_check)
test_result.add_check(self.expected_vulnerability_mitigated_alert_check)
test_result.add_check(self.setup_successfull_for_all_agents_check)
test_result.add_check(self.no_duplicated_vulnerabilities_check)

record_property("test_result", test_result)

agents_failed_setup = setup
test_result.validate_check("setup_operation_results", [Evidence("setup_failed_agents", agents_failed_setup)])

# Install Vulnerable package
operations_result = launch_parallel_operations(
body, host_manager, target_to_ignore
)

logging.critical(f"Remote operation results: {operations_result}")
test_result.validate_check(
"operation_successfull_for_all_agents",
[Evidence("operation_results", operations_result)],
)
# Wait for syscollector and VD scan
time.sleep(VD_E2E_TIMEOUT_SYSCOLLECTOR_SCAN + PACKAGE_VULNERABILITY_SCAN_TIME * len(AGENTS_SCANNED_FIRST_SCAN))

if "to" in body["package"]:
package_data = [body["package"]["to"], body["package"]["from"]]
else:
package_data = [body["package"]]

vulnerabilities = get_vulnerabilities_index(host_manager, AGENTS_SCANNED_FIRST_SCAN, package_data)
expected_vulnerabilities = get_expected_index(host_manager, AGENTS_SCANNED_FIRST_SCAN,
body["operation"], body["package"])
duplicated_vulnerabilities = get_duplicated_vulnerabilities(vulnerabilities)

result = compare_expected_found_vulnerabilities(vulnerabilities, expected_vulnerabilities)
vulnerabilities_not_found = result["vulnerabilities_not_found"]
vulnerabilities_unexpected = result["vulnerabilities_unexpected"]

test_result.validate_check('no_duplicated_vulnerabilities',
[Evidence('duplicated_vulnerabilities', duplicated_vulnerabilities),
Evidence('vulnerabilities', vulnerabilities)
])

logging.critical("Validating found vulnerabilities")
test_result.validate_check(
"expected_vulnerabilities_found_in_index",
[
Evidence("missing_vulnerabilities", vulnerabilities_not_found),
Evidence("vulnerabilities_found_in_index", vulnerabilities),
Evidence("expected_vulnerabilities", expected_vulnerabilities),
],
)

logging.critical("Validating unexpected vulnerabilities")
test_result.validate_check(
"no_unexpected_vulnerabilities_found_in_index",
[
Evidence("unexpected_vulnerabilities", vulnerabilities_unexpected),
Evidence("vulnerabilities_found_in_index", vulnerabilities),
Evidence("expected_vulnerabilities", expected_vulnerabilities),
],
)

alerts = get_vulnerability_alerts(host_manager, AGENTS_SCANNED_FIRST_SCAN, package_data, test_timestamp)
expected_alerts = get_expected_alerts(
host_manager, AGENTS_SCANNED_FIRST_SCAN, body["operation"], body["package"]
)

result_alert = compare_expected_found_vulnerabilities_alerts(
alerts, expected_alerts
)

logging.critical("Validating found alerts")
test_result.validate_check(
"expected_vulnerability_affected_alert",
[
Evidence(
"missing_affected_alerts",
result_alert["vulnerabilities_affected_not_found"],
),
Evidence("alerts_found_in_index", alerts),
Evidence("expected_alerts", expected_alerts),
],
)

logging.critical("Validating unexpected alerts")
test_result.validate_check(
"expected_vulnerability_mitigated_alert",
[
Evidence(
"missing_mitigated_alerts",
result_alert["vulnerabilities_mitigated_not_found"],
),
Evidence("alerts_found_in_index", alerts),
Evidence("expected_alerts", expected_alerts),
],
)

errors_environment = check_errors_in_environment(
host_manager,
expected_errors=VULNERABILITY_DETECTION_E2E_EXPECTED_ERRORS,
greater_than_timestamp=test_timestamp,
)

test_result.validate_check("no_errors", [Evidence("error_level_messages", errors_environment)])

> assert test_result.get_test_result(), test_result.report()
E AssertionError:
E Test test_vulnerability_detector_scans_cases[install_package] failed
E
E Check no_errors succeeded
E Check operation_successfull_for_all_agents succeeded
E Check expected_vulnerabilities_found_in_index failed. Evidences (['missing_vulnerabilities']) can be found in the report.
E Check no_unexpected_vulnerabilities_found_in_index succeeded
E Check expected_vulnerability_affected_alert failed. Evidences (['missing_affected_alerts']) can be found in the report.
E Check expected_vulnerability_mitigated_alert succeeded
E Check setup_operation_results succeeded
E Check no_duplicated_vulnerabilities succeeded
E -----
E
E assert False
E + where False = <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf6ae75760>>()
E + where <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf6ae75760>> = <wazuh_testing.end_to_end.TestResult object at 0x7fdf6ae75760>.get_test_result

end_to_end/test_vulnerability_detector/test_vulnerability_detector.py:1009: AssertionError
-------------------------------Captured log call--------------------------------
ERROR root:__init__.py:237 Marked check setup_operation_results result to True with evidences ['setup_failed_agents'] CRITICAL root:test_vulnerability_detector.py:919 Remote operation results: {'agent6': True, 'agent5': True, 'agent3': True, 'agent4': True, 'agent1': True, 'agent2': True} ERROR root:__init__.py:237 Marked check operation_successfull_for_all_agents result to True with evidences ['operation_results'] CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent2: Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.0.1', architecture='x86_64') CRITICAL root:check_validators.py:50 Vulnerabilities not found: {'agent1': [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='x86_64')], 'agent4': [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='arm64')], 'agent2': [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.0.1', architecture='x86_64')]} CRITICAL root:check_validators.py:51 Vulnerabilities unexpected: {} ERROR root:__init__.py:237 Marked check no_duplicated_vulnerabilities result to True with evidences ['duplicated_vulnerabilities', 'vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:946 Validating found vulnerabilities CRITICAL root:check_validators.py:145 agent1 is not empty: [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='x86_64')] CRITICAL root:check_validators.py:145 agent4 is not empty: [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='arm64')] CRITICAL root:check_validators.py:145 agent2 is not empty: [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.0.1', architecture='x86_64')] ERROR root:__init__.py:237 Marked check expected_vulnerabilities_found_in_index result to False with evidences ['missing_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:956 Validating unexpected vulnerabilities ERROR root:__init__.py:237 Marked check no_unexpected_vulnerabilities_found_in_index result to True with evidences ['unexpected_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:check_validators.py:123 Vulnerabilities affected not found: {'agent2': [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.0.1', architecture='x86_64')]} CRITICAL root:check_validators.py:124 Vulnerabilities mitigated not found: {} CRITICAL root:test_vulnerability_detector.py:975 Validating found alerts CRITICAL root:check_validators.py:145 agent2 is not empty: [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.0.1', architecture='x86_64')] ERROR root:__init__.py:237 Marked check expected_vulnerability_affected_alert result to False with evidences ['missing_affected_alerts', 'alerts_found_in_index', 'expected_alerts'] CRITICAL root:test_vulnerability_detector.py:988 Validating unexpected alerts ERROR root:__init__.py:237 Marked check expected_vulnerability_mitigated_alert result to True with evidences ['missing_mitigated_alerts', 'alerts_found_in_index', 'expected_alerts'] ERROR root:__init__.py:237 Marked check no_errors result to True with evidences ['error_level_messages']
-----------------------------Captured log teardown------------------------------
ERROR root:conftest.py:152 Truncate managers and agents logs
Failed test_vulnerability_detector/test_vulnerability_detector.py::TestScanSyscollectorCases::test_vulnerability_detector_scans_cases[remove_package] 1092.73

Test function details

Extended Summary

Parameters

self = <test_vulnerability_detector.TestScanSyscollectorCases object at 0x7fdf6b828730>
request = <FixtureRequest for <Function test_vulnerability_detector_scans_cases[remove_package]>>
preconditions = None
body = {'operation': 'remove_package', 'package': {'centos': {'amd64': 'grafana-8.5.5-1', 'arm64v8': 'grafana-8.5.5-1'}, 'mac...proxy-0.5.9'}, 'ubuntu': {'amd64': 'grafana-8.5.5', 'arm64v8': 'grafana-8.5.5'}, 'windows': {'amd64': 'node-v17.0.1'}}}
teardown = None, setup = []
host_manager = <wazuh_testing.tools.system.HostManager object at 0x7fdf6b835040>
record_property = <function record_property.<locals>.append_property at 0x7fdf695cab80>
clean_environment_logs = None, delete_states_vulnerability_index = None
clean_environment_logs_function = None

@pytest.mark.parametrize("preconditions, body, teardown", complete_list, ids=list_ids)
def test_vulnerability_detector_scans_cases(self, request, preconditions, body, teardown, setup, host_manager,
record_property, clean_environment_logs,
delete_states_vulnerability_index,
clean_environment_logs_function):
# Is mandatory to launch this test along with the first scan test'
global AGENTS_SCANNED_FIRST_SCAN
if len(AGENTS_SCANNED_FIRST_SCAN) == 0:
pytest.skip("No agent was scanned in the first scan. Skipping test.")

target_to_ignore = list(
set(host_manager.get_group_hosts("agent")) - set(AGENTS_SCANNED_FIRST_SCAN)
)

utc_now_timestamp = datetime.datetime.now(datetime.timezone.utc)
test_timestamp = utc_now_timestamp.strftime("%Y-%m-%dT%H:%M:%S")

test_result = TestResult(request.node.name)
test_result.add_check(self.no_errors_check)
test_result.add_check(self.operation_successfull_for_all_agents_check)
test_result.add_check(self.expected_vulnerabilities_found_in_index_check)
test_result.add_check(self.no_unexpected_vulnerabilities_found_in_index_check)
test_result.add_check(self.expected_vulnerability_affected_alert_check)
test_result.add_check(self.expected_vulnerability_mitigated_alert_check)
test_result.add_check(self.setup_successfull_for_all_agents_check)
test_result.add_check(self.no_duplicated_vulnerabilities_check)

record_property("test_result", test_result)

agents_failed_setup = setup
test_result.validate_check("setup_operation_results", [Evidence("setup_failed_agents", agents_failed_setup)])

# Install Vulnerable package
operations_result = launch_parallel_operations(
body, host_manager, target_to_ignore
)

logging.critical(f"Remote operation results: {operations_result}")
test_result.validate_check(
"operation_successfull_for_all_agents",
[Evidence("operation_results", operations_result)],
)
# Wait for syscollector and VD scan
time.sleep(VD_E2E_TIMEOUT_SYSCOLLECTOR_SCAN + PACKAGE_VULNERABILITY_SCAN_TIME * len(AGENTS_SCANNED_FIRST_SCAN))

if "to" in body["package"]:
package_data = [body["package"]["to"], body["package"]["from"]]
else:
package_data = [body["package"]]

vulnerabilities = get_vulnerabilities_index(host_manager, AGENTS_SCANNED_FIRST_SCAN, package_data)
expected_vulnerabilities = get_expected_index(host_manager, AGENTS_SCANNED_FIRST_SCAN,
body["operation"], body["package"])
duplicated_vulnerabilities = get_duplicated_vulnerabilities(vulnerabilities)

result = compare_expected_found_vulnerabilities(vulnerabilities, expected_vulnerabilities)
vulnerabilities_not_found = result["vulnerabilities_not_found"]
vulnerabilities_unexpected = result["vulnerabilities_unexpected"]

test_result.validate_check('no_duplicated_vulnerabilities',
[Evidence('duplicated_vulnerabilities', duplicated_vulnerabilities),
Evidence('vulnerabilities', vulnerabilities)
])

logging.critical("Validating found vulnerabilities")
test_result.validate_check(
"expected_vulnerabilities_found_in_index",
[
Evidence("missing_vulnerabilities", vulnerabilities_not_found),
Evidence("vulnerabilities_found_in_index", vulnerabilities),
Evidence("expected_vulnerabilities", expected_vulnerabilities),
],
)

logging.critical("Validating unexpected vulnerabilities")
test_result.validate_check(
"no_unexpected_vulnerabilities_found_in_index",
[
Evidence("unexpected_vulnerabilities", vulnerabilities_unexpected),
Evidence("vulnerabilities_found_in_index", vulnerabilities),
Evidence("expected_vulnerabilities", expected_vulnerabilities),
],
)

alerts = get_vulnerability_alerts(host_manager, AGENTS_SCANNED_FIRST_SCAN, package_data, test_timestamp)
expected_alerts = get_expected_alerts(
host_manager, AGENTS_SCANNED_FIRST_SCAN, body["operation"], body["package"]
)

result_alert = compare_expected_found_vulnerabilities_alerts(
alerts, expected_alerts
)

logging.critical("Validating found alerts")
test_result.validate_check(
"expected_vulnerability_affected_alert",
[
Evidence(
"missing_affected_alerts",
result_alert["vulnerabilities_affected_not_found"],
),
Evidence("alerts_found_in_index", alerts),
Evidence("expected_alerts", expected_alerts),
],
)

logging.critical("Validating unexpected alerts")
test_result.validate_check(
"expected_vulnerability_mitigated_alert",
[
Evidence(
"missing_mitigated_alerts",
result_alert["vulnerabilities_mitigated_not_found"],
),
Evidence("alerts_found_in_index", alerts),
Evidence("expected_alerts", expected_alerts),
],
)

errors_environment = check_errors_in_environment(
host_manager,
expected_errors=VULNERABILITY_DETECTION_E2E_EXPECTED_ERRORS,
greater_than_timestamp=test_timestamp,
)

test_result.validate_check("no_errors", [Evidence("error_level_messages", errors_environment)])

> assert test_result.get_test_result(), test_result.report()
E AssertionError:
E Test test_vulnerability_detector_scans_cases[remove_package] failed
E
E Check no_errors succeeded
E Check operation_successfull_for_all_agents succeeded
E Check expected_vulnerabilities_found_in_index succeeded
E Check no_unexpected_vulnerabilities_found_in_index succeeded
E Check expected_vulnerability_affected_alert succeeded
E Check expected_vulnerability_mitigated_alert failed. Evidences (['missing_mitigated_alerts']) can be found in the report.
E Check setup_operation_results succeeded
E Check no_duplicated_vulnerabilities succeeded
E -----
E
E assert False
E + where False = <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf6ae75ee0>>()
E + where <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf6ae75ee0>> = <wazuh_testing.end_to_end.TestResult object at 0x7fdf6ae75ee0>.get_test_result

end_to_end/test_vulnerability_detector/test_vulnerability_detector.py:1009: AssertionError
-------------------------------Captured log call--------------------------------
ERROR root:__init__.py:237 Marked check setup_operation_results result to True with evidences ['setup_failed_agents'] CRITICAL root:test_vulnerability_detector.py:919 Remote operation results: {'agent6': True, 'agent4': True, 'agent1': True, 'agent5': True, 'agent3': True, 'agent2': True} ERROR root:__init__.py:237 Marked check operation_successfull_for_all_agents result to True with evidences ['operation_results'] ERROR root:__init__.py:237 Marked check no_duplicated_vulnerabilities result to True with evidences ['duplicated_vulnerabilities', 'vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:946 Validating found vulnerabilities ERROR root:__init__.py:237 Marked check expected_vulnerabilities_found_in_index result to True with evidences ['missing_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:956 Validating unexpected vulnerabilities ERROR root:__init__.py:237 Marked check no_unexpected_vulnerabilities_found_in_index result to True with evidences ['unexpected_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:check_validators.py:123 Vulnerabilities affected not found: {} CRITICAL root:check_validators.py:124 Vulnerabilities mitigated not found: {'agent2': [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.0.1', architecture='x86_64')]} CRITICAL root:test_vulnerability_detector.py:975 Validating found alerts ERROR root:__init__.py:237 Marked check expected_vulnerability_affected_alert result to True with evidences ['missing_affected_alerts', 'alerts_found_in_index', 'expected_alerts'] CRITICAL root:test_vulnerability_detector.py:988 Validating unexpected alerts CRITICAL root:check_validators.py:145 agent2 is not empty: [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.0.1', architecture='x86_64')] ERROR root:__init__.py:237 Marked check expected_vulnerability_mitigated_alert result to False with evidences ['missing_mitigated_alerts', 'alerts_found_in_index', 'expected_alerts'] ERROR root:__init__.py:237 Marked check no_errors result to True with evidences ['error_level_messages']
-----------------------------Captured log teardown------------------------------
ERROR root:conftest.py:152 Truncate managers and agents logs
Failed test_vulnerability_detector/test_vulnerability_detector.py::TestScanSyscollectorCases::test_vulnerability_detector_scans_cases[upgrade_package_maintain_vulnerability] 2171.12

Test function details

Extended Summary

Parameters

self = <test_vulnerability_detector.TestScanSyscollectorCases object at 0x7fdf6b835f70>
request = <FixtureRequest for <Function test_vulnerability_detector_scans_cases[upgrade_package_maintain_vulnerability]>>
preconditions = {'operation': 'install_package', 'package': {'centos': {'amd64': 'grafana-8.5.5-1', 'arm64v8': 'grafana-8.5.5-1'}, 'ma...m64v8': 'grafana-8.5.5'}, 'windows': {'amd64': 'node-v17.0.1'}}, 'target_os': ['centos', 'ubuntu', 'windows', 'macos']}
body = {'operation': 'update_package', 'package': {'from': {'centos': {'amd64': 'grafana-8.5.5-1', 'arm64v8': 'grafana-8.5.5-...oxy-0.5.10'}, 'ubuntu': {'amd64': 'grafana-8.5.6', 'arm64v8': 'grafana-8.5.6'}, 'windows': {'amd64': 'node-v17.1.0'}}}}
teardown = None, setup = ['agent1', 'agent4', 'agent2']
host_manager = <wazuh_testing.tools.system.HostManager object at 0x7fdf6b835040>
record_property = <function record_property.<locals>.append_property at 0x7fdf68e9cee0>
clean_environment_logs = None, delete_states_vulnerability_index = None
clean_environment_logs_function = None

@pytest.mark.parametrize("preconditions, body, teardown", complete_list, ids=list_ids)
def test_vulnerability_detector_scans_cases(self, request, preconditions, body, teardown, setup, host_manager,
record_property, clean_environment_logs,
delete_states_vulnerability_index,
clean_environment_logs_function):
# Is mandatory to launch this test along with the first scan test'
global AGENTS_SCANNED_FIRST_SCAN
if len(AGENTS_SCANNED_FIRST_SCAN) == 0:
pytest.skip("No agent was scanned in the first scan. Skipping test.")

target_to_ignore = list(
set(host_manager.get_group_hosts("agent")) - set(AGENTS_SCANNED_FIRST_SCAN)
)

utc_now_timestamp = datetime.datetime.now(datetime.timezone.utc)
test_timestamp = utc_now_timestamp.strftime("%Y-%m-%dT%H:%M:%S")

test_result = TestResult(request.node.name)
test_result.add_check(self.no_errors_check)
test_result.add_check(self.operation_successfull_for_all_agents_check)
test_result.add_check(self.expected_vulnerabilities_found_in_index_check)
test_result.add_check(self.no_unexpected_vulnerabilities_found_in_index_check)
test_result.add_check(self.expected_vulnerability_affected_alert_check)
test_result.add_check(self.expected_vulnerability_mitigated_alert_check)
test_result.add_check(self.setup_successfull_for_all_agents_check)
test_result.add_check(self.no_duplicated_vulnerabilities_check)

record_property("test_result", test_result)

agents_failed_setup = setup
test_result.validate_check("setup_operation_results", [Evidence("setup_failed_agents", agents_failed_setup)])

# Install Vulnerable package
operations_result = launch_parallel_operations(
body, host_manager, target_to_ignore
)

logging.critical(f"Remote operation results: {operations_result}")
test_result.validate_check(
"operation_successfull_for_all_agents",
[Evidence("operation_results", operations_result)],
)
# Wait for syscollector and VD scan
time.sleep(VD_E2E_TIMEOUT_SYSCOLLECTOR_SCAN + PACKAGE_VULNERABILITY_SCAN_TIME * len(AGENTS_SCANNED_FIRST_SCAN))

if "to" in body["package"]:
package_data = [body["package"]["to"], body["package"]["from"]]
else:
package_data = [body["package"]]

vulnerabilities = get_vulnerabilities_index(host_manager, AGENTS_SCANNED_FIRST_SCAN, package_data)
expected_vulnerabilities = get_expected_index(host_manager, AGENTS_SCANNED_FIRST_SCAN,
body["operation"], body["package"])
duplicated_vulnerabilities = get_duplicated_vulnerabilities(vulnerabilities)

result = compare_expected_found_vulnerabilities(vulnerabilities, expected_vulnerabilities)
vulnerabilities_not_found = result["vulnerabilities_not_found"]
vulnerabilities_unexpected = result["vulnerabilities_unexpected"]

test_result.validate_check('no_duplicated_vulnerabilities',
[Evidence('duplicated_vulnerabilities', duplicated_vulnerabilities),
Evidence('vulnerabilities', vulnerabilities)
])

logging.critical("Validating found vulnerabilities")
test_result.validate_check(
"expected_vulnerabilities_found_in_index",
[
Evidence("missing_vulnerabilities", vulnerabilities_not_found),
Evidence("vulnerabilities_found_in_index", vulnerabilities),
Evidence("expected_vulnerabilities", expected_vulnerabilities),
],
)

logging.critical("Validating unexpected vulnerabilities")
test_result.validate_check(
"no_unexpected_vulnerabilities_found_in_index",
[
Evidence("unexpected_vulnerabilities", vulnerabilities_unexpected),
Evidence("vulnerabilities_found_in_index", vulnerabilities),
Evidence("expected_vulnerabilities", expected_vulnerabilities),
],
)

alerts = get_vulnerability_alerts(host_manager, AGENTS_SCANNED_FIRST_SCAN, package_data, test_timestamp)
expected_alerts = get_expected_alerts(
host_manager, AGENTS_SCANNED_FIRST_SCAN, body["operation"], body["package"]
)

result_alert = compare_expected_found_vulnerabilities_alerts(
alerts, expected_alerts
)

logging.critical("Validating found alerts")
test_result.validate_check(
"expected_vulnerability_affected_alert",
[
Evidence(
"missing_affected_alerts",
result_alert["vulnerabilities_affected_not_found"],
),
Evidence("alerts_found_in_index", alerts),
Evidence("expected_alerts", expected_alerts),
],
)

logging.critical("Validating unexpected alerts")
test_result.validate_check(
"expected_vulnerability_mitigated_alert",
[
Evidence(
"missing_mitigated_alerts",
result_alert["vulnerabilities_mitigated_not_found"],
),
Evidence("alerts_found_in_index", alerts),
Evidence("expected_alerts", expected_alerts),
],
)

errors_environment = check_errors_in_environment(
host_manager,
expected_errors=VULNERABILITY_DETECTION_E2E_EXPECTED_ERRORS,
greater_than_timestamp=test_timestamp,
)

test_result.validate_check("no_errors", [Evidence("error_level_messages", errors_environment)])

> assert test_result.get_test_result(), test_result.report()
E AssertionError:
E Test test_vulnerability_detector_scans_cases[upgrade_package_maintain_vulnerability] failed
E
E Check no_errors succeeded
E Check operation_successfull_for_all_agents succeeded
E Check expected_vulnerabilities_found_in_index failed. Evidences (['missing_vulnerabilities']) can be found in the report.
E Check no_unexpected_vulnerabilities_found_in_index succeeded
E Check expected_vulnerability_affected_alert failed. Evidences (['missing_affected_alerts']) can be found in the report.
E Check expected_vulnerability_mitigated_alert failed. Evidences (['missing_mitigated_alerts']) can be found in the report.
E Check setup_operation_results failed. Evidences (['setup_failed_agents']) can be found in the report.
E Check no_duplicated_vulnerabilities succeeded
E -----
E
E assert False
E + where False = <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf53e46550>>()
E + where <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf53e46550>> = <wazuh_testing.end_to_end.TestResult object at 0x7fdf53e46550>.get_test_result

end_to_end/test_vulnerability_detector/test_vulnerability_detector.py:1009: AssertionError
-------------------------------Captured log setup-------------------------------
CRITICAL root:conftest.py:312 Preconditions finished. Results: {'agent6': True, 'agent5': True, 'agent4': True, 'agent3': True, 'agent1': True, 'agent2': True} CRITICAL root:check_validators.py:123 Vulnerabilities affected not found: {'agent2': [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.0.1', architecture='x86_64')]} CRITICAL root:check_validators.py:124 Vulnerabilities mitigated not found: {} CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent2: Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.0.1', architecture='x86_64') CRITICAL root:check_validators.py:50 Vulnerabilities not found: {'agent1': [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='x86_64')], 'agent4': [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.5-1', architecture='arm64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.5-1', architecture='arm64')], 'agent2': [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.0.1', architecture='x86_64')]} CRITICAL root:check_validators.py:51 Vulnerabilities unexpected: {}
-------------------------------Captured log call--------------------------------
ERROR root:__init__.py:237 Marked check setup_operation_results result to False with evidences ['setup_failed_agents'] CRITICAL root:test_vulnerability_detector.py:919 Remote operation results: {'agent6': True, 'agent5': True, 'agent3': True, 'agent4': True, 'agent1': True, 'agent2': True} ERROR root:__init__.py:237 Marked check operation_successfull_for_all_agents result to True with evidences ['operation_results'] CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.6-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.6-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.6-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.6-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.6-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.6-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.6-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.6-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.6-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.6-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.6-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.6-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.6-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.6-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.6-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.6-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.6-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.6-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.6-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.6-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.6-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.6-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.6-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.6-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.6-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.6-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.6-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.6-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.6-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.6-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.6-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.6-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.6-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.6-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.6-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.6-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent2: Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.1.0', architecture='x86_64') CRITICAL root:check_validators.py:50 Vulnerabilities not found: {'agent1': [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.6-1', architecture='x86_64')], 'agent4': [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.6-1', architecture='arm64')], 'agent2': [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.1.0', architecture='x86_64')]} CRITICAL root:check_validators.py:51 Vulnerabilities unexpected: {} ERROR root:__init__.py:237 Marked check no_duplicated_vulnerabilities result to True with evidences ['duplicated_vulnerabilities', 'vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:946 Validating found vulnerabilities CRITICAL root:check_validators.py:145 agent1 is not empty: [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.6-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.6-1', architecture='x86_64')] CRITICAL root:check_validators.py:145 agent4 is not empty: [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31097', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31107', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='8.5.6-1', architecture='arm64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='8.5.6-1', architecture='arm64')] CRITICAL root:check_validators.py:145 agent2 is not empty: [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.1.0', architecture='x86_64')] ERROR root:__init__.py:237 Marked check expected_vulnerabilities_found_in_index result to False with evidences ['missing_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:956 Validating unexpected vulnerabilities ERROR root:__init__.py:237 Marked check no_unexpected_vulnerabilities_found_in_index result to True with evidences ['unexpected_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:check_validators.py:123 Vulnerabilities affected not found: {'agent2': [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.1.0', architecture='x86_64')]} CRITICAL root:check_validators.py:124 Vulnerabilities mitigated not found: {'agent2': [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.0.1', architecture='x86_64')]} CRITICAL root:test_vulnerability_detector.py:975 Validating found alerts CRITICAL root:check_validators.py:145 agent2 is not empty: [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.1.0', architecture='x86_64')] ERROR root:__init__.py:237 Marked check expected_vulnerability_affected_alert result to False with evidences ['missing_affected_alerts', 'alerts_found_in_index', 'expected_alerts'] CRITICAL root:test_vulnerability_detector.py:988 Validating unexpected alerts CRITICAL root:check_validators.py:145 agent2 is not empty: [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.0.1', architecture='x86_64')] ERROR root:__init__.py:237 Marked check expected_vulnerability_mitigated_alert result to False with evidences ['missing_mitigated_alerts', 'alerts_found_in_index', 'expected_alerts'] ERROR root:__init__.py:237 Marked check no_errors result to True with evidences ['error_level_messages']
-----------------------------Captured log teardown------------------------------
ERROR root:conftest.py:152 Truncate managers and agents logs
Failed test_vulnerability_detector/test_vulnerability_detector.py::TestScanSyscollectorCases::test_vulnerability_detector_scans_cases[upgrade_package_add_vulnerability] 1396.75

Test function details

Extended Summary

Parameters

self = <test_vulnerability_detector.TestScanSyscollectorCases object at 0x7fdf6b835b20>
request = <FixtureRequest for <Function test_vulnerability_detector_scans_cases[upgrade_package_add_vulnerability]>>
preconditions = {'operation': 'install_package', 'package': {'macos': {'amd64': 'axios-0.6.0', 'arm64v8': 'axios-0.6.0'}}, 'target_os': ['macos']}
body = {'operation': 'update_package', 'package': {'from': {'centos': {'amd64': 'grafana-8.5.6-1', 'arm64v8': 'grafana-8.5.6-...ios-0.10.0'}, 'ubuntu': {'amd64': 'grafana-9.1.1', 'arm64v8': 'grafana-9.1.1'}, 'windows': {'amd64': 'node-v18.0.0'}}}}
teardown = None, setup = []
host_manager = <wazuh_testing.tools.system.HostManager object at 0x7fdf6b835040>
record_property = <function record_property.<locals>.append_property at 0x7fdf68e9a3a0>
clean_environment_logs = None, delete_states_vulnerability_index = None
clean_environment_logs_function = None

@pytest.mark.parametrize("preconditions, body, teardown", complete_list, ids=list_ids)
def test_vulnerability_detector_scans_cases(self, request, preconditions, body, teardown, setup, host_manager,
record_property, clean_environment_logs,
delete_states_vulnerability_index,
clean_environment_logs_function):
# Is mandatory to launch this test along with the first scan test'
global AGENTS_SCANNED_FIRST_SCAN
if len(AGENTS_SCANNED_FIRST_SCAN) == 0:
pytest.skip("No agent was scanned in the first scan. Skipping test.")

target_to_ignore = list(
set(host_manager.get_group_hosts("agent")) - set(AGENTS_SCANNED_FIRST_SCAN)
)

utc_now_timestamp = datetime.datetime.now(datetime.timezone.utc)
test_timestamp = utc_now_timestamp.strftime("%Y-%m-%dT%H:%M:%S")

test_result = TestResult(request.node.name)
test_result.add_check(self.no_errors_check)
test_result.add_check(self.operation_successfull_for_all_agents_check)
test_result.add_check(self.expected_vulnerabilities_found_in_index_check)
test_result.add_check(self.no_unexpected_vulnerabilities_found_in_index_check)
test_result.add_check(self.expected_vulnerability_affected_alert_check)
test_result.add_check(self.expected_vulnerability_mitigated_alert_check)
test_result.add_check(self.setup_successfull_for_all_agents_check)
test_result.add_check(self.no_duplicated_vulnerabilities_check)

record_property("test_result", test_result)

agents_failed_setup = setup
test_result.validate_check("setup_operation_results", [Evidence("setup_failed_agents", agents_failed_setup)])

# Install Vulnerable package
operations_result = launch_parallel_operations(
body, host_manager, target_to_ignore
)

logging.critical(f"Remote operation results: {operations_result}")
test_result.validate_check(
"operation_successfull_for_all_agents",
[Evidence("operation_results", operations_result)],
)
# Wait for syscollector and VD scan
time.sleep(VD_E2E_TIMEOUT_SYSCOLLECTOR_SCAN + PACKAGE_VULNERABILITY_SCAN_TIME * len(AGENTS_SCANNED_FIRST_SCAN))

if "to" in body["package"]:
package_data = [body["package"]["to"], body["package"]["from"]]
else:
package_data = [body["package"]]

vulnerabilities = get_vulnerabilities_index(host_manager, AGENTS_SCANNED_FIRST_SCAN, package_data)
expected_vulnerabilities = get_expected_index(host_manager, AGENTS_SCANNED_FIRST_SCAN,
body["operation"], body["package"])
duplicated_vulnerabilities = get_duplicated_vulnerabilities(vulnerabilities)

result = compare_expected_found_vulnerabilities(vulnerabilities, expected_vulnerabilities)
vulnerabilities_not_found = result["vulnerabilities_not_found"]
vulnerabilities_unexpected = result["vulnerabilities_unexpected"]

test_result.validate_check('no_duplicated_vulnerabilities',
[Evidence('duplicated_vulnerabilities', duplicated_vulnerabilities),
Evidence('vulnerabilities', vulnerabilities)
])

logging.critical("Validating found vulnerabilities")
test_result.validate_check(
"expected_vulnerabilities_found_in_index",
[
Evidence("missing_vulnerabilities", vulnerabilities_not_found),
Evidence("vulnerabilities_found_in_index", vulnerabilities),
Evidence("expected_vulnerabilities", expected_vulnerabilities),
],
)

logging.critical("Validating unexpected vulnerabilities")
test_result.validate_check(
"no_unexpected_vulnerabilities_found_in_index",
[
Evidence("unexpected_vulnerabilities", vulnerabilities_unexpected),
Evidence("vulnerabilities_found_in_index", vulnerabilities),
Evidence("expected_vulnerabilities", expected_vulnerabilities),
],
)

alerts = get_vulnerability_alerts(host_manager, AGENTS_SCANNED_FIRST_SCAN, package_data, test_timestamp)
expected_alerts = get_expected_alerts(
host_manager, AGENTS_SCANNED_FIRST_SCAN, body["operation"], body["package"]
)

result_alert = compare_expected_found_vulnerabilities_alerts(
alerts, expected_alerts
)

logging.critical("Validating found alerts")
test_result.validate_check(
"expected_vulnerability_affected_alert",
[
Evidence(
"missing_affected_alerts",
result_alert["vulnerabilities_affected_not_found"],
),
Evidence("alerts_found_in_index", alerts),
Evidence("expected_alerts", expected_alerts),
],
)

logging.critical("Validating unexpected alerts")
test_result.validate_check(
"expected_vulnerability_mitigated_alert",
[
Evidence(
"missing_mitigated_alerts",
result_alert["vulnerabilities_mitigated_not_found"],
),
Evidence("alerts_found_in_index", alerts),
Evidence("expected_alerts", expected_alerts),
],
)

errors_environment = check_errors_in_environment(
host_manager,
expected_errors=VULNERABILITY_DETECTION_E2E_EXPECTED_ERRORS,
greater_than_timestamp=test_timestamp,
)

test_result.validate_check("no_errors", [Evidence("error_level_messages", errors_environment)])

> assert test_result.get_test_result(), test_result.report()
E AssertionError:
E Test test_vulnerability_detector_scans_cases[upgrade_package_add_vulnerability] failed
E
E Check no_errors succeeded
E Check operation_successfull_for_all_agents succeeded
E Check expected_vulnerabilities_found_in_index failed. Evidences (['missing_vulnerabilities']) can be found in the report.
E Check no_unexpected_vulnerabilities_found_in_index succeeded
E Check expected_vulnerability_affected_alert failed. Evidences (['missing_affected_alerts']) can be found in the report.
E Check expected_vulnerability_mitigated_alert failed. Evidences (['missing_mitigated_alerts']) can be found in the report.
E Check setup_operation_results succeeded
E Check no_duplicated_vulnerabilities succeeded
E -----
E
E assert False
E + where False = <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf53e71ac0>>()
E + where <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf53e71ac0>> = <wazuh_testing.end_to_end.TestResult object at 0x7fdf53e71ac0>.get_test_result

end_to_end/test_vulnerability_detector/test_vulnerability_detector.py:1009: AssertionError
-------------------------------Captured log setup-------------------------------
CRITICAL root:conftest.py:312 Preconditions finished. Results: {'agent6': True}
-------------------------------Captured log call--------------------------------
ERROR root:__init__.py:237 Marked check setup_operation_results result to True with evidences ['setup_failed_agents'] CRITICAL root:test_vulnerability_detector.py:919 Remote operation results: {'agent6': True, 'agent5': True, 'agent3': True, 'agent4': True, 'agent1': True, 'agent2': True} ERROR root:__init__.py:237 Marked check operation_successfull_for_all_agents result to True with evidences ['operation_results'] CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-1387', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-1387', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent2: Vulnerability(cve='CVE-2022-32223', package_name='Node.js', package_version='18.0.0', architecture='x86_64') CRITICAL root:check_validators.py:50 Vulnerabilities not found: {'agent1': [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-1387', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='9.1.1-1', architecture='x86_64')], 'agent4': [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2023-1387', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='9.1.1-1', architecture='arm64')], 'agent2': [Vulnerability(cve='CVE-2022-32223', package_name='Node.js', package_version='18.0.0', architecture='x86_64')]} CRITICAL root:check_validators.py:51 Vulnerabilities unexpected: {} ERROR root:__init__.py:237 Marked check no_duplicated_vulnerabilities result to True with evidences ['duplicated_vulnerabilities', 'vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:946 Validating found vulnerabilities CRITICAL root:check_validators.py:145 agent1 is not empty: [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-1387', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='9.1.1-1', architecture='x86_64')] CRITICAL root:check_validators.py:145 agent4 is not empty: [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2023-1387', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='9.1.1-1', architecture='arm64')] CRITICAL root:check_validators.py:145 agent2 is not empty: [Vulnerability(cve='CVE-2022-32223', package_name='Node.js', package_version='18.0.0', architecture='x86_64')] ERROR root:__init__.py:237 Marked check expected_vulnerabilities_found_in_index result to False with evidences ['missing_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:956 Validating unexpected vulnerabilities ERROR root:__init__.py:237 Marked check no_unexpected_vulnerabilities_found_in_index result to True with evidences ['unexpected_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:check_validators.py:123 Vulnerabilities affected not found: {'agent2': [Vulnerability(cve='CVE-2022-32223', package_name='Node.js', package_version='18.0.0', architecture='x86_64')]} CRITICAL root:check_validators.py:124 Vulnerabilities mitigated not found: {'agent2': [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.1.0', architecture='x86_64')]} CRITICAL root:test_vulnerability_detector.py:975 Validating found alerts CRITICAL root:check_validators.py:145 agent2 is not empty: [Vulnerability(cve='CVE-2022-32223', package_name='Node.js', package_version='18.0.0', architecture='x86_64')] ERROR root:__init__.py:237 Marked check expected_vulnerability_affected_alert result to False with evidences ['missing_affected_alerts', 'alerts_found_in_index', 'expected_alerts'] CRITICAL root:test_vulnerability_detector.py:988 Validating unexpected alerts CRITICAL root:check_validators.py:145 agent2 is not empty: [Vulnerability(cve='CVE-2022-0778', package_name='Node.js', package_version='17.1.0', architecture='x86_64')] ERROR root:__init__.py:237 Marked check expected_vulnerability_mitigated_alert result to False with evidences ['missing_mitigated_alerts', 'alerts_found_in_index', 'expected_alerts'] ERROR root:__init__.py:237 Marked check no_errors result to True with evidences ['error_level_messages']
-----------------------------Captured log teardown------------------------------
ERROR root:conftest.py:152 Truncate managers and agents logs
Failed test_vulnerability_detector/test_vulnerability_detector.py::TestScanSyscollectorCases::test_vulnerability_detector_scans_cases[upgrade_package_maintain_add_vulnerability] 1396.65

Test function details

Extended Summary

Parameters

self = <test_vulnerability_detector.TestScanSyscollectorCases object at 0x7fdf6b835e80>
request = <FixtureRequest for <Function test_vulnerability_detector_scans_cases[upgrade_package_maintain_add_vulnerability]>>
preconditions = {'operation': 'install_package', 'package': {'macos': {'amd64': 'systeminformation-4.34.23', 'arm64v8': 'systeminformation-4.34.23'}}, 'target_os': ['macos']}
body = {'operation': 'update_package', 'package': {'from': {'centos': {'amd64': 'grafana-9.1.1-1', 'arm64v8': 'grafana-9.1.1-...tion-5.0.0'}, 'ubuntu': {'amd64': 'grafana-9.2.0', 'arm64v8': 'grafana-9.2.0'}, 'windows': {'amd64': 'node-v18.1.0'}}}}
teardown = None, setup = []
host_manager = <wazuh_testing.tools.system.HostManager object at 0x7fdf6b835040>
record_property = <function record_property.<locals>.append_property at 0x7fdf68e9c670>
clean_environment_logs = None, delete_states_vulnerability_index = None
clean_environment_logs_function = None

@pytest.mark.parametrize("preconditions, body, teardown", complete_list, ids=list_ids)
def test_vulnerability_detector_scans_cases(self, request, preconditions, body, teardown, setup, host_manager,
record_property, clean_environment_logs,
delete_states_vulnerability_index,
clean_environment_logs_function):
# Is mandatory to launch this test along with the first scan test'
global AGENTS_SCANNED_FIRST_SCAN
if len(AGENTS_SCANNED_FIRST_SCAN) == 0:
pytest.skip("No agent was scanned in the first scan. Skipping test.")

target_to_ignore = list(
set(host_manager.get_group_hosts("agent")) - set(AGENTS_SCANNED_FIRST_SCAN)
)

utc_now_timestamp = datetime.datetime.now(datetime.timezone.utc)
test_timestamp = utc_now_timestamp.strftime("%Y-%m-%dT%H:%M:%S")

test_result = TestResult(request.node.name)
test_result.add_check(self.no_errors_check)
test_result.add_check(self.operation_successfull_for_all_agents_check)
test_result.add_check(self.expected_vulnerabilities_found_in_index_check)
test_result.add_check(self.no_unexpected_vulnerabilities_found_in_index_check)
test_result.add_check(self.expected_vulnerability_affected_alert_check)
test_result.add_check(self.expected_vulnerability_mitigated_alert_check)
test_result.add_check(self.setup_successfull_for_all_agents_check)
test_result.add_check(self.no_duplicated_vulnerabilities_check)

record_property("test_result", test_result)

agents_failed_setup = setup
test_result.validate_check("setup_operation_results", [Evidence("setup_failed_agents", agents_failed_setup)])

# Install Vulnerable package
operations_result = launch_parallel_operations(
body, host_manager, target_to_ignore
)

logging.critical(f"Remote operation results: {operations_result}")
test_result.validate_check(
"operation_successfull_for_all_agents",
[Evidence("operation_results", operations_result)],
)
# Wait for syscollector and VD scan
time.sleep(VD_E2E_TIMEOUT_SYSCOLLECTOR_SCAN + PACKAGE_VULNERABILITY_SCAN_TIME * len(AGENTS_SCANNED_FIRST_SCAN))

if "to" in body["package"]:
package_data = [body["package"]["to"], body["package"]["from"]]
else:
package_data = [body["package"]]

vulnerabilities = get_vulnerabilities_index(host_manager, AGENTS_SCANNED_FIRST_SCAN, package_data)
expected_vulnerabilities = get_expected_index(host_manager, AGENTS_SCANNED_FIRST_SCAN,
body["operation"], body["package"])
duplicated_vulnerabilities = get_duplicated_vulnerabilities(vulnerabilities)

result = compare_expected_found_vulnerabilities(vulnerabilities, expected_vulnerabilities)
vulnerabilities_not_found = result["vulnerabilities_not_found"]
vulnerabilities_unexpected = result["vulnerabilities_unexpected"]

test_result.validate_check('no_duplicated_vulnerabilities',
[Evidence('duplicated_vulnerabilities', duplicated_vulnerabilities),
Evidence('vulnerabilities', vulnerabilities)
])

logging.critical("Validating found vulnerabilities")
test_result.validate_check(
"expected_vulnerabilities_found_in_index",
[
Evidence("missing_vulnerabilities", vulnerabilities_not_found),
Evidence("vulnerabilities_found_in_index", vulnerabilities),
Evidence("expected_vulnerabilities", expected_vulnerabilities),
],
)

logging.critical("Validating unexpected vulnerabilities")
test_result.validate_check(
"no_unexpected_vulnerabilities_found_in_index",
[
Evidence("unexpected_vulnerabilities", vulnerabilities_unexpected),
Evidence("vulnerabilities_found_in_index", vulnerabilities),
Evidence("expected_vulnerabilities", expected_vulnerabilities),
],
)

alerts = get_vulnerability_alerts(host_manager, AGENTS_SCANNED_FIRST_SCAN, package_data, test_timestamp)
expected_alerts = get_expected_alerts(
host_manager, AGENTS_SCANNED_FIRST_SCAN, body["operation"], body["package"]
)

result_alert = compare_expected_found_vulnerabilities_alerts(
alerts, expected_alerts
)

logging.critical("Validating found alerts")
test_result.validate_check(
"expected_vulnerability_affected_alert",
[
Evidence(
"missing_affected_alerts",
result_alert["vulnerabilities_affected_not_found"],
),
Evidence("alerts_found_in_index", alerts),
Evidence("expected_alerts", expected_alerts),
],
)

logging.critical("Validating unexpected alerts")
test_result.validate_check(
"expected_vulnerability_mitigated_alert",
[
Evidence(
"missing_mitigated_alerts",
result_alert["vulnerabilities_mitigated_not_found"],
),
Evidence("alerts_found_in_index", alerts),
Evidence("expected_alerts", expected_alerts),
],
)

errors_environment = check_errors_in_environment(
host_manager,
expected_errors=VULNERABILITY_DETECTION_E2E_EXPECTED_ERRORS,
greater_than_timestamp=test_timestamp,
)

test_result.validate_check("no_errors", [Evidence("error_level_messages", errors_environment)])

> assert test_result.get_test_result(), test_result.report()
E AssertionError:
E Test test_vulnerability_detector_scans_cases[upgrade_package_maintain_add_vulnerability] failed
E
E Check no_errors succeeded
E Check operation_successfull_for_all_agents succeeded
E Check expected_vulnerabilities_found_in_index failed. Evidences (['missing_vulnerabilities']) can be found in the report.
E Check no_unexpected_vulnerabilities_found_in_index succeeded
E Check expected_vulnerability_affected_alert succeeded
E Check expected_vulnerability_mitigated_alert failed. Evidences (['missing_mitigated_alerts']) can be found in the report.
E Check setup_operation_results succeeded
E Check no_duplicated_vulnerabilities succeeded
E -----
E
E assert False
E + where False = <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf6b4e3a90>>()
E + where <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf6b4e3a90>> = <wazuh_testing.end_to_end.TestResult object at 0x7fdf6b4e3a90>.get_test_result

end_to_end/test_vulnerability_detector/test_vulnerability_detector.py:1009: AssertionError
-------------------------------Captured log setup-------------------------------
CRITICAL root:conftest.py:312 Preconditions finished. Results: {'agent6': True}
-------------------------------Captured log call--------------------------------
ERROR root:__init__.py:237 Marked check setup_operation_results result to True with evidences ['setup_failed_agents'] CRITICAL root:test_vulnerability_detector.py:919 Remote operation results: {'agent6': True, 'agent5': True, 'agent3': True, 'agent4': True, 'agent1': True, 'agent2': True} ERROR root:__init__.py:237 Marked check operation_successfull_for_all_agents result to True with evidences ['operation_results'] CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='9.2.0-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='9.2.0-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='9.2.0-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='9.2.0-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='9.2.0-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39328', package_name='grafana', package_version='9.2.0-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='9.2.0-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='9.2.0-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-1387', package_name='grafana', package_version='9.2.0-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='9.2.0-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='9.2.0-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-22462', package_name='grafana', package_version='9.2.0-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='9.2.0-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='9.2.0-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='9.2.0-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='9.2.0-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='9.2.0-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='9.2.0-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39328', package_name='grafana', package_version='9.2.0-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='9.2.0-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='9.2.0-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-1387', package_name='grafana', package_version='9.2.0-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='9.2.0-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='9.2.0-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-22462', package_name='grafana', package_version='9.2.0-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='9.2.0-1', architecture='arm64') CRITICAL root:check_validators.py:50 Vulnerabilities not found: {'agent1': [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39328', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-1387', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-22462', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='9.2.0-1', architecture='x86_64')], 'agent4': [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39328', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2023-1387', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2023-22462', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='9.2.0-1', architecture='arm64')]} CRITICAL root:check_validators.py:51 Vulnerabilities unexpected: {} ERROR root:__init__.py:237 Marked check no_duplicated_vulnerabilities result to True with evidences ['duplicated_vulnerabilities', 'vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:946 Validating found vulnerabilities CRITICAL root:check_validators.py:145 agent1 is not empty: [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39328', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-1387', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-22462', package_name='grafana', package_version='9.2.0-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='9.2.0-1', architecture='x86_64')] CRITICAL root:check_validators.py:145 agent4 is not empty: [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39328', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0507', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2023-0594', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2023-1387', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2023-1410', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2023-22462', package_name='grafana', package_version='9.2.0-1', architecture='arm64'), Vulnerability(cve='CVE-2023-3128', package_name='grafana', package_version='9.2.0-1', architecture='arm64')] ERROR root:__init__.py:237 Marked check expected_vulnerabilities_found_in_index result to False with evidences ['missing_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:956 Validating unexpected vulnerabilities ERROR root:__init__.py:237 Marked check no_unexpected_vulnerabilities_found_in_index result to True with evidences ['unexpected_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:check_validators.py:123 Vulnerabilities affected not found: {} CRITICAL root:check_validators.py:124 Vulnerabilities mitigated not found: {'agent2': [Vulnerability(cve='CVE-2022-32223', package_name='Node.js', package_version='18.0.0', architecture='x86_64')]} CRITICAL root:test_vulnerability_detector.py:975 Validating found alerts ERROR root:__init__.py:237 Marked check expected_vulnerability_affected_alert result to True with evidences ['missing_affected_alerts', 'alerts_found_in_index', 'expected_alerts'] CRITICAL root:test_vulnerability_detector.py:988 Validating unexpected alerts CRITICAL root:check_validators.py:145 agent2 is not empty: [Vulnerability(cve='CVE-2022-32223', package_name='Node.js', package_version='18.0.0', architecture='x86_64')] ERROR root:__init__.py:237 Marked check expected_vulnerability_mitigated_alert result to False with evidences ['missing_mitigated_alerts', 'alerts_found_in_index', 'expected_alerts'] ERROR root:__init__.py:237 Marked check no_errors result to True with evidences ['error_level_messages']
-----------------------------Captured log teardown------------------------------
ERROR root:conftest.py:152 Truncate managers and agents logs
Failed test_vulnerability_detector/test_vulnerability_detector.py::TestScanSyscollectorCases::test_vulnerability_detector_scans_cases[upgrade_package_nonvulnerable_to_vulnerable] 3069.48

Test function details

Extended Summary

Parameters

self = <test_vulnerability_detector.TestScanSyscollectorCases object at 0x7fdf6b835e50>
request = <FixtureRequest for <Function test_vulnerability_detector_scans_cases[upgrade_package_nonvulnerable_to_vulnerable]>>
preconditions = {'operation': 'install_package', 'package': {'centos': {'amd64': 'grafana-8.5.27-1', 'arm64v8': 'grafana-8.5.27-1'}, '...5.2'}, 'ubuntu': {'amd64': 'grafana-8.5.27', 'arm64v8': 'grafana-8.5.27'}}, 'target_os': ['centos', 'ubuntu', 'macos']}
body = {'operation': 'update_package', 'package': {'from': {'centos': {'amd64': 'grafana-8.5.27-1', 'arm64v8': 'grafana-8.5.2...uxon-3.0.0'}, 'ubuntu': {'amd64': 'grafana-9.1.1', 'arm64v8': 'grafana-9.1.1'}, 'windows': {'amd64': 'node-v20.5.1'}}}}
teardown = {'operation': 'remove_package', 'package': {'centos': {'amd64': 'grafana-9.1.1-1', 'arm64v8': 'grafana-9.1.1-1'}, 'mac...m64v8': 'grafana-9.1.1'}, 'windows': {'amd64': 'node-v20.5.1'}}, 'target_os': ['centos', 'ubuntu', 'macos', 'windows']}
setup = ['agent3', 'agent5']
host_manager = <wazuh_testing.tools.system.HostManager object at 0x7fdf6b835040>
record_property = <function record_property.<locals>.append_property at 0x7fdf6814dee0>
clean_environment_logs = None, delete_states_vulnerability_index = None
clean_environment_logs_function = None

@pytest.mark.parametrize("preconditions, body, teardown", complete_list, ids=list_ids)
def test_vulnerability_detector_scans_cases(self, request, preconditions, body, teardown, setup, host_manager,
record_property, clean_environment_logs,
delete_states_vulnerability_index,
clean_environment_logs_function):
# Is mandatory to launch this test along with the first scan test'
global AGENTS_SCANNED_FIRST_SCAN
if len(AGENTS_SCANNED_FIRST_SCAN) == 0:
pytest.skip("No agent was scanned in the first scan. Skipping test.")

target_to_ignore = list(
set(host_manager.get_group_hosts("agent")) - set(AGENTS_SCANNED_FIRST_SCAN)
)

utc_now_timestamp = datetime.datetime.now(datetime.timezone.utc)
test_timestamp = utc_now_timestamp.strftime("%Y-%m-%dT%H:%M:%S")

test_result = TestResult(request.node.name)
test_result.add_check(self.no_errors_check)
test_result.add_check(self.operation_successfull_for_all_agents_check)
test_result.add_check(self.expected_vulnerabilities_found_in_index_check)
test_result.add_check(self.no_unexpected_vulnerabilities_found_in_index_check)
test_result.add_check(self.expected_vulnerability_affected_alert_check)
test_result.add_check(self.expected_vulnerability_mitigated_alert_check)
test_result.add_check(self.setup_successfull_for_all_agents_check)
test_result.add_check(self.no_duplicated_vulnerabilities_check)

record_property("test_result", test_result)

agents_failed_setup = setup
test_result.validate_check("setup_operation_results", [Evidence("setup_failed_agents", agents_failed_setup)])

# Install Vulnerable package
operations_result = launch_parallel_operations(
body, host_manager, target_to_ignore
)

logging.critical(f"Remote operation results: {operations_result}")
test_result.validate_check(
"operation_successfull_for_all_agents",
[Evidence("operation_results", operations_result)],
)
# Wait for syscollector and VD scan
time.sleep(VD_E2E_TIMEOUT_SYSCOLLECTOR_SCAN + PACKAGE_VULNERABILITY_SCAN_TIME * len(AGENTS_SCANNED_FIRST_SCAN))

if "to" in body["package"]:
package_data = [body["package"]["to"], body["package"]["from"]]
else:
package_data = [body["package"]]

vulnerabilities = get_vulnerabilities_index(host_manager, AGENTS_SCANNED_FIRST_SCAN, package_data)
expected_vulnerabilities = get_expected_index(host_manager, AGENTS_SCANNED_FIRST_SCAN,
body["operation"], body["package"])
duplicated_vulnerabilities = get_duplicated_vulnerabilities(vulnerabilities)

result = compare_expected_found_vulnerabilities(vulnerabilities, expected_vulnerabilities)
vulnerabilities_not_found = result["vulnerabilities_not_found"]
vulnerabilities_unexpected = result["vulnerabilities_unexpected"]

test_result.validate_check('no_duplicated_vulnerabilities',
[Evidence('duplicated_vulnerabilities', duplicated_vulnerabilities),
Evidence('vulnerabilities', vulnerabilities)
])

logging.critical("Validating found vulnerabilities")
test_result.validate_check(
"expected_vulnerabilities_found_in_index",
[
Evidence("missing_vulnerabilities", vulnerabilities_not_found),
Evidence("vulnerabilities_found_in_index", vulnerabilities),
Evidence("expected_vulnerabilities", expected_vulnerabilities),
],
)

logging.critical("Validating unexpected vulnerabilities")
test_result.validate_check(
"no_unexpected_vulnerabilities_found_in_index",
[
Evidence("unexpected_vulnerabilities", vulnerabilities_unexpected),
Evidence("vulnerabilities_found_in_index", vulnerabilities),
Evidence("expected_vulnerabilities", expected_vulnerabilities),
],
)

alerts = get_vulnerability_alerts(host_manager, AGENTS_SCANNED_FIRST_SCAN, package_data, test_timestamp)
expected_alerts = get_expected_alerts(
host_manager, AGENTS_SCANNED_FIRST_SCAN, body["operation"], body["package"]
)

result_alert = compare_expected_found_vulnerabilities_alerts(
alerts, expected_alerts
)

logging.critical("Validating found alerts")
test_result.validate_check(
"expected_vulnerability_affected_alert",
[
Evidence(
"missing_affected_alerts",
result_alert["vulnerabilities_affected_not_found"],
),
Evidence("alerts_found_in_index", alerts),
Evidence("expected_alerts", expected_alerts),
],
)

logging.critical("Validating unexpected alerts")
test_result.validate_check(
"expected_vulnerability_mitigated_alert",
[
Evidence(
"missing_mitigated_alerts",
result_alert["vulnerabilities_mitigated_not_found"],
),
Evidence("alerts_found_in_index", alerts),
Evidence("expected_alerts", expected_alerts),
],
)

errors_environment = check_errors_in_environment(
host_manager,
expected_errors=VULNERABILITY_DETECTION_E2E_EXPECTED_ERRORS,
greater_than_timestamp=test_timestamp,
)

test_result.validate_check("no_errors", [Evidence("error_level_messages", errors_environment)])

> assert test_result.get_test_result(), test_result.report()
E AssertionError:
E Test test_vulnerability_detector_scans_cases[upgrade_package_nonvulnerable_to_vulnerable] failed
E
E Check no_errors succeeded
E Check operation_successfull_for_all_agents succeeded
E Check expected_vulnerabilities_found_in_index failed. Evidences (['missing_vulnerabilities']) can be found in the report.
E Check no_unexpected_vulnerabilities_found_in_index succeeded
E Check expected_vulnerability_affected_alert succeeded
E Check expected_vulnerability_mitigated_alert succeeded
E Check setup_operation_results failed. Evidences (['setup_failed_agents']) can be found in the report.
E Check no_duplicated_vulnerabilities succeeded
E -----
E
E assert False
E + where False = <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf698e52e0>>()
E + where <bound method TestResult.get_test_result of <wazuh_testing.end_to_end.TestResult object at 0x7fdf698e52e0>> = <wazuh_testing.end_to_end.TestResult object at 0x7fdf698e52e0>.get_test_result

end_to_end/test_vulnerability_detector/test_vulnerability_detector.py:1009: AssertionError
-------------------------------Captured log setup-------------------------------
CRITICAL root:conftest.py:312 Preconditions finished. Results: {'agent6': True, 'agent5': True, 'agent4': True, 'agent3': True, 'agent1': True} CRITICAL root:check_validators.py:41 Vulnerability unexpected found for agent3: Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.27', architecture='x86_64') CRITICAL root:check_validators.py:41 Vulnerability unexpected found for agent5: Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.27', architecture='arm64') CRITICAL root:check_validators.py:50 Vulnerabilities not found: {} CRITICAL root:check_validators.py:51 Vulnerabilities unexpected: {'agent3': [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.27', architecture='x86_64')], 'agent5': [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='8.5.27', architecture='arm64')]}
-------------------------------Captured log call--------------------------------
ERROR root:__init__.py:237 Marked check setup_operation_results result to False with evidences ['setup_failed_agents'] CRITICAL root:test_vulnerability_detector.py:919 Remote operation results: {'agent6': True, 'agent5': True, 'agent3': True, 'agent4': True, 'agent1': True, 'agent2': True} ERROR root:__init__.py:237 Marked check operation_successfull_for_all_agents result to True with evidences ['operation_results'] CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-1387', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent1: Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='9.1.1-1', architecture='x86_64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-1387', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:30 Vulnerability not found for agent4: Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='9.1.1-1', architecture='arm64') CRITICAL root:check_validators.py:50 Vulnerabilities not found: {'agent1': [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-1387', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='9.1.1-1', architecture='x86_64')], 'agent4': [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2023-1387', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='9.1.1-1', architecture='arm64')]} CRITICAL root:check_validators.py:51 Vulnerabilities unexpected: {} ERROR root:__init__.py:237 Marked check no_duplicated_vulnerabilities result to True with evidences ['duplicated_vulnerabilities', 'vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:946 Validating found vulnerabilities CRITICAL root:check_validators.py:145 agent1 is not empty: [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-1387', package_name='grafana', package_version='9.1.1-1', architecture='x86_64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='9.1.1-1', architecture='x86_64')] CRITICAL root:check_validators.py:145 agent4 is not empty: [Vulnerability(cve='CVE-2022-23498', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-23552', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31123', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-31130', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-35957', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-36062', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39201', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39229', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39306', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39307', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2022-39324', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2023-1387', package_name='grafana', package_version='9.1.1-1', architecture='arm64'), Vulnerability(cve='CVE-2023-2183', package_name='grafana', package_version='9.1.1-1', architecture='arm64')] ERROR root:__init__.py:237 Marked check expected_vulnerabilities_found_in_index result to False with evidences ['missing_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:956 Validating unexpected vulnerabilities ERROR root:__init__.py:237 Marked check no_unexpected_vulnerabilities_found_in_index result to True with evidences ['unexpected_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:975 Validating found alerts ERROR root:__init__.py:237 Marked check expected_vulnerability_affected_alert result to True with evidences ['missing_affected_alerts', 'alerts_found_in_index', 'expected_alerts'] CRITICAL root:test_vulnerability_detector.py:988 Validating unexpected alerts ERROR root:__init__.py:237 Marked check expected_vulnerability_mitigated_alert result to True with evidences ['missing_mitigated_alerts', 'alerts_found_in_index', 'expected_alerts'] ERROR root:__init__.py:237 Marked check no_errors result to True with evidences ['error_level_messages']
-----------------------------Captured log teardown------------------------------
ERROR root:conftest.py:152 Truncate managers and agents logs CRITICAL root:conftest.py:353 Running teardown for agent: ['agent1', 'agent3', 'agent4', 'agent5', 'agent6', 'agent2'] CRITICAL root:conftest.py:356 Teardown Results: {'agent6': True, 'agent4': True, 'agent1': True, 'agent5': True, 'agent3': True, 'agent2': True}
Passed test_vulnerability_detector/test_vulnerability_detector.py::TestInitialScans::test_syscollector_second_scan description: Validates the initiation of the second Syscollector scans across all agents in the environment. 146.12

Test function details

Extended Summary

This test ensures that Syscollector second scans are started in all agents in the environment.
tier: 0
parameters:
- request: pytest request object
- host_manager:
type: fixture
brief: Get the host manager of the environment
- setup_vulnerability_tests:
type: fixture
brief: Setup the environment to proceed with the testing
- get_results: fixture to get the results of global class tests
assertions:
- Verify that all agents has been scanned
cases: None
tags:
- syscollector
- vulnerability_detector

Parameters

-------------------------------Captured log call--------------------------------
ERROR root:__init__.py:237 Marked check all_agents_scanned_syscollector_second_scan result to True with evidences ['agents_not_scanned_syscollector_second_scan'] CRITICAL root:test_vulnerability_detector.py:499 Waiting until agent all agents have been scanned. CRITICAL root:test_vulnerability_detector.py:504 Checking vulnerabilities in the index CRITICAL root:test_vulnerability_detector.py:509 Checking that all agents has been scanned and generated vulnerabilities in the index ERROR root:__init__.py:237 Marked check vulnerabilities_consistent_first_second_scan result to True with evidences ['vulnerabilities_index_first_scan', 'vulnerabilities_index_second_scan'] ERROR root:__init__.py:237 Marked check no_errors result to True with evidences ['error_level_messages']
Passed test_vulnerability_detector/test_vulnerability_detector.py::TestScanSyscollectorCases::test_vulnerability_detector_scans_cases[upgrade_package_remove_vulnerability] 1114.86

Test function details

Extended Summary

Parameters

-------------------------------Captured log call--------------------------------
ERROR root:__init__.py:237 Marked check setup_operation_results result to True with evidences ['setup_failed_agents'] CRITICAL root:test_vulnerability_detector.py:919 Remote operation results: {'agent6': True, 'agent4': True, 'agent5': True, 'agent1': True, 'agent3': True, 'agent2': True} ERROR root:__init__.py:237 Marked check operation_successfull_for_all_agents result to True with evidences ['operation_results'] ERROR root:__init__.py:237 Marked check no_duplicated_vulnerabilities result to True with evidences ['duplicated_vulnerabilities', 'vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:946 Validating found vulnerabilities ERROR root:__init__.py:237 Marked check expected_vulnerabilities_found_in_index result to True with evidences ['missing_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:956 Validating unexpected vulnerabilities ERROR root:__init__.py:237 Marked check no_unexpected_vulnerabilities_found_in_index result to True with evidences ['unexpected_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:975 Validating found alerts ERROR root:__init__.py:237 Marked check expected_vulnerability_affected_alert result to True with evidences ['missing_affected_alerts', 'alerts_found_in_index', 'expected_alerts'] CRITICAL root:test_vulnerability_detector.py:988 Validating unexpected alerts ERROR root:__init__.py:237 Marked check expected_vulnerability_mitigated_alert result to True with evidences ['missing_mitigated_alerts', 'alerts_found_in_index', 'expected_alerts'] ERROR root:__init__.py:237 Marked check no_errors result to True with evidences ['error_level_messages']
-----------------------------Captured log teardown------------------------------
ERROR root:conftest.py:152 Truncate managers and agents logs
Passed test_vulnerability_detector/test_vulnerability_detector.py::TestScanSyscollectorCases::test_vulnerability_detector_scans_cases[upgrade_package_nonvulnerable_to_nonvulnerable] 1863.09

Test function details

Extended Summary

Parameters

-------------------------------Captured log call--------------------------------
ERROR root:__init__.py:237 Marked check setup_operation_results result to True with evidences ['setup_failed_agents'] CRITICAL root:test_vulnerability_detector.py:919 Remote operation results: {'agent6': True, 'agent3': True, 'agent5': True, 'agent4': True, 'agent1': True, 'agent2': True} ERROR root:__init__.py:237 Marked check operation_successfull_for_all_agents result to True with evidences ['operation_results'] ERROR root:__init__.py:237 Marked check no_duplicated_vulnerabilities result to True with evidences ['duplicated_vulnerabilities', 'vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:946 Validating found vulnerabilities ERROR root:__init__.py:237 Marked check expected_vulnerabilities_found_in_index result to True with evidences ['missing_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:956 Validating unexpected vulnerabilities ERROR root:__init__.py:237 Marked check no_unexpected_vulnerabilities_found_in_index result to True with evidences ['unexpected_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:975 Validating found alerts ERROR root:__init__.py:237 Marked check expected_vulnerability_affected_alert result to True with evidences ['missing_affected_alerts', 'alerts_found_in_index', 'expected_alerts'] CRITICAL root:test_vulnerability_detector.py:988 Validating unexpected alerts ERROR root:__init__.py:237 Marked check expected_vulnerability_mitigated_alert result to True with evidences ['missing_mitigated_alerts', 'alerts_found_in_index', 'expected_alerts'] ERROR root:__init__.py:237 Marked check no_errors result to True with evidences ['error_level_messages']
-----------------------------Captured log teardown------------------------------
ERROR root:conftest.py:152 Truncate managers and agents logs CRITICAL root:conftest.py:353 Running teardown for agent: ['agent1', 'agent3', 'agent4', 'agent5'] CRITICAL root:conftest.py:356 Teardown Results: {'agent4': True, 'agent1': True, 'agent5': True, 'agent3': True}
Passed test_vulnerability_detector/test_vulnerability_detector.py::TestScanSyscollectorCases::test_vulnerability_detector_scans_cases[install_package_non_vulnerable] 1092.13

Test function details

Extended Summary

Parameters

-------------------------------Captured log call--------------------------------
ERROR root:__init__.py:237 Marked check setup_operation_results result to True with evidences ['setup_failed_agents'] CRITICAL root:test_vulnerability_detector.py:919 Remote operation results: {'agent6': True, 'agent5': True, 'agent3': True, 'agent4': True, 'agent1': True, 'agent2': True} ERROR root:__init__.py:237 Marked check operation_successfull_for_all_agents result to True with evidences ['operation_results'] ERROR root:__init__.py:237 Marked check no_duplicated_vulnerabilities result to True with evidences ['duplicated_vulnerabilities', 'vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:946 Validating found vulnerabilities ERROR root:__init__.py:237 Marked check expected_vulnerabilities_found_in_index result to True with evidences ['missing_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:956 Validating unexpected vulnerabilities ERROR root:__init__.py:237 Marked check no_unexpected_vulnerabilities_found_in_index result to True with evidences ['unexpected_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:975 Validating found alerts ERROR root:__init__.py:237 Marked check expected_vulnerability_affected_alert result to True with evidences ['missing_affected_alerts', 'alerts_found_in_index', 'expected_alerts'] CRITICAL root:test_vulnerability_detector.py:988 Validating unexpected alerts ERROR root:__init__.py:237 Marked check expected_vulnerability_mitigated_alert result to True with evidences ['missing_mitigated_alerts', 'alerts_found_in_index', 'expected_alerts'] ERROR root:__init__.py:237 Marked check no_errors result to True with evidences ['error_level_messages']
-----------------------------Captured log teardown------------------------------
ERROR root:conftest.py:152 Truncate managers and agents logs
Passed test_vulnerability_detector/test_vulnerability_detector.py::TestScanSyscollectorCases::test_vulnerability_detector_scans_cases[remove_non_vulnerable_packge] 1116.04

Test function details

Extended Summary

Parameters

-------------------------------Captured log call--------------------------------
ERROR root:__init__.py:237 Marked check setup_operation_results result to True with evidences ['setup_failed_agents'] CRITICAL root:test_vulnerability_detector.py:919 Remote operation results: {'agent6': True, 'agent4': True, 'agent1': True, 'agent5': True, 'agent3': True, 'agent2': True} ERROR root:__init__.py:237 Marked check operation_successfull_for_all_agents result to True with evidences ['operation_results'] ERROR root:__init__.py:237 Marked check no_duplicated_vulnerabilities result to True with evidences ['duplicated_vulnerabilities', 'vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:946 Validating found vulnerabilities ERROR root:__init__.py:237 Marked check expected_vulnerabilities_found_in_index result to True with evidences ['missing_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:956 Validating unexpected vulnerabilities ERROR root:__init__.py:237 Marked check no_unexpected_vulnerabilities_found_in_index result to True with evidences ['unexpected_vulnerabilities', 'vulnerabilities_found_in_index', 'expected_vulnerabilities'] CRITICAL root:test_vulnerability_detector.py:975 Validating found alerts ERROR root:__init__.py:237 Marked check expected_vulnerability_affected_alert result to True with evidences ['missing_affected_alerts', 'alerts_found_in_index', 'expected_alerts'] CRITICAL root:test_vulnerability_detector.py:988 Validating unexpected alerts ERROR root:__init__.py:237 Marked check expected_vulnerability_mitigated_alert result to True with evidences ['missing_mitigated_alerts', 'alerts_found_in_index', 'expected_alerts'] ERROR root:__init__.py:237 Marked check no_errors result to True with evidences ['error_level_messages']
-----------------------------Captured log teardown------------------------------
ERROR root:conftest.py:152 Truncate managers and agents logs ERROR root:conftest.py:164 Delete vulnerability index ERROR root:conftest.py:138 Truncate managers and agents logs