marcelo@marcelo-B460-AORUS-PRO-AC:~$ systemctl --user start pipewire.service pipewire-pulse.service marcelo@marcelo-B460-AORUS-PRO-AC:~$ ps aux | grep pipewire marcelo 2008 0.3 0.0 120452 9856 ? S changed=false msg: 'Failed to connect to the host via ssh: ssh: connect to host ec2-3-80-51-50.compute-1.amazonaws.com port 2200: Connection refused' unreachable: true PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:05:59] [DEBUG] PROVISIONER: Playbook {'hosts': 'ec2-3-80-51-50.compute-1.amazonaws.com', 'become': True, 'gather_facts': True, 'tasks': [{'name': 'Capture ansible_os_family', 'set_fact': {'ansible_os_family': "{{ ansible_facts['distribution_file_variety'] }}", 'cacheable': 'yes'}}]} finished with status {'skipped': {}, 'ok': {}, 'dark': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:05:59] [DEBUG] PROVISIONER: OS family: None. [2024-04-18 20:05:59] [DEBUG] PROVISIONER: Render playbook with vars: {'component': 'wazuh-manager', 'version': '4.7.3', 'live': True, 'type': 'assistant', 'dependencies': None, 'templates_path': '/home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/playbooks/wazuh/assistant/install', 'templates_order': ['download.j2', 'install.j2'], 'ansible_os_family': ''}. [2024-04-18 20:05:59] [DEBUG] PROVISIONER: Templates found: ['download.j2', 'install.j2'] [2024-04-18 20:05:59] [DEBUG] PROVISIONER: Rendering template download.j2 [2024-04-18 20:05:59] [DEBUG] PROVISIONER: Rendering template install.j2 [2024-04-18 20:05:59] [DEBUG] PROVISIONER: [{'name': 'Install the required packages', 'shell': ''}, {'name': 'Download the Wazuh installation assistant', 'shell': 'curl -sO https://packages.wazuh.com/4.7/wazuh-install.sh'}, {'name': 'Install wazuh-manager with assistant', 'shell': 'bash ./wazuh-install.sh -a -i'}] [2024-04-18 20:05:59] [DEBUG] PROVISIONER: Tasks to execute: [{'name': 'Install the required packages', 'shell': ''}, {'name': 'Download the Wazuh installation assistant', 'shell': 'curl -sO https://packages.wazuh.com/4.7/wazuh-install.sh'}, {'name': 'Install wazuh-manager with assistant', 'shell': 'bash ./wazuh-install.sh -a -i'}]. [2024-04-18 20:05:59] [INFO] PROVISIONER: Execute install for wazuh-manager. [2024-04-18 20:05:59] [DEBUG] PROVISIONER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:05:59] [DEBUG] PROVISIONER: Running playbook: {'hosts': 'ec2-3-80-51-50.compute-1.amazonaws.com', 'become': True, 'gather_facts': True, 'tasks': [{'name': 'Install the required packages', 'shell': ''}, {'name': 'Download the Wazuh installation assistant', 'shell': 'curl -sO https://packages.wazuh.com/4.7/wazuh-install.sh'}, {'name': 'Install wazuh-manager with assistant', 'shell': 'bash ./wazuh-install.sh -a -i'}]} No config file found; using defaults PLAY [ec2-3-80-51-50.compute-1.amazonaws.com] ********************************** TASK [Gathering Facts] ********************************************************* fatal: [ec2-3-80-51-50.compute-1.amazonaws.com]: UNREACHABLE! => changed=false msg: 'Failed to connect to the host via ssh: ssh: connect to host ec2-3-80-51-50.compute-1.amazonaws.com port 2200: Connection refused' unreachable: true PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:06:00] [DEBUG] PROVISIONER: Playbook {'hosts': 'ec2-3-80-51-50.compute-1.amazonaws.com', 'become': True, 'gather_facts': True, 'tasks': [{'name': 'Install the required packages', 'shell': ''}, {'name': 'Download the Wazuh installation assistant', 'shell': 'curl -sO https://packages.wazuh.com/4.7/wazuh-install.sh'}, {'name': 'Install wazuh-manager with assistant', 'shell': 'bash ./wazuh-install.sh -a -i'}]} finished with status {'skipped': {}, 'ok': {}, 'dark': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:06:00] [INFO] PROVISIONER: Provision of "wazuh-manager" complete successfully. [2024-04-18 20:06:00] [INFO] PROVISIONER: All components provisioned successfully. [2024-04-18 20:06:00] [DEBUG] PROVISIONER: Provision summary: {'skipped': {}, 'ok': {}, 'dark': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:06:00] [INFO] [3958] [ThreadPoolExecutor-0_0] [workflow_engine]: [provision-manager-linux-ubuntu-22.04-amd64] Finished task in 2.15 seconds. [2024-04-18 20:06:00] [INFO] [3958] [ThreadPoolExecutor-0_0] [workflow_engine]: [allocate-agent-linux-ubuntu-18.04-amd64] Starting task. [2024-04-18 20:06:00] [DEBUG] [3958] [ThreadPoolExecutor-0_0] [workflow_engine]: Running task "allocate-agent-linux-ubuntu-18.04-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-ubuntu-18.04-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-18 20:06:00] [INFO] [3958] [ThreadPoolExecutor-0_1] [workflow_engine]: [allocate-agent-linux-ubuntu-20.04-amd64] Starting task. [2024-04-18 20:06:00] [DEBUG] [3958] [ThreadPoolExecutor-0_1] [workflow_engine]: Running task "allocate-agent-linux-ubuntu-20.04-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-ubuntu-20.04-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-18 20:06:00] [INFO] [3958] [ThreadPoolExecutor-0_2] [workflow_engine]: [allocate-agent-linux-ubuntu-22.04-amd64] Starting task. [2024-04-18 20:06:00] [DEBUG] [3958] [ThreadPoolExecutor-0_2] [workflow_engine]: Running task "allocate-agent-linux-ubuntu-22.04-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-ubuntu-22.04-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-18 20:06:00] [INFO] [3958] [ThreadPoolExecutor-0_3] [workflow_engine]: [allocate-agent-linux-debian-10-amd64] Starting task. [2024-04-18 20:06:00] [INFO] [3958] [ThreadPoolExecutor-0_4] [workflow_engine]: [allocate-agent-linux-debian-11-amd64] Starting task. [2024-04-18 20:06:00] [DEBUG] [3958] [ThreadPoolExecutor-0_3] [workflow_engine]: Running task "allocate-agent-linux-debian-10-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-debian-10-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-debian-10-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-18 20:06:00] [INFO] [3958] [ThreadPoolExecutor-0_5] [workflow_engine]: [allocate-agent-linux-debian-12-amd64] Starting task. [2024-04-18 20:06:00] [INFO] [3958] [ThreadPoolExecutor-0_6] [workflow_engine]: [allocate-agent-linux-oracle-9-amd64] Starting task. [2024-04-18 20:06:00] [DEBUG] [3958] [ThreadPoolExecutor-0_4] [workflow_engine]: Running task "allocate-agent-linux-debian-11-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-debian-11-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-debian-11-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-18 20:06:00] [INFO] [3958] [ThreadPoolExecutor-0_7] [workflow_engine]: [allocate-agent-linux-centos-7-amd64] Starting task. [2024-04-18 20:06:00] [INFO] [3958] [ThreadPoolExecutor-0_8] [workflow_engine]: [allocate-agent-linux-centos-8-amd64] Starting task. [2024-04-18 20:06:00] [DEBUG] [3958] [ThreadPoolExecutor-0_5] [workflow_engine]: Running task "allocate-agent-linux-debian-12-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-debian-12-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-debian-12-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-18 20:06:00] [DEBUG] [3958] [ThreadPoolExecutor-0_6] [workflow_engine]: Running task "allocate-agent-linux-oracle-9-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-oracle-9-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-oracle-9-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-18 20:06:00] [INFO] [3958] [ThreadPoolExecutor-0_9] [workflow_engine]: [allocate-agent-linux-redhat-7-amd64] Starting task. [2024-04-18 20:06:00] [INFO] [3958] [ThreadPoolExecutor-0_10] [workflow_engine]: [allocate-agent-linux-redhat-8-amd64] Starting task. [2024-04-18 20:06:00] [DEBUG] [3958] [ThreadPoolExecutor-0_7] [workflow_engine]: Running task "allocate-agent-linux-centos-7-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-centos-7-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-centos-7-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-18 20:06:00] [INFO] [3958] [ThreadPoolExecutor-0_11] [workflow_engine]: [allocate-agent-linux-redhat-9-amd64] Starting task. [2024-04-18 20:06:00] [DEBUG] [3958] [ThreadPoolExecutor-0_8] [workflow_engine]: Running task "allocate-agent-linux-centos-8-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-centos-8-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-centos-8-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-18 20:06:00] [DEBUG] [3958] [ThreadPoolExecutor-0_9] [workflow_engine]: Running task "allocate-agent-linux-redhat-7-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-redhat-7-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-redhat-7-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-18 20:06:00] [DEBUG] [3958] [ThreadPoolExecutor-0_10] [workflow_engine]: Running task "allocate-agent-linux-redhat-8-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-redhat-8-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-redhat-8-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-18 20:06:00] [DEBUG] [3958] [ThreadPoolExecutor-0_11] [workflow_engine]: Running task "allocate-agent-linux-redhat-9-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-redhat-9-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-redhat-9-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-18 20:06:22] [DEBUG] [3958] [ThreadPoolExecutor-0_5] [workflow_engine]: Finished task "allocate-agent-linux-debian-12-amd64" execution with result: [2024-04-18 20:06:01] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-3356DA0A-7EEF-4E57-BE4C-560B87CE586E [2024-04-18 20:06:20] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-3356DA0A-7EEF-4E57-BE4C-560B87CE586E directory to /tmp/wazuh-qa/i-0df106e158d201bb8 [2024-04-18 20:06:20] [INFO] ALLOCATOR: Instance i-0df106e158d201bb8 created. [2024-04-18 20:06:22] [INFO] ALLOCATOR: Instance i-0df106e158d201bb8 started. [2024-04-18 20:06:22] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml [2024-04-18 20:06:22] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-debian-12-amd64/track.yaml [2024-04-18 20:06:22] [INFO] [3958] [ThreadPoolExecutor-0_5] [workflow_engine]: [allocate-agent-linux-debian-12-amd64] Finished task in 21.75 seconds. [2024-04-18 20:06:22] [INFO] [3958] [ThreadPoolExecutor-0_5] [workflow_engine]: [allocate-agent-linux-amazon-2-amd64] Starting task. [2024-04-18 20:06:22] [DEBUG] [3958] [ThreadPoolExecutor-0_5] [workflow_engine]: Running task "allocate-agent-linux-amazon-2-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-amazon-2-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-amazon-2-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-18 20:06:22] [DEBUG] [3958] [ThreadPoolExecutor-0_11] [workflow_engine]: Finished task "allocate-agent-linux-redhat-9-amd64" execution with result: [2024-04-18 20:06:01] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-8FBF7A21-170B-49AE-BABE-46B0867B8F8B [2024-04-18 20:06:20] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-8FBF7A21-170B-49AE-BABE-46B0867B8F8B directory to /tmp/wazuh-qa/i-05b2bb35be65300a1 [2024-04-18 20:06:20] [INFO] ALLOCATOR: Instance i-05b2bb35be65300a1 created. [2024-04-18 20:06:22] [INFO] ALLOCATOR: Instance i-05b2bb35be65300a1 started. [2024-04-18 20:06:22] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml [2024-04-18 20:06:22] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-redhat-9-amd64/track.yaml [2024-04-18 20:06:22] [INFO] [3958] [ThreadPoolExecutor-0_11] [workflow_engine]: [allocate-agent-linux-redhat-9-amd64] Finished task in 21.71 seconds. [2024-04-18 20:06:22] [INFO] [3958] [ThreadPoolExecutor-0_11] [workflow_engine]: [run-agent-linux-debian-12-amd64-tests] Starting task. [2024-04-18 20:06:22] [DEBUG] [3958] [ThreadPoolExecutor-0_11] [workflow_engine]: Running task "run-agent-linux-debian-12-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-18 20:06:22] [DEBUG] [3958] [ThreadPoolExecutor-0_4] [workflow_engine]: Finished task "allocate-agent-linux-debian-11-amd64" execution with result: [2024-04-18 20:06:00] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-8F650EA7-B305-4110-84EF-4A9E9AF594B6 [2024-04-18 20:06:20] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-8F650EA7-B305-4110-84EF-4A9E9AF594B6 directory to /tmp/wazuh-qa/i-0a499b9967cdc71e3 [2024-04-18 20:06:20] [INFO] ALLOCATOR: Instance i-0a499b9967cdc71e3 created. [2024-04-18 20:06:22] [INFO] ALLOCATOR: Instance i-0a499b9967cdc71e3 started. [2024-04-18 20:06:22] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml [2024-04-18 20:06:22] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-debian-11-amd64/track.yaml [2024-04-18 20:06:22] [INFO] [3958] [ThreadPoolExecutor-0_4] [workflow_engine]: [allocate-agent-linux-debian-11-amd64] Finished task in 21.89 seconds. [2024-04-18 20:06:22] [INFO] [3958] [ThreadPoolExecutor-0_4] [workflow_engine]: [run-agent-linux-redhat-9-amd64-tests] Starting task. [2024-04-18 20:06:22] [DEBUG] [3958] [ThreadPoolExecutor-0_2] [workflow_engine]: Finished task "allocate-agent-linux-ubuntu-22.04-amd64" execution with result: [2024-04-18 20:06:00] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-A11AC36E-9449-4E4E-A42B-FC990A4562A6 [2024-04-18 20:06:20] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-A11AC36E-9449-4E4E-A42B-FC990A4562A6 directory to /tmp/wazuh-qa/i-046a46ff153e56ba0 [2024-04-18 20:06:20] [INFO] ALLOCATOR: Instance i-046a46ff153e56ba0 created. [2024-04-18 20:06:22] [INFO] ALLOCATOR: Instance i-046a46ff153e56ba0 started. [2024-04-18 20:06:22] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml [2024-04-18 20:06:22] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/track.yaml [2024-04-18 20:06:22] [DEBUG] [3958] [ThreadPoolExecutor-0_4] [workflow_engine]: Running task "run-agent-linux-redhat-9-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-18 20:06:22] [DEBUG] [3958] [ThreadPoolExecutor-0_7] [workflow_engine]: Finished task "allocate-agent-linux-centos-7-amd64" execution with result: [2024-04-18 20:06:01] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-B0FAB106-25BA-4DE0-8830-E52BE982673C [2024-04-18 20:06:20] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-B0FAB106-25BA-4DE0-8830-E52BE982673C directory to /tmp/wazuh-qa/i-09bbcc3f7bcd96a49 [2024-04-18 20:06:20] [INFO] ALLOCATOR: Instance i-09bbcc3f7bcd96a49 created. [2024-04-18 20:06:22] [INFO] ALLOCATOR: Instance i-09bbcc3f7bcd96a49 started. [2024-04-18 20:06:22] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml [2024-04-18 20:06:22] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-centos-7-amd64/track.yaml [2024-04-18 20:06:22] [INFO] [3958] [ThreadPoolExecutor-0_2] [workflow_engine]: [allocate-agent-linux-ubuntu-22.04-amd64] Finished task in 21.93 seconds. [2024-04-18 20:06:22] [INFO] [3958] [ThreadPoolExecutor-0_7] [workflow_engine]: [allocate-agent-linux-centos-7-amd64] Finished task in 21.96 seconds. [2024-04-18 20:06:22] [DEBUG] [3958] [ThreadPoolExecutor-0_1] [workflow_engine]: Finished task "allocate-agent-linux-ubuntu-20.04-amd64" execution with result: [2024-04-18 20:06:00] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-4574CDFF-6FA5-4822-AD8E-834E29E9883A [2024-04-18 20:06:20] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-4574CDFF-6FA5-4822-AD8E-834E29E9883A directory to /tmp/wazuh-qa/i-0edc1b0a3f06c1f49 [2024-04-18 20:06:20] [INFO] ALLOCATOR: Instance i-0edc1b0a3f06c1f49 created. [2024-04-18 20:06:22] [INFO] ALLOCATOR: Instance i-0edc1b0a3f06c1f49 started. [2024-04-18 20:06:22] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml [2024-04-18 20:06:22] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/track.yaml [2024-04-18 20:06:22] [INFO] [3958] [ThreadPoolExecutor-0_2] [workflow_engine]: [run-agent-linux-debian-11-amd64-tests] Starting task. [2024-04-18 20:06:22] [INFO] [3958] [ThreadPoolExecutor-0_7] [workflow_engine]: [run-agent-linux-ubuntu-22.04-amd64-tests] Starting task. [2024-04-18 20:06:22] [INFO] [3958] [ThreadPoolExecutor-0_1] [workflow_engine]: [allocate-agent-linux-ubuntu-20.04-amd64] Finished task in 22.01 seconds. [2024-04-18 20:06:22] [DEBUG] [3958] [ThreadPoolExecutor-0_2] [workflow_engine]: Running task "run-agent-linux-debian-11-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-18 20:06:22] [DEBUG] [3958] [ThreadPoolExecutor-0_7] [workflow_engine]: Running task "run-agent-linux-ubuntu-22.04-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-18 20:06:22] [INFO] [3958] [ThreadPoolExecutor-0_1] [workflow_engine]: [run-agent-linux-centos-7-amd64-tests] Starting task. [2024-04-18 20:06:22] [DEBUG] [3958] [ThreadPoolExecutor-0_1] [workflow_engine]: Running task "run-agent-linux-centos-7-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-18 20:06:23] [DEBUG] [3958] [ThreadPoolExecutor-0_9] [workflow_engine]: Finished task "allocate-agent-linux-redhat-7-amd64" execution with result: [2024-04-18 20:06:01] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-4233B863-9A54-42F4-9723-490733953DF6 [2024-04-18 20:06:21] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-4233B863-9A54-42F4-9723-490733953DF6 directory to /tmp/wazuh-qa/i-02fed24715255ec67 [2024-04-18 20:06:21] [INFO] ALLOCATOR: Instance i-02fed24715255ec67 created. [2024-04-18 20:06:22] [INFO] ALLOCATOR: Instance i-02fed24715255ec67 started. [2024-04-18 20:06:23] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml [2024-04-18 20:06:23] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-redhat-7-amd64/track.yaml [2024-04-18 20:06:23] [INFO] [3958] [ThreadPoolExecutor-0_9] [workflow_engine]: [allocate-agent-linux-redhat-7-amd64] Finished task in 22.50 seconds. [2024-04-18 20:06:23] [INFO] [3958] [ThreadPoolExecutor-0_9] [workflow_engine]: [run-agent-linux-ubuntu-20.04-amd64-tests] Starting task. [2024-04-18 20:06:23] [DEBUG] [3958] [ThreadPoolExecutor-0_9] [workflow_engine]: Running task "run-agent-linux-ubuntu-20.04-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-18 20:06:24] [DEBUG] [3958] [ThreadPoolExecutor-0_8] [workflow_engine]: Finished task "allocate-agent-linux-centos-8-amd64" execution with result: [2024-04-18 20:06:01] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-BEA0644B-B1AE-42FF-AB04-D32973855F94 [2024-04-18 20:06:21] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-BEA0644B-B1AE-42FF-AB04-D32973855F94 directory to /tmp/wazuh-qa/i-08414c48c226d0c1f [2024-04-18 20:06:21] [INFO] ALLOCATOR: Instance i-08414c48c226d0c1f created. [2024-04-18 20:06:23] [INFO] ALLOCATOR: Instance i-08414c48c226d0c1f started. [2024-04-18 20:06:23] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml [2024-04-18 20:06:23] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-centos-8-amd64/track.yaml [2024-04-18 20:06:24] [INFO] [3958] [ThreadPoolExecutor-0_8] [workflow_engine]: [allocate-agent-linux-centos-8-amd64] Finished task in 23.36 seconds. [2024-04-18 20:06:24] [INFO] [3958] [ThreadPoolExecutor-0_8] [workflow_engine]: [run-agent-linux-redhat-7-amd64-tests] Starting task. [2024-04-18 20:06:24] [DEBUG] [3958] [ThreadPoolExecutor-0_8] [workflow_engine]: Running task "run-agent-linux-redhat-7-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-18 20:06:24] [DEBUG] [3958] [ThreadPoolExecutor-0_6] [workflow_engine]: Finished task "allocate-agent-linux-oracle-9-amd64" execution with result: [2024-04-18 20:06:01] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-8547E693-D78D-417D-8F78-034923675D7F [2024-04-18 20:06:22] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-8547E693-D78D-417D-8F78-034923675D7F directory to /tmp/wazuh-qa/i-047688142999192b2 [2024-04-18 20:06:22] [INFO] ALLOCATOR: Instance i-047688142999192b2 created. [2024-04-18 20:06:23] [INFO] ALLOCATOR: Instance i-047688142999192b2 started. [2024-04-18 20:06:24] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml [2024-04-18 20:06:24] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-oracle-9-amd64/track.yaml [2024-04-18 20:06:24] [INFO] [3958] [ThreadPoolExecutor-0_6] [workflow_engine]: [allocate-agent-linux-oracle-9-amd64] Finished task in 23.55 seconds. [2024-04-18 20:06:24] [INFO] [3958] [ThreadPoolExecutor-0_6] [workflow_engine]: [run-agent-linux-centos-8-amd64-tests] Starting task. [2024-04-18 20:06:24] [DEBUG] [3958] [ThreadPoolExecutor-0_6] [workflow_engine]: Running task "run-agent-linux-centos-8-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-18 20:06:24] [DEBUG] [3958] [ThreadPoolExecutor-0_3] [workflow_engine]: Finished task "allocate-agent-linux-debian-10-amd64" execution with result: [2024-04-18 20:06:00] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-186E6A14-E04C-458B-A16C-71377EFD5850 [2024-04-18 20:06:22] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-186E6A14-E04C-458B-A16C-71377EFD5850 directory to /tmp/wazuh-qa/i-04a7937de007561bd [2024-04-18 20:06:22] [INFO] ALLOCATOR: Instance i-04a7937de007561bd created. [2024-04-18 20:06:23] [INFO] ALLOCATOR: Instance i-04a7937de007561bd started. [2024-04-18 20:06:24] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml [2024-04-18 20:06:24] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-debian-10-amd64/track.yaml [2024-04-18 20:06:24] [INFO] [3958] [ThreadPoolExecutor-0_3] [workflow_engine]: [allocate-agent-linux-debian-10-amd64] Finished task in 23.63 seconds. [2024-04-18 20:06:24] [INFO] [3958] [ThreadPoolExecutor-0_3] [workflow_engine]: [run-agent-linux-debian-10-amd64-tests] Starting task. [2024-04-18 20:06:24] [DEBUG] [3958] [ThreadPoolExecutor-0_3] [workflow_engine]: Running task "run-agent-linux-debian-10-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-18 20:06:24] [DEBUG] [3958] [ThreadPoolExecutor-0_0] [workflow_engine]: Finished task "allocate-agent-linux-ubuntu-18.04-amd64" execution with result: [2024-04-18 20:06:00] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-B03EACF7-A0B4-44E8-AE78-5A158D312067 [2024-04-18 20:06:22] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-B03EACF7-A0B4-44E8-AE78-5A158D312067 directory to /tmp/wazuh-qa/i-0654f4cfe549ee66c [2024-04-18 20:06:22] [INFO] ALLOCATOR: Instance i-0654f4cfe549ee66c created. [2024-04-18 20:06:24] [INFO] ALLOCATOR: Instance i-0654f4cfe549ee66c started. [2024-04-18 20:06:24] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml [2024-04-18 20:06:24] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/track.yaml [2024-04-18 20:06:24] [DEBUG] [3958] [ThreadPoolExecutor-0_10] [workflow_engine]: Finished task "allocate-agent-linux-redhat-8-amd64" execution with result: [2024-04-18 20:06:01] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-18 20:06:01] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-E6EB3929-C12E-4B8E-A2F8-E195C684CC5E [2024-04-18 20:06:22] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-E6EB3929-C12E-4B8E-A2F8-E195C684CC5E directory to /tmp/wazuh-qa/i-04e8c1e0ce1934a54 [2024-04-18 20:06:22] [INFO] ALLOCATOR: Instance i-04e8c1e0ce1934a54 created. [2024-04-18 20:06:24] [INFO] ALLOCATOR: Instance i-04e8c1e0ce1934a54 started. [2024-04-18 20:06:24] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml [2024-04-18 20:06:24] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-redhat-8-amd64/track.yaml [2024-04-18 20:06:24] [INFO] [3958] [ThreadPoolExecutor-0_0] [workflow_engine]: [allocate-agent-linux-ubuntu-18.04-amd64] Finished task in 23.91 seconds. [2024-04-18 20:06:24] [INFO] [3958] [ThreadPoolExecutor-0_10] [workflow_engine]: [allocate-agent-linux-redhat-8-amd64] Finished task in 23.82 seconds. [2024-04-18 20:06:24] [INFO] [3958] [ThreadPoolExecutor-0_0] [workflow_engine]: [run-agent-linux-ubuntu-18.04-amd64-tests] Starting task. [2024-04-18 20:06:24] [DEBUG] [3958] [ThreadPoolExecutor-0_0] [workflow_engine]: Running task "run-agent-linux-ubuntu-18.04-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-18 20:06:45] [DEBUG] [3958] [ThreadPoolExecutor-0_5] [workflow_engine]: Finished task "allocate-agent-linux-amazon-2-amd64" execution with result: [2024-04-18 20:06:22] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-18 20:06:22] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-18 20:06:22] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-18 20:06:22] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-6031A15C-D3E8-4BB6-9B14-ABF5FF05AF84 [2024-04-18 20:06:43] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-6031A15C-D3E8-4BB6-9B14-ABF5FF05AF84 directory to /tmp/wazuh-qa/i-091aa23e844cef28f [2024-04-18 20:06:43] [INFO] ALLOCATOR: Instance i-091aa23e844cef28f created. [2024-04-18 20:06:44] [INFO] ALLOCATOR: Instance i-091aa23e844cef28f started. [2024-04-18 20:06:44] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml [2024-04-18 20:06:44] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-amazon-2-amd64/track.yaml [2024-04-18 20:06:45] [INFO] [3958] [ThreadPoolExecutor-0_5] [workflow_engine]: [allocate-agent-linux-amazon-2-amd64] Finished task in 22.50 seconds. [2024-04-18 20:06:45] [INFO] [3958] [ThreadPoolExecutor-0_10] [workflow_engine]: [run-agent-linux-amazon-2-amd64-tests] Starting task. [2024-04-18 20:06:45] [DEBUG] [3958] [ThreadPoolExecutor-0_10] [workflow_engine]: Running task "run-agent-linux-amazon-2-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-18 20:10:42] [DEBUG] [3958] [ThreadPoolExecutor-0_3] [workflow_engine]: Finished task "run-agent-linux-debian-10-amd64-tests" execution with result: [2024-04-18 20:06:24] [INFO] TESTER: Running tests for ec2-3-80-51-50.compute-1.amazonaws.com [2024-04-18 20:06:24] [INFO] TESTER: Running tests for ec2-3-88-179-188.compute-1.amazonaws.com [2024-04-18 20:06:24] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-3-88-179-188.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-18 20:06:24] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-18 20:06:24] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:24] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-3-88-179-188.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-3-80-51-50.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.006054' end: '2024-04-18 20:06:26.509565' item: ec2-3-80-51-50.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:26.503511' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-3-88-179-188.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.006264' end: '2024-04-18 20:06:26.693779' item: ec2-3-88-179-188.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:26.687515' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:06:26] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-3-88-179-188.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:06:26] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:06:26] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:26] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' - --live=True - -s delta: '0:02:47.499027' end: '2024-04-18 20:09:15.733419' msg: non-zero return code rc: 1 start: '2024-04-18 20:06:28.234392' stderr: |- Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-18 20:06:28] [INFO] TESTER: Checking connection to debian-10[0m [32m[2024-04-18 20:06:30] [INFO] TESTER: Connection established successfully in debian-10[0m [32m[2024-04-18 20:06:32] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-18 20:06:33] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-18 20:06:35] [INFO] TESTER: No Firewall to disable on debian-10[0m [32m[2024-04-18 20:06:40] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-18 20:07:11] [INFO] TESTER: Installing Manager in ubuntu-22.04[0m [31m[2024-04-18 20:09:09] [ERROR] TESTER: The /var/ossec is not present in ubuntu-22.04[0m FAILED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-18 20:09:09] [INFO] TESTER: Getting status of debian-10[0m [31m[2024-04-18 20:09:11] [ERROR] TESTER: The debian-10 status is not loaded[0m FAILED modules/testing/tests/test_agent/test_install.py::test_version [31m[2024-04-18 20:09:13] [ERROR] TESTER: The version debian-10 is not 4.7.3 by command[0m FAILED modules/testing/tests/test_agent/test_install.py::test_revision [31m[2024-04-18 20:09:15] [ERROR] TESTER: The revision debian-10 is not 40714 by command[0m FAILED =================================== FAILURES =================================== ______________________________ test_installation _______________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_installation(wazuh_params): # Checking connection for manager_name, manager_params in wazuh_params['managers'].items(): Utils.check_inventory_connection(manager_params) # Certs creation, firewall management and Manager installation for agent_name, agent_params in wazuh_params['agents'].items(): HostConfiguration.disable_firewall(agent_params) if HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT): logger.info(f'Manager is already installed in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') else: HostConfiguration.disable_firewall(manager_params) HostConfiguration.certs_create(wazuh_params['wazuh_version'], wazuh_params['master'], wazuh_params['dashboard'], wazuh_params['indexers'], wazuh_params['workers']) WazuhManager.install_manager(wazuh_params['master'], 'wazuh-1', wazuh_params['wazuh_version']) > assert HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml', PosixPath('/var/ossec')) E + where = HostInformation.dir_exists modules/testing/tests/test_agent/test_install.py:81: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): agent_status = GeneralComponentActions.get_component_status(agent, 'wazuh-agent') > assert 'loaded' in agent_status, logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} status is not loaded') E AssertionError: None E assert 'loaded' in '' modules/testing/tests/test_agent/test_install.py:95: AssertionError _________________________________ test_version _________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_version(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_version'] in GeneralComponentActions.get_component_version(agent_params), logger.error(f"The version {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_version']} by command") E AssertionError: None E assert '4.7.3' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_version modules/testing/tests/test_agent/test_install.py:100: AssertionError ________________________________ test_revision _________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_revision(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_revision'] in GeneralComponentActions.get_component_revision(agent_params), logger.error(f"The revision {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_revision']} by command") E AssertionError: None E assert '40714' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_revision modules/testing/tests/test_agent/test_install.py:105: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_install.py::test_installation - ... FAILED modules/testing/tests/test_agent/test_install.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_install.py::test_version - Asser... FAILED modules/testing/tests/test_agent/test_install.py::test_revision - Asse... ================== 4 failed, 2 warnings in 167.07s (0:02:47) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:09:15] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:09:15] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:09:15] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:09:15] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:22.323955' end: '2024-04-18 20:09:39.481942' msg: non-zero return code rc: 1 start: '2024-04-18 20:09:17.157987' stderr: |- Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sed: can't read /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. cat: /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-18 20:09:17] [INFO] TESTER: Checking connection to debian-10[0m [32m[2024-04-18 20:09:18] [INFO] TESTER: Connection established successfully in debian-10[0m [31m[2024-04-18 20:09:27] [ERROR] TESTER: Error configuring the Manager IP (172.31.20.143)in: debian-10 agent[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-18 20:09:27] [INFO] TESTER: Getting status of debian-10[0m [31m[2024-04-18 20:09:29] [ERROR] TESTER: The debian-10 is not active[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys [31m[2024-04-18 20:09:39] [ERROR] TESTER: agent-linux-debian-10-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== ______________________________ test_registration _______________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_registration(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > WazuhAgent.register_agent(agent_params, wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:67: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ inventory_path = '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml' manager_path = {'ansible_connection': 'ssh', 'ansible_host': 'ec2-3-80-51-50.compute-1.amazonaws.com', 'ansible_port': 2200, 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040', ...} @staticmethod def register_agent(inventory_path, manager_path): with open(manager_path, 'r') as yaml_file: manager_path = yaml.safe_load(yaml_file) host = manager_path.get('ansible_host') internal_ip = HostInformation.get_internal_ip_from_aws_dns(host) if 'amazonaws' in host else host commands = [ f"sed -i 's/
MANAGER_IP<\/address>/
{internal_ip}<\/address>/g' {WAZUH_CONF}", "systemctl restart wazuh-agent" ] Executor.execute_commands(inventory_path, commands) > assert internal_ip in Executor.execute_command(inventory_path, f'cat {WAZUH_CONF}'), logger.error(f'Error configuring the Manager IP ({internal_ip})in: {HostInformation.get_os_name_and_version_from_inventory(inventory_path)} agent') E AssertionError: None modules/testing/tests/helpers/agent.py:106: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): > assert 'active' in GeneralComponentActions.get_component_status(agent, 'wazuh-agent'), logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} is not active') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_registration.py:72: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' E AssertionError: The agent-linux-debian-10-amd64 is not present in the master by command E assert 'agent-linux-debian-10-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_registration.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_registration.py:93: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_registration FAILED modules/testing/tests/test_agent/test_registration.py::test_status - A... FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys ======================== 5 failed, 2 warnings in 21.91s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:09:39] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:09:39] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:09:39] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:09:39] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:13.360248' end: '2024-04-18 20:09:54.255246' msg: non-zero return code rc: 1 start: '2024-04-18 20:09:40.894998' stderr: |- Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-18 20:09:41] [INFO] TESTER: Checking connection to debian-10[0m [32m[2024-04-18 20:09:42] [INFO] TESTER: Connection established successfully in debian-10[0m [32m[2024-04-18 20:09:44] [INFO] TESTER: Restarting wazuh-agent in debian-10[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-18 20:09:46] [INFO] TESTER: Getting status of debian-10[0m [31m[2024-04-18 20:09:48] [ERROR] TESTER: agent-linux-debian-10-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_connection [31m[2024-04-18 20:09:50] [ERROR] TESTER: agent-linux-debian-10-amd64 is not present in agent_control information[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive [31m[2024-04-18 20:09:52] [ERROR] TESTER: agent-linux-debian-10-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys [31m[2024-04-18 20:09:54] [ERROR] TESTER: agent-linux-debian-10-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert 'active' in GeneralComponentActions.get_component_status(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_restart.py:71: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is not present in agent_control information') E AssertionError: None E assert 'agent-linux-debian-10-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_restart.py:76: AssertionError ________________________________ test_isActive _________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_restart.py:81: AssertionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_restart.py:86: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_restart.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_restart.py::test_connection - As... FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive - Asse... FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys - As... =================== 4 failed, 1 passed, 2 warnings in 12.97s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:09:54] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:09:54] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:09:54] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:09:54] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:11.548089' end: '2024-04-18 20:10:07.194764' msg: non-zero return code rc: 1 start: '2024-04-18 20:09:55.646675' stderr: |- Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-18 20:09:56] [INFO] TESTER: Checking connection to debian-10[0m [32m[2024-04-18 20:09:57] [INFO] TESTER: Connection established successfully in debian-10[0m FAILED[32m[2024-04-18 20:10:05] [INFO] TESTER: Restarting wazuh-agent in debian-10[0m =================================== FAILURES =================================== __________________________________ test_stop ___________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_stop(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_stop.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_stop.py::test_stop - requests.ex... ======================== 1 failed, 2 warnings in 11.16s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:10:07] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:10:07] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:10:07] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:10:07] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:13.619258' end: '2024-04-18 20:10:22.236458' msg: non-zero return code rc: 1 start: '2024-04-18 20:10:08.617200' stderr: |- Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-88-179-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-18 20:10:09] [INFO] TESTER: Checking connection to debian-10[0m [32m[2024-04-18 20:10:10] [INFO] TESTER: Connection established successfully in debian-10[0m [31m[2024-04-18 20:10:14] [ERROR] TESTER: agent-linux-debian-10-amd64 is not Active before the installation[0m FAILED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive FAILED =================================== FAILURES =================================== ________________________________ test_uninstall ________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_uninstall(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not Active before the installation') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_uninstall.py:68: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_uninstall.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_uninstall.py::test_uninstall - A... FAILED modules/testing/tests/test_agent/test_uninstall.py::test_isActive - re... =================== 2 failed, 1 passed, 2 warnings in 13.23s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:10:22] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:10:22] [INFO] TESTER: Cleaning up [2024-04-18 20:10:22] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:10:22] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:10:33] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:10:33] [INFO] TESTER: Cleaning up [2024-04-18 20:10:33] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:10:33] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:10:42] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:10:42] [INFO] [3958] [ThreadPoolExecutor-0_3] [workflow_engine]: [run-agent-linux-debian-10-amd64-tests] Finished task in 258.56 seconds. [2024-04-18 20:11:25] [DEBUG] [3958] [ThreadPoolExecutor-0_7] [workflow_engine]: Finished task "run-agent-linux-ubuntu-22.04-amd64-tests" execution with result: [2024-04-18 20:06:23] [INFO] TESTER: Running tests for ec2-3-80-51-50.compute-1.amazonaws.com [2024-04-18 20:06:23] [INFO] TESTER: Running tests for ec2-54-91-255-1.compute-1.amazonaws.com [2024-04-18 20:06:23] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-54-91-255-1.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-18 20:06:23] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-18 20:06:23] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:23] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-54-91-255-1.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-3-80-51-50.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.006680' end: '2024-04-18 20:06:24.491521' item: ec2-3-80-51-50.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:24.484841' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-54-91-255-1.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.004487' end: '2024-04-18 20:06:24.633527' item: ec2-54-91-255-1.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:24.629040' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:06:24] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-54-91-255-1.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:06:24] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:06:24] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:24] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:02:12.881490' end: '2024-04-18 20:08:39.449327' msg: '' rc: 0 start: '2024-04-18 20:06:26.567837' stderr: |- Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. --2024-04-18 23:08:09-- https://packages-dev.wazuh.com/pre-release/apt/pool/main/w/wazuh-agent/wazuh-agent_4.7.3-1_amd64.deb Resolving packages-dev.wazuh.com (packages-dev.wazuh.com)... 99.84.208.61, 99.84.208.124, 99.84.208.42, ... Connecting to packages-dev.wazuh.com (packages-dev.wazuh.com)|99.84.208.61|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 9362524 (8.9M) [binary/octet-stream] Saving to: 'wazuh-agent_4.7.3-1_amd64.deb' 0K .......... .......... .......... .......... .......... 0% 39.4M 0s 50K .......... .......... .......... .......... .......... 1% 43.2M 0s 100K .......... .......... .......... .......... .......... 1% 34.4M 0s 150K .......... .......... .......... .......... .......... 2% 45.0M 0s 200K .......... .......... .......... .......... .......... 2% 36.1M 0s 250K .......... .......... .......... .......... .......... 3% 45.4M 0s 300K .......... .......... .......... .......... .......... 3% 59.8M 0s 350K .......... .......... .......... .......... .......... 4% 34.4M 0s 400K .......... .......... .......... .......... .......... 4% 70.9M 0s 450K .......... .......... .......... .......... .......... 5% 141M 0s 500K .......... .......... .......... .......... .......... 6% 74.2M 0s 550K .......... .......... .......... .......... .......... 6% 69.9M 0s 600K .......... .......... .......... .......... .......... 7% 67.6M 0s 650K .......... .......... .......... .......... .......... 7% 100M 0s 700K .......... .......... .......... .......... .......... 8% 72.7M 0s 750K .......... .......... .......... .......... .......... 8% 83.7M 0s 800K .......... .......... .......... .......... .......... 9% 92.7M 0s 850K .......... .......... .......... .......... .......... 9% 87.7M 0s 900K .......... .......... .......... .......... .......... 10% 67.3M 0s 950K .......... .......... .......... .......... .......... 10% 130M 0s 1000K .......... .......... .......... .......... .......... 11% 98.8M 0s 1050K .......... .......... .......... .......... .......... 12% 154M 0s 1100K .......... .......... .......... .......... .......... 12% 85.3M 0s 1150K .......... .......... .......... .......... .......... 13% 170M 0s 1200K .......... .......... .......... .......... .......... 13% 73.4M 0s 1250K .......... .......... .......... .......... .......... 14% 156M 0s 1300K .......... .......... .......... .......... .......... 14% 119M 0s 1350K .......... .......... .......... .......... .......... 15% 110M 0s 1400K .......... .......... .......... .......... .......... 15% 215M 0s 1450K .......... .......... .......... .......... .......... 16% 118M 0s 1500K .......... .......... .......... .......... .......... 16% 8.47M 0s 1550K .......... .......... .......... .......... .......... 17% 206M 0s 1600K .......... .......... .......... .......... .......... 18% 211M 0s 1650K .......... .......... .......... .......... .......... 18% 41.3M 0s 1700K .......... .......... .......... .......... .......... 19% 155M 0s 1750K .......... .......... .......... .......... .......... 19% 28.9M 0s 1800K .......... .......... .......... .......... .......... 20% 185M 0s 1850K .......... .......... .......... .......... .......... 20% 187M 0s 1900K .......... .......... .......... .......... .......... 21% 11.9M 0s 1950K .......... .......... .......... .......... .......... 21% 204M 0s 2000K .......... .......... .......... .......... .......... 22% 155M 0s 2050K .......... .......... .......... .......... .......... 22% 208M 0s 2100K .......... .......... .......... .......... .......... 23% 142M 0s 2150K .......... .......... .......... .......... .......... 24% 118M 0s 2200K .......... .......... .......... .......... .......... 24% 191M 0s 2250K .......... .......... .......... .......... .......... 25% 99.2M 0s 2300K .......... .......... .......... .......... .......... 25% 137M 0s 2350K .......... .......... .......... .......... .......... 26% 183M 0s 2400K .......... .......... .......... .......... .......... 26% 208M 0s 2450K .......... .......... .......... .......... .......... 27% 203M 0s 2500K .......... .......... .......... .......... .......... 27% 207M 0s 2550K .......... .......... .......... .......... .......... 28% 124M 0s 2600K .......... .......... .......... .......... .......... 28% 186M 0s 2650K .......... .......... .......... .......... .......... 29% 209M 0s 2700K .......... .......... .......... .......... .......... 30% 35.6M 0s 2750K .......... .......... .......... .......... .......... 30% 155M 0s 2800K .......... .......... .......... .......... .......... 31% 212M 0s 2850K .......... .......... .......... .......... .......... 31% 205M 0s 2900K .......... .......... .......... .......... .......... 32% 209M 0s 2950K .......... .......... .......... .......... .......... 32% 202M 0s 3000K .......... .......... .......... .......... .......... 33% 209M 0s 3050K .......... .......... .......... .......... .......... 33% 194M 0s 3100K .......... .......... .......... .......... .......... 34% 137M 0s 3150K .......... .......... .......... .......... .......... 34% 149M 0s 3200K .......... .......... .......... .......... .......... 35% 214M 0s 3250K .......... .......... .......... .......... .......... 36% 197M 0s 3300K .......... .......... .......... .......... .......... 36% 165M 0s 3350K .......... .......... .......... .......... .......... 37% 188M 0s 3400K .......... .......... .......... .......... .......... 37% 206M 0s 3450K .......... .......... .......... .......... .......... 38% 195M 0s 3500K .......... .......... .......... .......... .......... 38% 195M 0s 3550K .......... .......... .......... .......... .......... 39% 198M 0s 3600K .......... .......... .......... .......... .......... 39% 192M 0s 3650K .......... .......... .......... .......... .......... 40% 196M 0s 3700K .......... .......... .......... .......... .......... 41% 185M 0s 3750K .......... .......... .......... .......... .......... 41% 209M 0s 3800K .......... .......... .......... .......... .......... 42% 129M 0s 3850K .......... .......... .......... .......... .......... 42% 182M 0s 3900K .......... .......... .......... .......... .......... 43% 215M 0s 3950K .......... .......... .......... .......... .......... 43% 222M 0s 4000K .......... .......... .......... .......... .......... 44% 228M 0s 4050K .......... .......... .......... .......... .......... 44% 134M 0s 4100K .......... .......... .......... .......... .......... 45% 219M 0s 4150K .......... .......... .......... .......... .......... 45% 213M 0s 4200K .......... .......... .......... .......... .......... 46% 183M 0s 4250K .......... .......... .......... .......... .......... 47% 182M 0s 4300K .......... .......... .......... .......... .......... 47% 218M 0s 4350K .......... .......... .......... .......... .......... 48% 203M 0s 4400K .......... .......... .......... .......... .......... 48% 194M 0s 4450K .......... .......... .......... .......... .......... 49% 122M 0s 4500K .......... .......... .......... .......... .......... 49% 211M 0s 4550K .......... .......... .......... .......... .......... 50% 211M 0s 4600K .......... .......... .......... .......... .......... 50% 184M 0s 4650K .......... .......... .......... .......... .......... 51% 215M 0s 4700K .......... .......... .......... .......... .......... 51% 213M 0s 4750K .......... .......... .......... .......... .......... 52% 191M 0s 4800K .......... .......... .......... .......... .......... 53% 221M 0s 4850K .......... .......... .......... .......... .......... 53% 169M 0s 4900K .......... .......... .......... .......... .......... 54% 186M 0s 4950K .......... .......... .......... .......... .......... 54% 225M 0s 5000K .......... .......... .......... .......... .......... 55% 175M 0s 5050K .......... .......... .......... .......... .......... 55% 202M 0s 5100K .......... .......... .......... .......... .......... 56% 209M 0s 5150K .......... .......... .......... .......... .......... 56% 215M 0s 5200K .......... .......... .......... .......... .......... 57% 220M 0s 5250K .......... .......... .......... .......... .......... 57% 160M 0s 5300K .......... .......... .......... .......... .......... 58% 207M 0s 5350K .......... .......... .......... .......... .......... 59% 187M 0s 5400K .......... .......... .......... .......... .......... 59% 228M 0s 5450K .......... .......... .......... .......... .......... 60% 201M 0s 5500K .......... .......... .......... .......... .......... 60% 222M 0s 5550K .......... .......... .......... .......... .......... 61% 193M 0s 5600K .......... .......... .......... .......... .......... 61% 213M 0s 5650K .......... .......... .......... .......... .......... 62% 167M 0s 5700K .......... .......... .......... .......... .......... 62% 221M 0s 5750K .......... .......... .......... .......... .......... 63% 176M 0s 5800K .......... .......... .......... .......... .......... 63% 184M 0s 5850K .......... .......... .......... .......... .......... 64% 226M 0s 5900K .......... .......... .......... .......... .......... 65% 235M 0s 5950K .......... .......... .......... .......... .......... 65% 189M 0s 6000K .......... .......... .......... .......... .......... 66% 204M 0s 6050K .......... .......... .......... .......... .......... 66% 215M 0s 6100K .......... .......... .......... .......... .......... 67% 178M 0s 6150K .......... .......... .......... .......... .......... 67% 222M 0s 6200K .......... .......... .......... .......... .......... 68% 210M 0s 6250K .......... .......... .......... .......... .......... 68% 194M 0s 6300K .......... .......... .......... .......... .......... 69% 192M 0s 6350K .......... .......... .......... .......... .......... 69% 199M 0s 6400K .......... .......... .......... .......... .......... 70% 175M 0s 6450K .......... .......... .......... .......... .......... 71% 161M 0s 6500K .......... .......... .......... .......... .......... 71% 206M 0s 6550K .......... .......... .......... .......... .......... 72% 209M 0s 6600K .......... .......... .......... .......... .......... 72% 176M 0s 6650K .......... .......... .......... .......... .......... 73% 219M 0s 6700K .......... .......... .......... .......... .......... 73% 192M 0s 6750K .......... .......... .......... .......... .......... 74% 143M 0s 6800K .......... .......... .......... .......... .......... 74% 212M 0s 6850K .......... .......... .......... .......... .......... 75% 123M 0s 6900K .......... .......... .......... .......... .......... 76% 201M 0s 6950K .......... .......... .......... .......... .......... 76% 178M 0s 7000K .......... .......... .......... .......... .......... 77% 209M 0s 7050K .......... .......... .......... .......... .......... 77% 217M 0s 7100K .......... .......... .......... .......... .......... 78% 184M 0s 7150K .......... .......... .......... .......... .......... 78% 171M 0s 7200K .......... .......... .......... .......... .......... 79% 147M 0s 7250K .......... .......... .......... .......... .......... 79% 210M 0s 7300K .......... .......... .......... .......... .......... 80% 195M 0s 7350K .......... .......... .......... .......... .......... 80% 176M 0s 7400K .......... .......... .......... .......... .......... 81% 207M 0s 7450K .......... .......... .......... .......... .......... 82% 185M 0s 7500K .......... .......... .......... .......... .......... 82% 211M 0s 7550K .......... .......... .......... .......... .......... 83% 214M 0s 7600K .......... .......... .......... .......... .......... 83% 188M 0s 7650K .......... .......... .......... .......... .......... 84% 220M 0s 7700K .......... .......... .......... .......... .......... 84% 191M 0s 7750K .......... .......... .......... .......... .......... 85% 219M 0s 7800K .......... .......... .......... .......... .......... 85% 178M 0s 7850K .......... .......... .......... .......... .......... 86% 213M 0s 7900K .......... .......... .......... .......... .......... 86% 221M 0s 7950K .......... .......... .......... .......... .......... 87% 155M 0s 8000K .......... .......... .......... .......... .......... 88% 191M 0s 8050K .......... .......... .......... .......... .......... 88% 172M 0s 8100K .......... .......... .......... .......... .......... 89% 215M 0s 8150K .......... .......... .......... .......... .......... 89% 203M 0s 8200K .......... .......... .......... .......... .......... 90% 208M 0s 8250K .......... .......... .......... .......... .......... 90% 192M 0s 8300K .......... .......... .......... .......... .......... 91% 203M 0s 8350K .......... .......... .......... .......... .......... 91% 229M 0s 8400K .......... .......... .......... .......... .......... 92% 156M 0s 8450K .......... .......... .......... .......... .......... 92% 160M 0s 8500K .......... .......... .......... .......... .......... 93% 217M 0s 8550K .......... .......... .......... .......... .......... 94% 172M 0s 8600K .......... .......... .......... .......... .......... 94% 217M 0s 8650K .......... .......... .......... .......... .......... 95% 206M 0s 8700K .......... .......... .......... .......... .......... 95% 152M 0s 8750K .......... .......... .......... .......... .......... 96% 213M 0s 8800K .......... .......... .......... .......... .......... 96% 163M 0s 8850K .......... .......... .......... .......... .......... 97% 207M 0s 8900K .......... .......... .......... .......... .......... 97% 181M 0s 8950K .......... .......... .......... .......... .......... 98% 213M 0s 9000K .......... .......... .......... .......... .......... 98% 134M 0s 9050K .......... .......... .......... .......... .......... 99% 214M 0s 9100K .......... .......... .......... .......... ... 100% 223M=0.07s 2024-04-18 23:08:10 (122 MB/s) - 'wazuh-agent_4.7.3-1_amd64.deb' saved [9362524/9362524] Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Created symlink /etc/systemd/system/multi-user.target.wants/wazuh-agent.service → /lib/systemd/system/wazuh-agent.service. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Job for wazuh-agent.service failed because the control process exited with error code. See "systemctl status wazuh-agent.service" and "journalctl -xeu wazuh-agent.service" for details. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-18 20:06:27] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [33m[2024-04-18 20:06:27] [WARNING] TESTER: Error on attempt 1 of 10: [Errno None] Unable to connect to port 2200 on 54.91.255.1[0m [32m[2024-04-18 20:06:58] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-18 20:07:01] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-18 20:07:03] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-18 20:07:05] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-18 20:07:09] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-18 20:07:38] [INFO] TESTER: Installing Manager in ubuntu-22.04[0m [32m[2024-04-18 20:07:48] [INFO] TESTER: Generating Snapshot for Checkfile in ubuntu-22.04[0m [32m[2024-04-18 20:08:07] [INFO] TESTER: Installing Agent in ubuntu-22.04[0m [32m[2024-04-18 20:08:21] [INFO] TESTER: Generating Snapshot for Checkfile in ubuntu-22.04[0m [32m[2024-04-18 20:08:31] [INFO] TESTER: Applying filters in checkfiles in ubuntu-22.04[0m [32m[2024-04-18 20:08:31] [INFO] TESTER: Pre and post install checkfile comparison in ubuntu-22.04: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m PASSED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-18 20:08:33] [INFO] TESTER: Getting status of ubuntu-22.04[0m PASSED modules/testing/tests/test_agent/test_install.py::test_version PASSED modules/testing/tests/test_agent/test_install.py::test_revision PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ================== 4 passed, 2 warnings in 132.32s (0:02:12) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:08:39] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:08:39] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:08:39] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:08:39] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:30.091801' end: '2024-04-18 20:09:10.921287' msg: non-zero return code rc: 1 start: '2024-04-18 20:08:40.829486' stderr: |- Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-18 20:08:41] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-18 20:08:42] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-18 20:08:58] [INFO] TESTER: Getting status of ubuntu-22.04[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys PASSED =================================== FAILURES =================================== _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-2204-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' E AssertionError: The agent-linux-ubuntu-2204-amd64 is not present in the master by command E assert 'agent-linux-ubuntu-2204-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_registration.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-ubuntu-2204-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive =================== 2 failed, 3 passed, 2 warnings in 29.66s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:09:11] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:09:11] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:09:11] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:09:11] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:27.402679' end: '2024-04-18 20:09:39.752176' msg: non-zero return code rc: 1 start: '2024-04-18 20:09:12.349497' stderr: |- Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-18 20:09:12] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-18 20:09:14] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-18 20:09:21] [INFO] TESTER: Restarting wazuh-agent in ubuntu-22.04[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-18 20:09:31] [INFO] TESTER: Getting status of ubuntu-22.04[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_connection [31m[2024-04-18 20:09:35] [ERROR] TESTER: agent-linux-ubuntu-2204-amd64 is not present in agent_control information[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive PASSED modules/testing/tests/test_agent/test_restart.py::test_clientKeys PASSED =================================== FAILURES =================================== _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-2204-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is not present in agent_control information') E AssertionError: None E assert 'agent-linux-ubuntu-2204-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_restart.py:76: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_restart.py::test_connection - As... =================== 1 failed, 4 passed, 2 warnings in 27.02s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:09:39] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:09:39] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:09:39] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:09:39] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:25.823981' end: '2024-04-18 20:10:06.996195' msg: non-zero return code rc: 1 start: '2024-04-18 20:09:41.172214' stderr: |- Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-18 20:09:41] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-18 20:09:42] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m FAILED[32m[2024-04-18 20:09:56] [INFO] TESTER: Restarting wazuh-agent in ubuntu-22.04[0m =================================== FAILURES =================================== __________________________________ test_stop ___________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-ubuntu-2204-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_stop(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_stop.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_stop.py::test_stop - requests.ex... ======================== 1 failed, 2 warnings in 25.44s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:10:07] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:10:07] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:10:07] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:10:07] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:58.457409' end: '2024-04-18 20:11:06.859565' msg: non-zero return code rc: 1 start: '2024-04-18 20:10:08.402156' stderr: |- Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_TIME = "es_AR.UTF-8", LC_MONETARY = "es_AR.UTF-8", LC_ADDRESS = "es_AR.UTF-8", LC_TELEPHONE = "es_AR.UTF-8", LC_NAME = "es_AR.UTF-8", LC_MEASUREMENT = "es_AR.UTF-8", LC_IDENTIFICATION = "es_AR.UTF-8", LC_NUMERIC = "es_AR.UTF-8", LC_PAPER = "es_AR.UTF-8", LANG = "C.UTF-8" are supported and installed on your system. perl: warning: Falling back to a fallback locale ("C.UTF-8"). locale: Cannot set LC_ALL to default locale: No such file or directory perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_TIME = "es_AR.UTF-8", LC_MONETARY = "es_AR.UTF-8", LC_ADDRESS = "es_AR.UTF-8", LC_TELEPHONE = "es_AR.UTF-8", LC_NAME = "es_AR.UTF-8", LC_MEASUREMENT = "es_AR.UTF-8", LC_IDENTIFICATION = "es_AR.UTF-8", LC_NUMERIC = "es_AR.UTF-8", LC_PAPER = "es_AR.UTF-8", LANG = "C.UTF-8" are supported and installed on your system. perl: warning: Falling back to a fallback locale ("C.UTF-8"). Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Removed /etc/systemd/system/multi-user.target.wants/wazuh-agent.service. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-54-91-255-1.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-18 20:10:08] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-18 20:10:10] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-18 20:10:24] [INFO] TESTER: Generating Snapshot for Checkfile in ubuntu-22.04[0m [32m[2024-04-18 20:10:35] [INFO] TESTER: Uninstalling Agent in ubuntu-22.04[0m [32m[2024-04-18 20:10:46] [INFO] TESTER: Generating Snapshot for Checkfile in ubuntu-22.04[0m [32m[2024-04-18 20:10:56] [INFO] TESTER: Applying filters in checkfiles in ubuntu-22.04[0m [32m[2024-04-18 20:10:56] [INFO] TESTER: Pre and post uninstall checkfile comparison in ubuntu-22.04: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m [31m[2024-04-18 20:10:58] [ERROR] TESTER: agent-linux-ubuntu-2204-amd64 is still connected in the Manager[0m FAILED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive FAILED =================================== FAILURES =================================== ________________________________ test_uninstall ________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-2204-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_uninstall(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not Active before the installation') assert HostInformation.dir_exists(agent_params, WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in the host {agent_names}') # Agent installation for agent_names, agent_params in wazuh_params['agents'].items(): WazuhAgent.perform_uninstall_and_scan_for_agent(agent_params,wazuh_params) # Manager uninstallation status check for agent_names, agent_params in wazuh_params['agents'].items(): > assert 'Disconnected' in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is still connected in the Manager') E AssertionError: None E assert 'Disconnected' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_uninstall.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-ubuntu-2204-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_uninstall.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_uninstall.py::test_uninstall - A... FAILED modules/testing/tests/test_agent/test_uninstall.py::test_isActive - re... =================== 2 failed, 1 passed, 2 warnings in 58.06s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:11:07] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:11:07] [INFO] TESTER: Cleaning up [2024-04-18 20:11:07] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:11:07] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:11:16] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:11:16] [INFO] TESTER: Cleaning up [2024-04-18 20:11:16] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:11:16] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:11:25] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:11:25] [INFO] [3958] [ThreadPoolExecutor-0_7] [workflow_engine]: [run-agent-linux-ubuntu-22.04-amd64-tests] Finished task in 302.77 seconds. [2024-04-18 20:11:35] [DEBUG] [3958] [ThreadPoolExecutor-0_11] [workflow_engine]: Finished task "run-agent-linux-debian-12-amd64-tests" execution with result: [2024-04-18 20:06:22] [INFO] TESTER: Running tests for ec2-3-80-51-50.compute-1.amazonaws.com [2024-04-18 20:06:22] [INFO] TESTER: Running tests for ec2-52-91-52-188.compute-1.amazonaws.com [2024-04-18 20:06:22] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-52-91-52-188.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-18 20:06:22] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-18 20:06:22] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:22] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-52-91-52-188.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-3-80-51-50.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.009330' end: '2024-04-18 20:06:24.236580' item: ec2-3-80-51-50.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:24.227250' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-52-91-52-188.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.005585' end: '2024-04-18 20:06:24.356696' item: ec2-52-91-52-188.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:24.351111' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:06:24] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-52-91-52-188.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:06:24] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:06:24] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:24] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' - --live=True - -s delta: '0:02:05.728380' end: '2024-04-18 20:08:32.027878' msg: '' rc: 0 start: '2024-04-18 20:06:26.299498' stderr: |- Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. --2024-04-18 23:08:02-- https://packages-dev.wazuh.com/pre-release/apt/pool/main/w/wazuh-agent/wazuh-agent_4.7.3-1_amd64.deb Resolving packages-dev.wazuh.com (packages-dev.wazuh.com)... 99.84.208.124, 99.84.208.61, 99.84.208.42, ... Connecting to packages-dev.wazuh.com (packages-dev.wazuh.com)|99.84.208.124|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 9362524 (8.9M) [binary/octet-stream] Saving to: 'wazuh-agent_4.7.3-1_amd64.deb' 0K .......... .......... .......... .......... .......... 0% 842K 11s 50K .......... .......... .......... .......... .......... 1% 850K 11s 100K .......... .......... .......... .......... .......... 1% 842K 11s 150K .......... .......... .......... .......... .......... 2% 86.3M 8s 200K .......... .......... .......... .......... .......... 2% 192M 6s 250K .......... .......... .......... .......... .......... 3% 846K 7s 300K .......... .......... .......... .......... .......... 3% 216M 6s 350K .......... .......... .......... .......... .......... 4% 200M 5s 400K .......... .......... .......... .......... .......... 4% 160M 5s 450K .......... .......... .......... .......... .......... 5% 152M 4s 500K .......... .......... .......... .......... .......... 6% 172M 4s 550K .......... .......... .......... .......... .......... 6% 870K 4s 600K .......... .......... .......... .......... .......... 7% 138M 4s 650K .......... .......... .......... .......... .......... 7% 53.5M 4s 700K .......... .......... .......... .......... .......... 8% 204M 3s 750K .......... .......... .......... .......... .......... 8% 201M 3s 800K .......... .......... .......... .......... .......... 9% 235M 3s 850K .......... .......... .......... .......... .......... 9% 179M 3s 900K .......... .......... .......... .......... .......... 10% 216M 3s 950K .......... .......... .......... .......... .......... 10% 214M 2s 1000K .......... .......... .......... .......... .......... 11% 184M 2s 1050K .......... .......... .......... .......... .......... 12% 157M 2s 1100K .......... .......... .......... .......... .......... 12% 178M 2s 1150K .......... .......... .......... .......... .......... 13% 215M 2s 1200K .......... .......... .......... .......... .......... 13% 894K 2s 1250K .......... .......... .......... .......... .......... 14% 111M 2s 1300K .......... .......... .......... .......... .......... 14% 59.7M 2s 1350K .......... .......... .......... .......... .......... 15% 159M 2s 1400K .......... .......... .......... .......... .......... 15% 198M 2s 1450K .......... .......... .......... .......... .......... 16% 206M 2s 1500K .......... .......... .......... .......... .......... 16% 146M 2s 1550K .......... .......... .......... .......... .......... 17% 189M 2s 1600K .......... .......... .......... .......... .......... 18% 217M 2s 1650K .......... .......... .......... .......... .......... 18% 235M 2s 1700K .......... .......... .......... .......... .......... 19% 151M 2s 1750K .......... .......... .......... .......... .......... 19% 177M 1s 1800K .......... .......... .......... .......... .......... 20% 217M 1s 1850K .......... .......... .......... .......... .......... 20% 222M 1s 1900K .......... .......... .......... .......... .......... 21% 23.1M 1s 1950K .......... .......... .......... .......... .......... 21% 54.3M 1s 2000K .......... .......... .......... .......... .......... 22% 63.9M 1s 2050K .......... .......... .......... .......... .......... 22% 113M 1s 2100K .......... .......... .......... .......... .......... 23% 38.4M 1s 2150K .......... .......... .......... .......... .......... 24% 199M 1s 2200K .......... .......... .......... .......... .......... 24% 39.8M 1s 2250K .......... .......... .......... .......... .......... 25% 128M 1s 2300K .......... .......... .......... .......... .......... 25% 190M 1s 2350K .......... .......... .......... .......... .......... 26% 132M 1s 2400K .......... .......... .......... .......... .......... 26% 54.3M 1s 2450K .......... .......... .......... .......... .......... 27% 1.05M 1s 2500K .......... .......... .......... .......... .......... 27% 151M 1s 2550K .......... .......... .......... .......... .......... 28% 197M 1s 2600K .......... .......... .......... .......... .......... 28% 195M 1s 2650K .......... .......... .......... .......... .......... 29% 207M 1s 2700K .......... .......... .......... .......... .......... 30% 212M 1s 2750K .......... .......... .......... .......... .......... 30% 211M 1s 2800K .......... .......... .......... .......... .......... 31% 211M 1s 2850K .......... .......... .......... .......... .......... 31% 183M 1s 2900K .......... .......... .......... .......... .......... 32% 210M 1s 2950K .......... .......... .......... .......... .......... 32% 204M 1s 3000K .......... .......... .......... .......... .......... 33% 215M 1s 3050K .......... .......... .......... .......... .......... 33% 230M 1s 3100K .......... .......... .......... .......... .......... 34% 215M 1s 3150K .......... .......... .......... .......... .......... 34% 112M 1s 3200K .......... .......... .......... .......... .......... 35% 182M 1s 3250K .......... .......... .......... .......... .......... 36% 220M 1s 3300K .......... .......... .......... .......... .......... 36% 189M 1s 3350K .......... .......... .......... .......... .......... 37% 200M 1s 3400K .......... .......... .......... .......... .......... 37% 160M 1s 3450K .......... .......... .......... .......... .......... 38% 188M 1s 3500K .......... .......... .......... .......... .......... 38% 206M 1s 3550K .......... .......... .......... .......... .......... 39% 194M 1s 3600K .......... .......... .......... .......... .......... 39% 97.1M 1s 3650K .......... .......... .......... .......... .......... 40% 163M 1s 3700K .......... .......... .......... .......... .......... 41% 204M 1s 3750K .......... .......... .......... .......... .......... 41% 180M 1s 3800K .......... .......... .......... .......... .......... 42% 206M 1s 3850K .......... .......... .......... .......... .......... 42% 144M 1s 3900K .......... .......... .......... .......... .......... 43% 144M 1s 3950K .......... .......... .......... .......... .......... 43% 206M 1s 4000K .......... .......... .......... .......... .......... 44% 121M 1s 4050K .......... .......... .......... .......... .......... 44% 205M 1s 4100K .......... .......... .......... .......... .......... 45% 195M 1s 4150K .......... .......... .......... .......... .......... 45% 201M 1s 4200K .......... .......... .......... .......... .......... 46% 131M 0s 4250K .......... .......... .......... .......... .......... 47% 155M 0s 4300K .......... .......... .......... .......... .......... 47% 182M 0s 4350K .......... .......... .......... .......... .......... 48% 216M 0s 4400K .......... .......... .......... .......... .......... 48% 215M 0s 4450K .......... .......... .......... .......... .......... 49% 209M 0s 4500K .......... .......... .......... .......... .......... 49% 219M 0s 4550K .......... .......... .......... .......... .......... 50% 179M 0s 4600K .......... .......... .......... .......... .......... 50% 210M 0s 4650K .......... .......... .......... .......... .......... 51% 180M 0s 4700K .......... .......... .......... .......... .......... 51% 182M 0s 4750K .......... .......... .......... .......... .......... 52% 212M 0s 4800K .......... .......... .......... .......... .......... 53% 203M 0s 4850K .......... .......... .......... .......... .......... 53% 214M 0s 4900K .......... .......... .......... .......... .......... 54% 194M 0s 4950K .......... .......... .......... .......... .......... 54% 1.05M 0s 5000K .......... .......... .......... .......... .......... 55% 235M 0s 5050K .......... .......... .......... .......... .......... 55% 182M 0s 5100K .......... .......... .......... .......... .......... 56% 53.8M 0s 5150K .......... .......... .......... .......... .......... 56% 220M 0s 5200K .......... .......... .......... .......... .......... 57% 104M 0s 5250K .......... .......... .......... .......... .......... 57% 164M 0s 5300K .......... .......... .......... .......... .......... 58% 114M 0s 5350K .......... .......... .......... .......... .......... 59% 127M 0s 5400K .......... .......... .......... .......... .......... 59% 109M 0s 5450K .......... .......... .......... .......... .......... 60% 74.9M 0s 5500K .......... .......... .......... .......... .......... 60% 106M 0s 5550K .......... .......... .......... .......... .......... 61% 160M 0s 5600K .......... .......... .......... .......... .......... 61% 153M 0s 5650K .......... .......... .......... .......... .......... 62% 202M 0s 5700K .......... .......... .......... .......... .......... 62% 155M 0s 5750K .......... .......... .......... .......... .......... 63% 191M 0s 5800K .......... .......... .......... .......... .......... 63% 206M 0s 5850K .......... .......... .......... .......... .......... 64% 210M 0s 5900K .......... .......... .......... .......... .......... 65% 105M 0s 5950K .......... .......... .......... .......... .......... 65% 166M 0s 6000K .......... .......... .......... .......... .......... 66% 174M 0s 6050K .......... .......... .......... .......... .......... 66% 123M 0s 6100K .......... .......... .......... .......... .......... 67% 153M 0s 6150K .......... .......... .......... .......... .......... 67% 224M 0s 6200K .......... .......... .......... .......... .......... 68% 121M 0s 6250K .......... .......... .......... .......... .......... 68% 147M 0s 6300K .......... .......... .......... .......... .......... 69% 221M 0s 6350K .......... .......... .......... .......... .......... 69% 149M 0s 6400K .......... .......... .......... .......... .......... 70% 172M 0s 6450K .......... .......... .......... .......... .......... 71% 191M 0s 6500K .......... .......... .......... .......... .......... 71% 149M 0s 6550K .......... .......... .......... .......... .......... 72% 78.3M 0s 6600K .......... .......... .......... .......... .......... 72% 179M 0s 6650K .......... .......... .......... .......... .......... 73% 85.3M 0s 6700K .......... .......... .......... .......... .......... 73% 131M 0s 6750K .......... .......... .......... .......... .......... 74% 130M 0s 6800K .......... .......... .......... .......... .......... 74% 167M 0s 6850K .......... .......... .......... .......... .......... 75% 140M 0s 6900K .......... .......... .......... .......... .......... 76% 52.6M 0s 6950K .......... .......... .......... .......... .......... 76% 150M 0s 7000K .......... .......... .......... .......... .......... 77% 204M 0s 7050K .......... .......... .......... .......... .......... 77% 204M 0s 7100K .......... .......... .......... .......... .......... 78% 210M 0s 7150K .......... .......... .......... .......... .......... 78% 138M 0s 7200K .......... .......... .......... .......... .......... 79% 182M 0s 7250K .......... .......... .......... .......... .......... 79% 190M 0s 7300K .......... .......... .......... .......... .......... 80% 143M 0s 7350K .......... .......... .......... .......... .......... 80% 85.5M 0s 7400K .......... .......... .......... .......... .......... 81% 94.4M 0s 7450K .......... .......... .......... .......... .......... 82% 202M 0s 7500K .......... .......... .......... .......... .......... 82% 209M 0s 7550K .......... .......... .......... .......... .......... 83% 113M 0s 7600K .......... .......... .......... .......... .......... 83% 201M 0s 7650K .......... .......... .......... .......... .......... 84% 174M 0s 7700K .......... .......... .......... .......... .......... 84% 191M 0s 7750K .......... .......... .......... .......... .......... 85% 110M 0s 7800K .......... .......... .......... .......... .......... 85% 151M 0s 7850K .......... .......... .......... .......... .......... 86% 189M 0s 7900K .......... .......... .......... .......... .......... 86% 147M 0s 7950K .......... .......... .......... .......... .......... 87% 79.9M 0s 8000K .......... .......... .......... .......... .......... 88% 165M 0s 8050K .......... .......... .......... .......... .......... 88% 166M 0s 8100K .......... .......... .......... .......... .......... 89% 72.9M 0s 8150K .......... .......... .......... .......... .......... 89% 185M 0s 8200K .......... .......... .......... .......... .......... 90% 205M 0s 8250K .......... .......... .......... .......... .......... 90% 211M 0s 8300K .......... .......... .......... .......... .......... 91% 152M 0s 8350K .......... .......... .......... .......... .......... 91% 205M 0s 8400K .......... .......... .......... .......... .......... 92% 176M 0s 8450K .......... .......... .......... .......... .......... 92% 206M 0s 8500K .......... .......... .......... .......... .......... 93% 142M 0s 8550K .......... .......... .......... .......... .......... 94% 209M 0s 8600K .......... .......... .......... .......... .......... 94% 144M 0s 8650K .......... .......... .......... .......... .......... 95% 105M 0s 8700K .......... .......... .......... .......... .......... 95% 203M 0s 8750K .......... .......... .......... .......... .......... 96% 239M 0s 8800K .......... .......... .......... .......... .......... 96% 161M 0s 8850K .......... .......... .......... .......... .......... 97% 200M 0s 8900K .......... .......... .......... .......... .......... 97% 213M 0s 8950K .......... .......... .......... .......... .......... 98% 1.40M 0s 9000K .......... .......... .......... .......... .......... 98% 104M 0s 9050K .......... .......... .......... .......... .......... 99% 142M 0s 9100K .......... .......... .......... .......... ... 100% 169M=0.5s 2024-04-18 23:08:03 (16.6 MB/s) - 'wazuh-agent_4.7.3-1_amd64.deb' saved [9362524/9362524] Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Created symlink /etc/systemd/system/multi-user.target.wants/wazuh-agent.service → /lib/systemd/system/wazuh-agent.service. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Job for wazuh-agent.service failed because the control process exited with error code. See "systemctl status wazuh-agent.service" and "journalctl -xeu wazuh-agent.service" for details. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-18 20:06:26] [INFO] TESTER: Checking connection to debian-12[0m [33m[2024-04-18 20:06:27] [WARNING] TESTER: Error on attempt 1 of 10: [Errno None] Unable to connect to port 2200 on 52.91.52.188[0m [32m[2024-04-18 20:06:58] [INFO] TESTER: Connection established successfully in debian-12[0m [32m[2024-04-18 20:07:00] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-18 20:07:01] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-18 20:07:03] [INFO] TESTER: No Firewall to disable on debian-12[0m [32m[2024-04-18 20:07:07] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-18 20:07:36] [INFO] TESTER: Installing Manager in ubuntu-22.04[0m [32m[2024-04-18 20:07:46] [INFO] TESTER: Generating Snapshot for Checkfile in debian-12[0m [32m[2024-04-18 20:08:00] [INFO] TESTER: Installing Agent in debian-12[0m [32m[2024-04-18 20:08:14] [INFO] TESTER: Generating Snapshot for Checkfile in debian-12[0m [32m[2024-04-18 20:08:24] [INFO] TESTER: Applying filters in checkfiles in debian-12[0m [32m[2024-04-18 20:08:24] [INFO] TESTER: Pre and post install checkfile comparison in debian-12: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m PASSED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-18 20:08:26] [INFO] TESTER: Getting status of debian-12[0m PASSED modules/testing/tests/test_agent/test_install.py::test_version PASSED modules/testing/tests/test_agent/test_install.py::test_revision PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ================== 4 passed, 2 warnings in 125.14s (0:02:05) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:08:32] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:08:32] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:08:32] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:08:32] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:37.438544' end: '2024-04-18 20:09:10.851202' msg: non-zero return code rc: 1 start: '2024-04-18 20:08:33.412658' stderr: |- Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-18 20:08:33] [INFO] TESTER: Checking connection to debian-12[0m [32m[2024-04-18 20:08:35] [INFO] TESTER: Connection established successfully in debian-12[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-18 20:08:50] [INFO] TESTER: Getting status of debian-12[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys PASSED =================================== FAILURES =================================== _______________________________ test_connection ________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:78: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive =================== 2 failed, 3 passed, 2 warnings in 37.00s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:09:11] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:09:11] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:09:11] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:09:11] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:29.645522' end: '2024-04-18 20:09:41.907473' msg: non-zero return code rc: 1 start: '2024-04-18 20:09:12.261951' stderr: |- Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-18 20:09:12] [INFO] TESTER: Checking connection to debian-12[0m [32m[2024-04-18 20:09:13] [INFO] TESTER: Connection established successfully in debian-12[0m [32m[2024-04-18 20:09:21] [INFO] TESTER: Restarting wazuh-agent in debian-12[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-18 20:09:34] [INFO] TESTER: Getting status of debian-12[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_connection [31m[2024-04-18 20:09:37] [ERROR] TESTER: agent-linux-debian-12-amd64 is not present in agent_control information[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive PASSED modules/testing/tests/test_agent/test_restart.py::test_clientKeys PASSED =================================== FAILURES =================================== _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is not present in agent_control information') E AssertionError: None E assert 'agent-linux-debian-12-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_restart.py:76: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_restart.py::test_connection - As... =================== 1 failed, 4 passed, 2 warnings in 29.26s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:09:42] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:09:42] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:09:42] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:09:42] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:30.651455' end: '2024-04-18 20:10:13.936260' msg: non-zero return code rc: 1 start: '2024-04-18 20:09:43.284805' stderr: |- Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-18 20:09:43] [INFO] TESTER: Checking connection to debian-12[0m [32m[2024-04-18 20:09:44] [INFO] TESTER: Connection established successfully in debian-12[0m FAILED[32m[2024-04-18 20:09:59] [INFO] TESTER: Restarting wazuh-agent in debian-12[0m =================================== FAILURES =================================== __________________________________ test_stop ___________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_stop(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_stop.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_stop.py::test_stop - requests.ex... ======================== 1 failed, 2 warnings in 30.27s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:10:14] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:10:14] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:10:14] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:10:14] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' - --live=True - -s delta: '0:01:01.416818' end: '2024-04-18 20:11:16.763574' msg: non-zero return code rc: 1 start: '2024-04-18 20:10:15.346756' stderr: |- Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. apt-listchanges: Can't set locale; make sure $LC_* and $LANG are correct! perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_TIME = "es_AR.UTF-8", LC_MONETARY = "es_AR.UTF-8", LC_ADDRESS = "es_AR.UTF-8", LC_TELEPHONE = "es_AR.UTF-8", LC_NAME = "es_AR.UTF-8", LC_MEASUREMENT = "es_AR.UTF-8", LC_IDENTIFICATION = "es_AR.UTF-8", LC_NUMERIC = "es_AR.UTF-8", LC_PAPER = "es_AR.UTF-8", LANG = "C.UTF-8" are supported and installed on your system. perl: warning: Falling back to a fallback locale ("C.UTF-8"). Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to disable unit: Unit file wazuh-agent.service does not exist. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. 2024/04/18 23:11:02 agent_control: INFO: Cannot find 'queue/db/wdb'. Waiting 1 seconds to reconnect. 2024/04/18 23:11:03 agent_control: INFO: Cannot find 'queue/db/wdb'. Waiting 2 seconds to reconnect. 2024/04/18 23:11:05 agent_control: INFO: Cannot find 'queue/db/wdb'. Waiting 3 seconds to reconnect. 2024/04/18 23:11:08 agent_control: ERROR: Unable to connect to socket 'queue/db/wdb'. 2024/04/18 23:11:08 agent_control: ERROR: Unable to connect to socket 'queue/db/wdb'. 2024/04/18 23:11:08 agent_control: ERROR: Unable to connect to socket 'queue/db/wdb' 2024/04/18 23:11:08 agent_control: ERROR: Error querying Wazuh DB to get the agent's 0 information. Warning: Permanently added '[ec2-52-91-52-188.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-18 20:10:15] [INFO] TESTER: Checking connection to debian-12[0m [32m[2024-04-18 20:10:17] [INFO] TESTER: Connection established successfully in debian-12[0m [32m[2024-04-18 20:10:30] [INFO] TESTER: Generating Snapshot for Checkfile in debian-12[0m [32m[2024-04-18 20:10:42] [INFO] TESTER: Uninstalling Agent in debian-12[0m [32m[2024-04-18 20:10:51] [INFO] TESTER: Generating Snapshot for Checkfile in debian-12[0m [32m[2024-04-18 20:11:00] [INFO] TESTER: Applying filters in checkfiles in debian-12[0m [32m[2024-04-18 20:11:00] [INFO] TESTER: Pre and post uninstall checkfile comparison in debian-12: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m [31m[2024-04-18 20:11:08] [ERROR] TESTER: agent-linux-debian-12-amd64 is still connected in the Manager[0m FAILED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive FAILED =================================== FAILURES =================================== ________________________________ test_uninstall ________________________________ wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_uninstall(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not Active before the installation') assert HostInformation.dir_exists(agent_params, WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in the host {agent_names}') # Agent installation for agent_names, agent_params in wazuh_params['agents'].items(): WazuhAgent.perform_uninstall_and_scan_for_agent(agent_params,wazuh_params) # Manager uninstallation status check for agent_names, agent_params in wazuh_params['agents'].items(): > assert 'Disconnected' in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is still connected in the Manager') E AssertionError: None E assert 'Disconnected' in '\nWazuh agent_control. List of available agents:\n ID: 000, Name: ip-172-31-20-143 (server), IP: 127.0.0.1, Unknown/Local\n\nList of agentless devices:\n\n' E + where '\nWazuh agent_control. List of available agents:\n ID: 000, Name: ip-172-31-20-143 (server), IP: 127.0.0.1, Unknown/Local\n\nList of agentless devices:\n\n' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_uninstall.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_uninstall.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_uninstall.py::test_uninstall - A... FAILED modules/testing/tests/test_agent/test_uninstall.py::test_isActive - re... ============== 2 failed, 1 passed, 2 warnings in 61.02s (0:01:01) ============== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:11:16] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:11:16] [INFO] TESTER: Cleaning up [2024-04-18 20:11:16] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:11:16] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:11:26] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:11:26] [INFO] TESTER: Cleaning up [2024-04-18 20:11:26] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:11:26] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:11:35] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:11:35] [INFO] [3958] [ThreadPoolExecutor-0_11] [workflow_engine]: [run-agent-linux-debian-12-amd64-tests] Finished task in 312.81 seconds. [2024-04-18 20:11:42] [DEBUG] [3958] [ThreadPoolExecutor-0_10] [workflow_engine]: Finished task "run-agent-linux-amazon-2-amd64-tests" execution with result: [2024-04-18 20:06:45] [INFO] TESTER: Running tests for ec2-3-80-51-50.compute-1.amazonaws.com [2024-04-18 20:06:45] [INFO] TESTER: Running tests for ec2-34-229-90-24.compute-1.amazonaws.com [2024-04-18 20:06:45] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-34-229-90-24.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-18 20:06:45] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-18 20:06:45] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:45] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-34-229-90-24.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-3-80-51-50.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.003963' end: '2024-04-18 20:06:46.506382' item: ec2-3-80-51-50.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:46.502419' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-34-229-90-24.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.003874' end: '2024-04-18 20:06:46.608040' item: ec2-34-229-90-24.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:46.604166' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:06:46] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-34-229-90-24.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:06:46] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:06:46] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:46] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' - --live=True - -s delta: '0:02:00.600967' end: '2024-04-18 20:08:49.566580' msg: '' rc: 0 start: '2024-04-18 20:06:48.965613' stderr: |- Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 1 9247k 1 129k 0 0 443k 0 0:00:20 --:--:-- 0:00:20 442k100 9247k 100 9247k 0 0 28.1M 0 --:--:-- --:--:-- --:--:-- 28.1M warning: wazuh-agent-4.7.3-1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 29111145: NOKEY Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Created symlink from /etc/systemd/system/multi-user.target.wants/wazuh-agent.service to /usr/lib/systemd/system/wazuh-agent.service. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Job for wazuh-agent.service failed because the control process exited with error code. See "systemctl status wazuh-agent.service" and "journalctl -xe" for details. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-18 20:06:49] [INFO] TESTER: Checking connection to amazon-2[0m [33m[2024-04-18 20:06:49] [WARNING] TESTER: Error on attempt 1 of 10: [Errno None] Unable to connect to port 2200 on 34.229.90.24[0m [33m[2024-04-18 20:07:20] [WARNING] TESTER: Error on attempt 2 of 10: [Errno None] Unable to connect to port 2200 on 34.229.90.24[0m [32m[2024-04-18 20:07:51] [INFO] TESTER: Connection established successfully in amazon-2[0m [32m[2024-04-18 20:07:53] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-18 20:07:55] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-18 20:07:57] [INFO] TESTER: No Firewall to disable on amazon-2[0m [32m[2024-04-18 20:07:59] [INFO] TESTER: Manager is already installed in ubuntu-22.04[0m [32m[2024-04-18 20:08:03] [INFO] TESTER: Generating Snapshot for Checkfile in amazon-2[0m [32m[2024-04-18 20:08:19] [INFO] TESTER: Installing Agent in amazon-2[0m [32m[2024-04-18 20:08:31] [INFO] TESTER: Generating Snapshot for Checkfile in amazon-2[0m [32m[2024-04-18 20:08:41] [INFO] TESTER: Applying filters in checkfiles in amazon-2[0m [32m[2024-04-18 20:08:41] [INFO] TESTER: Pre and post install checkfile comparison in amazon-2: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m PASSED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-18 20:08:43] [INFO] TESTER: Getting status of amazon-2[0m PASSED modules/testing/tests/test_agent/test_install.py::test_version PASSED modules/testing/tests/test_agent/test_install.py::test_revision PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ================== 4 passed, 2 warnings in 120.21s (0:02:00) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:08:49] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:08:49] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:08:49] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:08:49] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:31.009144' end: '2024-04-18 20:09:22.002655' msg: non-zero return code rc: 1 start: '2024-04-18 20:08:50.993511' stderr: |- Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-18 20:08:51] [INFO] TESTER: Checking connection to amazon-2[0m [32m[2024-04-18 20:08:52] [INFO] TESTER: Connection established successfully in amazon-2[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-18 20:09:09] [INFO] TESTER: Getting status of amazon-2[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys PASSED =================================== FAILURES =================================== _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-amazon-2-amd64': '/tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' E AssertionError: The agent-linux-amazon-2-amd64 is not present in the master by command E assert 'agent-linux-amazon-2-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_registration.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-amazon-2-amd64': '/tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive =================== 2 failed, 3 passed, 2 warnings in 30.58s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:09:22] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:09:22] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:09:22] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:09:22] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:26.483707' end: '2024-04-18 20:09:49.956115' msg: non-zero return code rc: 1 start: '2024-04-18 20:09:23.472408' stderr: |- Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-18 20:09:23] [INFO] TESTER: Checking connection to amazon-2[0m [32m[2024-04-18 20:09:25] [INFO] TESTER: Connection established successfully in amazon-2[0m [32m[2024-04-18 20:09:31] [INFO] TESTER: Restarting wazuh-agent in amazon-2[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-18 20:09:41] [INFO] TESTER: Getting status of amazon-2[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_connection [31m[2024-04-18 20:09:45] [ERROR] TESTER: agent-linux-amazon-2-amd64 is not present in agent_control information[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive PASSED modules/testing/tests/test_agent/test_restart.py::test_clientKeys PASSED =================================== FAILURES =================================== _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-amazon-2-amd64': '/tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is not present in agent_control information') E AssertionError: None E assert 'agent-linux-amazon-2-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_restart.py:76: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_restart.py::test_connection - As... =================== 1 failed, 4 passed, 2 warnings in 26.08s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:09:50] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:09:50] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:09:50] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:09:50] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:25.659105' end: '2024-04-18 20:10:17.024495' msg: non-zero return code rc: 1 start: '2024-04-18 20:09:51.365390' stderr: |- Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-18 20:09:51] [INFO] TESTER: Checking connection to amazon-2[0m [32m[2024-04-18 20:09:53] [INFO] TESTER: Connection established successfully in amazon-2[0m FAILED[32m[2024-04-18 20:10:05] [INFO] TESTER: Restarting wazuh-agent in amazon-2[0m =================================== FAILURES =================================== __________________________________ test_stop ___________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-amazon-2-amd64': '/tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_stop(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_stop.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_stop.py::test_stop - requests.ex... ======================== 1 failed, 2 warnings in 25.25s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:10:17] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:10:17] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:10:17] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:10:17] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' - --live=True - -s delta: '0:01:04.414018' end: '2024-04-18 20:11:22.866600' msg: non-zero return code rc: 1 start: '2024-04-18 20:10:18.452582' stderr: |- Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: RPMDB altered outside of yum. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to execute operation: No such file or directory Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. 2024/04/18 23:11:08 agent_control: INFO: Cannot find 'queue/db/wdb'. Waiting 1 seconds to reconnect. 2024/04/18 23:11:09 agent_control: INFO: Cannot find 'queue/db/wdb'. Waiting 2 seconds to reconnect. 2024/04/18 23:11:11 agent_control: INFO: Cannot find 'queue/db/wdb'. Waiting 3 seconds to reconnect. 2024/04/18 23:11:14 agent_control: ERROR: Unable to connect to socket 'queue/db/wdb'. 2024/04/18 23:11:14 agent_control: ERROR: Unable to connect to socket 'queue/db/wdb'. 2024/04/18 23:11:14 agent_control: ERROR: Unable to connect to socket 'queue/db/wdb' 2024/04/18 23:11:14 agent_control: ERROR: Error querying Wazuh DB to get the agent's 0 information. Warning: Permanently added '[ec2-34-229-90-24.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-18 20:10:18] [INFO] TESTER: Checking connection to amazon-2[0m [32m[2024-04-18 20:10:20] [INFO] TESTER: Connection established successfully in amazon-2[0m [32m[2024-04-18 20:10:32] [INFO] TESTER: Generating Snapshot for Checkfile in amazon-2[0m [32m[2024-04-18 20:10:44] [INFO] TESTER: Uninstalling Agent in amazon-2[0m [32m[2024-04-18 20:10:56] [INFO] TESTER: Generating Snapshot for Checkfile in amazon-2[0m [32m[2024-04-18 20:11:06] [INFO] TESTER: Applying filters in checkfiles in amazon-2[0m [32m[2024-04-18 20:11:06] [INFO] TESTER: Pre and post uninstall checkfile comparison in amazon-2: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m [31m[2024-04-18 20:11:14] [ERROR] TESTER: agent-linux-amazon-2-amd64 is still connected in the Manager[0m FAILED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive FAILED =================================== FAILURES =================================== ________________________________ test_uninstall ________________________________ wazuh_params = {'agents': {'agent-linux-amazon-2-amd64': '/tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_uninstall(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not Active before the installation') assert HostInformation.dir_exists(agent_params, WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in the host {agent_names}') # Agent installation for agent_names, agent_params in wazuh_params['agents'].items(): WazuhAgent.perform_uninstall_and_scan_for_agent(agent_params,wazuh_params) # Manager uninstallation status check for agent_names, agent_params in wazuh_params['agents'].items(): > assert 'Disconnected' in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is still connected in the Manager') E AssertionError: None E assert 'Disconnected' in '\nWazuh agent_control. List of available agents:\n ID: 000, Name: ip-172-31-20-143 (server), IP: 127.0.0.1, Unknown/Local\n\nList of agentless devices:\n\n' E + where '\nWazuh agent_control. List of available agents:\n ID: 000, Name: ip-172-31-20-143 (server), IP: 127.0.0.1, Unknown/Local\n\nList of agentless devices:\n\n' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_uninstall.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-amazon-2-amd64': '/tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_uninstall.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_uninstall.py::test_uninstall - A... FAILED modules/testing/tests/test_agent/test_uninstall.py::test_isActive - re... ============== 2 failed, 1 passed, 2 warnings in 64.02s (0:01:04) ============== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:11:23] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:11:23] [INFO] TESTER: Cleaning up [2024-04-18 20:11:23] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:11:23] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:11:32] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:11:32] [INFO] TESTER: Cleaning up [2024-04-18 20:11:32] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:11:32] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:11:42] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:11:42] [INFO] [3958] [ThreadPoolExecutor-0_10] [workflow_engine]: [run-agent-linux-amazon-2-amd64-tests] Finished task in 297.10 seconds. [2024-04-18 20:12:00] [DEBUG] [3958] [ThreadPoolExecutor-0_0] [workflow_engine]: Finished task "run-agent-linux-ubuntu-18.04-amd64-tests" execution with result: [2024-04-18 20:06:25] [INFO] TESTER: Running tests for ec2-3-80-51-50.compute-1.amazonaws.com [2024-04-18 20:06:25] [INFO] TESTER: Running tests for ec2-54-234-254-239.compute-1.amazonaws.com [2024-04-18 20:06:25] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-54-234-254-239.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-18 20:06:25] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-18 20:06:25] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:25] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-54-234-254-239.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-3-80-51-50.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.004782' end: '2024-04-18 20:06:26.859989' item: ec2-3-80-51-50.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:26.855207' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-54-234-254-239.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.004467' end: '2024-04-18 20:06:26.979348' item: ec2-54-234-254-239.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:26.974881' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:06:27] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-54-234-254-239.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:06:27] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:06:27] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:27] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:02:20.498783' end: '2024-04-18 20:08:48.934079' msg: '' rc: 0 start: '2024-04-18 20:06:28.435296' stderr: |- Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. --2024-04-18 23:08:14-- https://packages-dev.wazuh.com/pre-release/apt/pool/main/w/wazuh-agent/wazuh-agent_4.7.3-1_amd64.deb Resolving packages-dev.wazuh.com (packages-dev.wazuh.com)... 99.84.208.121, 99.84.208.124, 99.84.208.42, ... Connecting to packages-dev.wazuh.com (packages-dev.wazuh.com)|99.84.208.121|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 9362524 (8.9M) [binary/octet-stream] Saving to: 'wazuh-agent_4.7.3-1_amd64.deb' 0K .......... .......... .......... .......... .......... 0% 66.9M 0s 50K .......... .......... .......... .......... .......... 1% 79.6M 0s 100K .......... .......... .......... .......... .......... 1% 76.3M 0s 150K .......... .......... .......... .......... .......... 2% 46.7M 0s 200K .......... .......... .......... .......... .......... 2% 192M 0s 250K .......... .......... .......... .......... .......... 3% 118M 0s 300K .......... .......... .......... .......... .......... 3% 26.0M 0s 350K .......... .......... .......... .......... .......... 4% 135M 0s 400K .......... .......... .......... .......... .......... 4% 189M 0s 450K .......... .......... .......... .......... .......... 5% 18.4M 0s 500K .......... .......... .......... .......... .......... 6% 193M 0s 550K .......... .......... .......... .......... .......... 6% 157M 0s 600K .......... .......... .......... .......... .......... 7% 158M 0s 650K .......... .......... .......... .......... .......... 7% 50.0M 0s 700K .......... .......... .......... .......... .......... 8% 75.5M 0s 750K .......... .......... .......... .......... .......... 8% 33.7M 0s 800K .......... .......... .......... .......... .......... 9% 185M 0s 850K .......... .......... .......... .......... .......... 9% 132M 0s 900K .......... .......... .......... .......... .......... 10% 133M 0s 950K .......... .......... .......... .......... .......... 10% 44.7M 0s 1000K .......... .......... .......... .......... .......... 11% 52.4M 0s 1050K .......... .......... .......... .......... .......... 12% 187M 0s 1100K .......... .......... .......... .......... .......... 12% 19.7M 0s 1150K .......... .......... .......... .......... .......... 13% 188M 0s 1200K .......... .......... .......... .......... .......... 13% 195M 0s 1250K .......... .......... .......... .......... .......... 14% 198M 0s 1300K .......... .......... .......... .......... .......... 14% 115M 0s 1350K .......... .......... .......... .......... .......... 15% 16.5M 0s 1400K .......... .......... .......... .......... .......... 15% 189M 0s 1450K .......... .......... .......... .......... .......... 16% 192M 0s 1500K .......... .......... .......... .......... .......... 16% 111M 0s 1550K .......... .......... .......... .......... .......... 17% 104M 0s 1600K .......... .......... .......... .......... .......... 18% 124M 0s 1650K .......... .......... .......... .......... .......... 18% 95.5M 0s 1700K .......... .......... .......... .......... .......... 19% 53.1M 0s 1750K .......... .......... .......... .......... .......... 19% 189M 0s 1800K .......... .......... .......... .......... .......... 20% 157M 0s 1850K .......... .......... .......... .......... .......... 20% 27.1M 0s 1900K .......... .......... .......... .......... .......... 21% 101M 0s 1950K .......... .......... .......... .......... .......... 21% 51.8M 0s 2000K .......... .......... .......... .......... .......... 22% 11.0M 0s 2050K .......... .......... .......... .......... .......... 22% 26.3M 0s 2100K .......... .......... .......... .......... .......... 23% 101M 0s 2150K .......... .......... .......... .......... .......... 24% 131M 0s 2200K .......... .......... .......... .......... .......... 24% 144M 0s 2250K .......... .......... .......... .......... .......... 25% 61.9M 0s 2300K .......... .......... .......... .......... .......... 25% 30.5M 0s 2350K .......... .......... .......... .......... .......... 26% 60.9M 0s 2400K .......... .......... .......... .......... .......... 26% 151M 0s 2450K .......... .......... .......... .......... .......... 27% 28.7M 0s 2500K .......... .......... .......... .......... .......... 27% 11.1M 0s 2550K .......... .......... .......... .......... .......... 28% 39.0M 0s 2600K .......... .......... .......... .......... .......... 28% 35.7M 0s 2650K .......... .......... .......... .......... .......... 29% 33.0M 0s 2700K .......... .......... .......... .......... .......... 30% 14.2M 0s 2750K .......... .......... .......... .......... .......... 30% 23.7M 0s 2800K .......... .......... .......... .......... .......... 31% 36.6M 0s 2850K .......... .......... .......... .......... .......... 31% 13.0M 0s 2900K .......... .......... .......... .......... .......... 32% 190M 0s 2950K .......... .......... .......... .......... .......... 32% 57.8M 0s 3000K .......... .......... .......... .......... .......... 33% 12.3M 0s 3050K .......... .......... .......... .......... .......... 33% 169M 0s 3100K .......... .......... .......... .......... .......... 34% 137M 0s 3150K .......... .......... .......... .......... .......... 34% 155M 0s 3200K .......... .......... .......... .......... .......... 35% 65.6M 0s 3250K .......... .......... .......... .......... .......... 36% 164M 0s 3300K .......... .......... .......... .......... .......... 36% 140M 0s 3350K .......... .......... .......... .......... .......... 37% 68.7M 0s 3400K .......... .......... .......... .......... .......... 37% 163M 0s 3450K .......... .......... .......... .......... .......... 38% 171M 0s 3500K .......... .......... .......... .......... .......... 38% 88.5M 0s 3550K .......... .......... .......... .......... .......... 39% 114M 0s 3600K .......... .......... .......... .......... .......... 39% 108M 0s 3650K .......... .......... .......... .......... .......... 40% 57.9M 0s 3700K .......... .......... .......... .......... .......... 41% 120M 0s 3750K .......... .......... .......... .......... .......... 41% 17.2M 0s 3800K .......... .......... .......... .......... .......... 42% 141M 0s 3850K .......... .......... .......... .......... .......... 42% 142M 0s 3900K .......... .......... .......... .......... .......... 43% 89.2M 0s 3950K .......... .......... .......... .......... .......... 43% 130M 0s 4000K .......... .......... .......... .......... .......... 44% 59.9M 0s 4050K .......... .......... .......... .......... .......... 44% 92.0M 0s 4100K .......... .......... .......... .......... .......... 45% 46.3M 0s 4150K .......... .......... .......... .......... .......... 45% 32.0M 0s 4200K .......... .......... .......... .......... .......... 46% 59.6M 0s 4250K .......... .......... .......... .......... .......... 47% 27.8M 0s 4300K .......... .......... .......... .......... .......... 47% 189M 0s 4350K .......... .......... .......... .......... .......... 48% 146M 0s 4400K .......... .......... .......... .......... .......... 48% 34.7M 0s 4450K .......... .......... .......... .......... .......... 49% 196M 0s 4500K .......... .......... .......... .......... .......... 49% 18.3M 0s 4550K .......... .......... .......... .......... .......... 50% 185M 0s 4600K .......... .......... .......... .......... .......... 50% 189M 0s 4650K .......... .......... .......... .......... .......... 51% 73.2M 0s 4700K .......... .......... .......... .......... .......... 51% 161M 0s 4750K .......... .......... .......... .......... .......... 52% 113M 0s 4800K .......... .......... .......... .......... .......... 53% 16.6M 0s 4850K .......... .......... .......... .......... .......... 53% 181M 0s 4900K .......... .......... .......... .......... .......... 54% 47.8M 0s 4950K .......... .......... .......... .......... .......... 54% 157M 0s 5000K .......... .......... .......... .......... .......... 55% 198M 0s 5050K .......... .......... .......... .......... .......... 55% 111M 0s 5100K .......... .......... .......... .......... .......... 56% 40.8M 0s 5150K .......... .......... .......... .......... .......... 56% 141M 0s 5200K .......... .......... .......... .......... .......... 57% 20.9M 0s 5250K .......... .......... .......... .......... .......... 57% 108M 0s 5300K .......... .......... .......... .......... .......... 58% 153M 0s 5350K .......... .......... .......... .......... .......... 59% 32.1M 0s 5400K .......... .......... .......... .......... .......... 59% 72.0M 0s 5450K .......... .......... .......... .......... .......... 60% 27.2M 0s 5500K .......... .......... .......... .......... .......... 60% 158M 0s 5550K .......... .......... .......... .......... .......... 61% 195M 0s 5600K .......... .......... .......... .......... .......... 61% 44.3M 0s 5650K .......... .......... .......... .......... .......... 62% 42.1M 0s 5700K .......... .......... .......... .......... .......... 62% 129M 0s 5750K .......... .......... .......... .......... .......... 63% 142M 0s 5800K .......... .......... .......... .......... .......... 63% 31.8M 0s 5850K .......... .......... .......... .......... .......... 64% 10.7M 0s 5900K .......... .......... .......... .......... .......... 65% 51.9M 0s 5950K .......... .......... .......... .......... .......... 65% 29.6M 0s 6000K .......... .......... .......... .......... .......... 66% 172M 0s 6050K .......... .......... .......... .......... .......... 66% 93.8M 0s 6100K .......... .......... .......... .......... .......... 67% 47.9M 0s 6150K .......... .......... .......... .......... .......... 67% 149M 0s 6200K .......... .......... .......... .......... .......... 68% 37.9M 0s 6250K .......... .......... .......... .......... .......... 68% 33.8M 0s 6300K .......... .......... .......... .......... .......... 69% 122M 0s 6350K .......... .......... .......... .......... .......... 69% 19.4M 0s 6400K .......... .......... .......... .......... .......... 70% 154M 0s 6450K .......... .......... .......... .......... .......... 71% 120M 0s 6500K .......... .......... .......... .......... .......... 71% 187M 0s 6550K .......... .......... .......... .......... .......... 72% 41.1M 0s 6600K .......... .......... .......... .......... .......... 72% 52.7M 0s 6650K .......... .......... .......... .......... .......... 73% 28.1M 0s 6700K .......... .......... .......... .......... .......... 73% 76.1M 0s 6750K .......... .......... .......... .......... .......... 74% 26.9M 0s 6800K .......... .......... .......... .......... .......... 74% 203M 0s 6850K .......... .......... .......... .......... .......... 75% 94.4M 0s 6900K .......... .......... .......... .......... .......... 76% 24.0M 0s 6950K .......... .......... .......... .......... .......... 76% 157M 0s 7000K .......... .......... .......... .......... .......... 77% 117M 0s 7050K .......... .......... .......... .......... .......... 77% 137M 0s 7100K .......... .......... .......... .......... .......... 78% 162M 0s 7150K .......... .......... .......... .......... .......... 78% 16.9M 0s 7200K .......... .......... .......... .......... .......... 79% 158M 0s 7250K .......... .......... .......... .......... .......... 79% 192M 0s 7300K .......... .......... .......... .......... .......... 80% 38.0M 0s 7350K .......... .......... .......... .......... .......... 80% 31.2M 0s 7400K .......... .......... .......... .......... .......... 81% 65.3M 0s 7450K .......... .......... .......... .......... .......... 82% 50.3M 0s 7500K .......... .......... .......... .......... .......... 82% 46.6M 0s 7550K .......... .......... .......... .......... .......... 83% 37.4M 0s 7600K .......... .......... .......... .......... .......... 83% 8.87M 0s 7650K .......... .......... .......... .......... .......... 84% 47.5M 0s 7700K .......... .......... .......... .......... .......... 84% 52.6M 0s 7750K .......... .......... .......... .......... .......... 85% 58.1M 0s 7800K .......... .......... .......... .......... .......... 85% 16.0M 0s 7850K .......... .......... .......... .......... .......... 86% 29.9M 0s 7900K .......... .......... .......... .......... .......... 86% 18.2M 0s 7950K .......... .......... .......... .......... .......... 87% 11.1M 0s 8000K .......... .......... .......... .......... .......... 88% 34.3M 0s 8050K .......... .......... .......... .......... .......... 88% 70.7M 0s 8100K .......... .......... .......... .......... .......... 89% 27.6M 0s 8150K .......... .......... .......... .......... .......... 89% 12.3M 0s 8200K .......... .......... .......... .......... .......... 90% 11.6M 0s 8250K .......... .......... .......... .......... .......... 90% 185M 0s 8300K .......... .......... .......... .......... .......... 91% 150M 0s 8350K .......... .......... .......... .......... .......... 91% 151M 0s 8400K .......... .......... .......... .......... .......... 92% 135M 0s 8450K .......... .......... .......... .......... .......... 92% 64.9M 0s 8500K .......... .......... .......... .......... .......... 93% 187M 0s 8550K .......... .......... .......... .......... .......... 94% 172M 0s 8600K .......... .......... .......... .......... .......... 94% 17.4M 0s 8650K .......... .......... .......... .......... .......... 95% 17.9M 0s 8700K .......... .......... .......... .......... .......... 95% 15.5M 0s 8750K .......... .......... .......... .......... .......... 96% 166M 0s 8800K .......... .......... .......... .......... .......... 96% 84.3M 0s 8850K .......... .......... .......... .......... .......... 97% 49.2M 0s 8900K .......... .......... .......... .......... .......... 97% 33.2M 0s 8950K .......... .......... .......... .......... .......... 98% 92.9M 0s 9000K .......... .......... .......... .......... .......... 98% 182M 0s 9050K .......... .......... .......... .......... .......... 99% 163M 0s 9100K .......... .......... .......... .......... ... 100% 134M=0.2s 2024-04-18 23:08:14 (45.9 MB/s) - 'wazuh-agent_4.7.3-1_amd64.deb' saved [9362524/9362524] Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Created symlink /etc/systemd/system/multi-user.target.wants/wazuh-agent.service → /usr/lib/systemd/system/wazuh-agent.service. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Job for wazuh-agent.service failed because the control process exited with error code. See "systemctl status wazuh-agent.service" and "journalctl -xe" for details. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-18 20:06:28] [INFO] TESTER: Checking connection to ubuntu-18.04[0m [33m[2024-04-18 20:06:30] [WARNING] TESTER: Error on attempt 1 of 10: [Errno None] Unable to connect to port 2200 on 54.234.254.239[0m [32m[2024-04-18 20:07:01] [INFO] TESTER: Connection established successfully in ubuntu-18.04[0m [32m[2024-04-18 20:07:04] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-18 20:07:05] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-18 20:07:07] [INFO] TESTER: No Firewall to disable on ubuntu-18.04[0m [32m[2024-04-18 20:07:11] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-18 20:07:40] [INFO] TESTER: Installing Manager in ubuntu-22.04[0m [32m[2024-04-18 20:07:50] [INFO] TESTER: Generating Snapshot for Checkfile in ubuntu-18.04[0m [32m[2024-04-18 20:08:11] [INFO] TESTER: Installing Agent in ubuntu-18.04[0m [32m[2024-04-18 20:08:28] [INFO] TESTER: Generating Snapshot for Checkfile in ubuntu-18.04[0m [32m[2024-04-18 20:08:39] [INFO] TESTER: Applying filters in checkfiles in ubuntu-18.04[0m [32m[2024-04-18 20:08:39] [INFO] TESTER: Pre and post install checkfile comparison in ubuntu-18.04: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m PASSED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-18 20:08:41] [INFO] TESTER: Getting status of ubuntu-18.04[0m PASSED modules/testing/tests/test_agent/test_install.py::test_version PASSED modules/testing/tests/test_agent/test_install.py::test_revision PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ================== 4 passed, 2 warnings in 140.07s (0:02:20) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:08:49] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:08:49] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:08:49] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:08:49] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:32.334733' end: '2024-04-18 20:09:22.713383' msg: non-zero return code rc: 1 start: '2024-04-18 20:08:50.378650' stderr: |- Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-18 20:08:50] [INFO] TESTER: Checking connection to ubuntu-18.04[0m [32m[2024-04-18 20:08:52] [INFO] TESTER: Connection established successfully in ubuntu-18.04[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-18 20:09:09] [INFO] TESTER: Getting status of ubuntu-18.04[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys PASSED =================================== FAILURES =================================== _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' E AssertionError: The agent-linux-ubuntu-1804-amd64 is not present in the master by command E assert 'agent-linux-ubuntu-1804-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_registration.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive =================== 2 failed, 3 passed, 2 warnings in 31.88s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:09:22] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:09:22] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:09:22] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:09:22] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:32.119267' end: '2024-04-18 20:09:56.348394' msg: non-zero return code rc: 1 start: '2024-04-18 20:09:24.229127' stderr: |- Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-18 20:09:24] [INFO] TESTER: Checking connection to ubuntu-18.04[0m [32m[2024-04-18 20:09:25] [INFO] TESTER: Connection established successfully in ubuntu-18.04[0m [32m[2024-04-18 20:09:32] [INFO] TESTER: Restarting wazuh-agent in ubuntu-18.04[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-18 20:09:47] [INFO] TESTER: Getting status of ubuntu-18.04[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_connection [31m[2024-04-18 20:09:51] [ERROR] TESTER: agent-linux-ubuntu-1804-amd64 is not present in agent_control information[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive PASSED modules/testing/tests/test_agent/test_restart.py::test_clientKeys PASSED =================================== FAILURES =================================== _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is not present in agent_control information') E AssertionError: None E assert 'agent-linux-ubuntu-1804-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_restart.py:76: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_restart.py::test_connection - As... =================== 1 failed, 4 passed, 2 warnings in 31.73s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:09:56] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:09:56] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:09:56] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:09:56] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:29.793758' end: '2024-04-18 20:10:27.500900' msg: non-zero return code rc: 1 start: '2024-04-18 20:09:57.707142' stderr: |- Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-18 20:09:58] [INFO] TESTER: Checking connection to ubuntu-18.04[0m [32m[2024-04-18 20:09:59] [INFO] TESTER: Connection established successfully in ubuntu-18.04[0m FAILED[32m[2024-04-18 20:10:12] [INFO] TESTER: Restarting wazuh-agent in ubuntu-18.04[0m =================================== FAILURES =================================== __________________________________ test_stop ___________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_stop(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_stop.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_stop.py::test_stop - requests.ex... ======================== 1 failed, 2 warnings in 29.42s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:10:27] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:10:27] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:10:27] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:10:27] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:01:12.790276' end: '2024-04-18 20:11:41.651743' msg: non-zero return code rc: 1 start: '2024-04-18 20:10:28.861467' stderr: |- Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_TIME = "es_AR.UTF-8", LC_MONETARY = "es_AR.UTF-8", LC_ADDRESS = "es_AR.UTF-8", LC_TELEPHONE = "es_AR.UTF-8", LC_NAME = "es_AR.UTF-8", LC_MEASUREMENT = "es_AR.UTF-8", LC_IDENTIFICATION = "es_AR.UTF-8", LC_NUMERIC = "es_AR.UTF-8", LC_PAPER = "es_AR.UTF-8", LANG = "C.UTF-8" are supported and installed on your system. perl: warning: Falling back to a fallback locale ("C.UTF-8"). locale: Cannot set LC_ALL to default locale: No such file or directory Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Removed /etc/systemd/system/multi-user.target.wants/wazuh-agent.service. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. 2024/04/18 23:11:25 agent_control: INFO: Cannot find 'queue/db/wdb'. Waiting 1 seconds to reconnect. 2024/04/18 23:11:26 agent_control: INFO: Cannot find 'queue/db/wdb'. Waiting 2 seconds to reconnect. 2024/04/18 23:11:28 agent_control: INFO: Cannot find 'queue/db/wdb'. Waiting 3 seconds to reconnect. 2024/04/18 23:11:31 agent_control: ERROR: Unable to connect to socket 'queue/db/wdb'. 2024/04/18 23:11:31 agent_control: ERROR: Unable to connect to socket 'queue/db/wdb'. 2024/04/18 23:11:31 agent_control: ERROR: Unable to connect to socket 'queue/db/wdb' 2024/04/18 23:11:31 agent_control: ERROR: Error querying Wazuh DB to get the agent's 0 information. Warning: Permanently added '[ec2-54-234-254-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-18 20:10:29] [INFO] TESTER: Checking connection to ubuntu-18.04[0m [32m[2024-04-18 20:10:30] [INFO] TESTER: Connection established successfully in ubuntu-18.04[0m [32m[2024-04-18 20:10:44] [INFO] TESTER: Generating Snapshot for Checkfile in ubuntu-18.04[0m [32m[2024-04-18 20:10:58] [INFO] TESTER: Uninstalling Agent in ubuntu-18.04[0m [32m[2024-04-18 20:11:12] [INFO] TESTER: Generating Snapshot for Checkfile in ubuntu-18.04[0m [32m[2024-04-18 20:11:23] [INFO] TESTER: Applying filters in checkfiles in ubuntu-18.04[0m [32m[2024-04-18 20:11:23] [INFO] TESTER: Pre and post uninstall checkfile comparison in ubuntu-18.04: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m [31m[2024-04-18 20:11:31] [ERROR] TESTER: agent-linux-ubuntu-1804-amd64 is still connected in the Manager[0m FAILED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive FAILED =================================== FAILURES =================================== ________________________________ test_uninstall ________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_uninstall(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not Active before the installation') assert HostInformation.dir_exists(agent_params, WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in the host {agent_names}') # Agent installation for agent_names, agent_params in wazuh_params['agents'].items(): WazuhAgent.perform_uninstall_and_scan_for_agent(agent_params,wazuh_params) # Manager uninstallation status check for agent_names, agent_params in wazuh_params['agents'].items(): > assert 'Disconnected' in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is still connected in the Manager') E AssertionError: None E assert 'Disconnected' in '\nWazuh agent_control. List of available agents:\n ID: 000, Name: ip-172-31-20-143 (server), IP: 127.0.0.1, Unknown/Local\n\nList of agentless devices:\n\n' E + where '\nWazuh agent_control. List of available agents:\n ID: 000, Name: ip-172-31-20-143 (server), IP: 127.0.0.1, Unknown/Local\n\nList of agentless devices:\n\n' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_uninstall.py:77: AssertionError ________________________________ test_isActive _________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_uninstall.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _authenticate(self): with open(self.inventory_path, 'r') as yaml_file: inventory_data = yaml.safe_load(yaml_file) user = 'wazuh' #----Patch issue https://github.com/wazuh/wazuh-packages/issues/2883------------- file_path = Executor.execute_command(self.inventory_path, 'pwd').replace("\n","") + '/wazuh-install-files/wazuh-passwords.txt' if not 'true' in Executor.execute_command(self.inventory_path, f'test -f {file_path} && echo "true" || echo "false"'): Executor.execute_command(self.inventory_path, 'tar -xvf wazuh-install-files.tar') password = Executor.execute_command(self.inventory_path, "grep api_password wazuh-install-files/wazuh-passwords.txt | head -n 1 | awk '{print $NF}'").replace("'","").replace("\n","") #-------------------------------------------------------------------------------- login_endpoint = 'security/user/authenticate' host = inventory_data.get('ansible_host') port = '55000' login_url = f"https://{host}:{port}/{login_endpoint}" basic_auth = f"{user}:{password}".encode() login_headers = {'Content-Type': 'application/json', 'Authorization': f'Basic {b64encode(basic_auth).decode()}'} > token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] E KeyError: 'data' modules/testing/tests/helpers/executor.py:81: KeyError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_uninstall.py::test_uninstall - A... FAILED modules/testing/tests/test_agent/test_uninstall.py::test_isActive - Ke... ============== 2 failed, 1 passed, 2 warnings in 72.41s (0:01:12) ============== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:11:41] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:11:41] [INFO] TESTER: Cleaning up [2024-04-18 20:11:41] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:11:41] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:11:51] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:11:51] [INFO] TESTER: Cleaning up [2024-04-18 20:11:51] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:11:51] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:12:00] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:12:00] [INFO] [3958] [ThreadPoolExecutor-0_0] [workflow_engine]: [run-agent-linux-ubuntu-18.04-amd64-tests] Finished task in 336.20 seconds. [2024-04-18 20:15:29] [DEBUG] [3958] [ThreadPoolExecutor-0_6] [workflow_engine]: Finished task "run-agent-linux-centos-8-amd64-tests" execution with result: [2024-04-18 20:06:24] [INFO] TESTER: Running tests for ec2-3-80-51-50.compute-1.amazonaws.com [2024-04-18 20:06:24] [INFO] TESTER: Running tests for ec2-54-91-99-46.compute-1.amazonaws.com [2024-04-18 20:06:24] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-54-91-99-46.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-18 20:06:24] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-18 20:06:24] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:24] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-54-91-99-46.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-3-80-51-50.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.004904' end: '2024-04-18 20:06:26.346969' item: ec2-3-80-51-50.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:26.342065' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-54-91-99-46.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.004505' end: '2024-04-18 20:06:26.469191' item: ec2-54-91-99-46.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:26.464686' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:06:26] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-54-91-99-46.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:06:26] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:06:26] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:26] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' - --live=True - -s delta: '0:04:44.001009' end: '2024-04-18 20:11:12.142265' msg: '' rc: 0 start: '2024-04-18 20:06:28.141256' stderr: |- Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0100 9247k 100 9247k 0 0 22.6M 0 --:--:-- --:--:-- --:--:-- 22.6M warning: wazuh-agent-4.7.3-1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 29111145: NOKEY Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Created symlink /etc/systemd/system/multi-user.target.wants/wazuh-agent.service → /usr/lib/systemd/system/wazuh-agent.service. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Job for wazuh-agent.service failed because the control process exited with error code. See "systemctl status wazuh-agent.service" and "journalctl -xe" for details. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-18 20:06:28] [INFO] TESTER: Checking connection to centos-8[0m [33m[2024-04-18 20:06:33] [WARNING] TESTER: Error on attempt 1 of 10: [Errno None] Unable to connect to port 2200 on 54.91.99.46[0m [33m[2024-04-18 20:07:04] [WARNING] TESTER: Error on attempt 2 of 10: [Errno None] Unable to connect to port 2200 on 54.91.99.46[0m [33m[2024-04-18 20:07:34] [WARNING] TESTER: Error on attempt 3 of 10: [Errno None] Unable to connect to port 2200 on 54.91.99.46[0m [33m[2024-04-18 20:08:04] [WARNING] TESTER: Error on attempt 4 of 10: [Errno None] Unable to connect to port 2200 on 54.91.99.46[0m [32m[2024-04-18 20:08:36] [INFO] TESTER: Connection established successfully in centos-8[0m [32m[2024-04-18 20:08:38] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-18 20:08:39] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-18 20:08:41] [INFO] TESTER: No Firewall to disable on centos-8[0m [32m[2024-04-18 20:08:43] [INFO] TESTER: Manager is already installed in ubuntu-22.04[0m [32m[2024-04-18 20:08:47] [INFO] TESTER: Generating Snapshot for Checkfile in centos-8[0m [32m[2024-04-18 20:09:03] [INFO] TESTER: Installing Agent in centos-8[0m [32m[2024-04-18 20:10:53] [INFO] TESTER: Generating Snapshot for Checkfile in centos-8[0m [32m[2024-04-18 20:11:03] [INFO] TESTER: Applying filters in checkfiles in centos-8[0m [32m[2024-04-18 20:11:03] [INFO] TESTER: Pre and post install checkfile comparison in centos-8: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m PASSED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-18 20:11:05] [INFO] TESTER: Getting status of centos-8[0m PASSED modules/testing/tests/test_agent/test_install.py::test_version PASSED modules/testing/tests/test_agent/test_install.py::test_revision PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ================== 4 passed, 2 warnings in 283.62s (0:04:43) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:11:12] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:11:12] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:11:12] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:11:12] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:31.420446' end: '2024-04-18 20:11:44.945859' msg: non-zero return code rc: 1 start: '2024-04-18 20:11:13.525413' stderr: |- Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-18 20:11:13] [INFO] TESTER: Checking connection to centos-8[0m [32m[2024-04-18 20:11:15] [INFO] TESTER: Connection established successfully in centos-8[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-18 20:11:31] [INFO] TESTER: Getting status of centos-8[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys PASSED =================================== FAILURES =================================== _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-centos-8-amd64': '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' E AssertionError: The agent-linux-centos-8-amd64 is not present in the master by command E assert 'agent-linux-centos-8-amd64' in '\nWazuh agent_control. List of available agents:\n ID: 000, Name: ip-172-31-20-143 (server), IP: 127.0.0.1, Active/Local\n\nList of agentless devices:\n\n' E + where '\nWazuh agent_control. List of available agents:\n ID: 000, Name: ip-172-31-20-143 (server), IP: 127.0.0.1, Active/Local\n\nList of agentless devices:\n\n' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_registration.py:77: AssertionError ________________________________ test_isActive _________________________________ wazuh_params = {'agents': {'agent-linux-centos-8-amd64': '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _authenticate(self): with open(self.inventory_path, 'r') as yaml_file: inventory_data = yaml.safe_load(yaml_file) user = 'wazuh' #----Patch issue https://github.com/wazuh/wazuh-packages/issues/2883------------- file_path = Executor.execute_command(self.inventory_path, 'pwd').replace("\n","") + '/wazuh-install-files/wazuh-passwords.txt' if not 'true' in Executor.execute_command(self.inventory_path, f'test -f {file_path} && echo "true" || echo "false"'): Executor.execute_command(self.inventory_path, 'tar -xvf wazuh-install-files.tar') password = Executor.execute_command(self.inventory_path, "grep api_password wazuh-install-files/wazuh-passwords.txt | head -n 1 | awk '{print $NF}'").replace("'","").replace("\n","") #-------------------------------------------------------------------------------- login_endpoint = 'security/user/authenticate' host = inventory_data.get('ansible_host') port = '55000' login_url = f"https://{host}:{port}/{login_endpoint}" basic_auth = f"{user}:{password}".encode() login_headers = {'Content-Type': 'application/json', 'Authorization': f'Basic {b64encode(basic_auth).decode()}'} > token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] E KeyError: 'data' modules/testing/tests/helpers/executor.py:81: KeyError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive =================== 2 failed, 3 passed, 2 warnings in 31.01s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:11:45] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:11:45] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:11:45] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:11:45] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:37.858828' end: '2024-04-18 20:12:24.152502' msg: '' rc: 0 start: '2024-04-18 20:11:46.293674' stderr: |- Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-18 20:11:46] [INFO] TESTER: Checking connection to centos-8[0m [32m[2024-04-18 20:11:48] [INFO] TESTER: Connection established successfully in centos-8[0m [32m[2024-04-18 20:11:56] [INFO] TESTER: Restarting wazuh-agent in centos-8[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-18 20:12:13] [INFO] TESTER: Getting status of centos-8[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_connection PASSED modules/testing/tests/test_agent/test_restart.py::test_isActive PASSED modules/testing/tests/test_agent/test_restart.py::test_clientKeys PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ======================== 5 passed, 2 warnings in 37.49s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:12:24] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:12:24] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:12:24] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:12:24] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:39.013619' end: '2024-04-18 20:13:04.530637' msg: '' rc: 0 start: '2024-04-18 20:12:25.517018' stderr: |- Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-18 20:12:25] [INFO] TESTER: Checking connection to centos-8[0m [32m[2024-04-18 20:12:27] [INFO] TESTER: Connection established successfully in centos-8[0m [32m[2024-04-18 20:12:44] [INFO] TESTER: Stopping wazuh-agent in centos-8[0m [32m[2024-04-18 20:12:48] [INFO] TESTER: Getting status of centos-8[0m PASSED[32m[2024-04-18 20:12:54] [INFO] TESTER: Restarting wazuh-agent in centos-8[0m =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ======================== 1 passed, 2 warnings in 38.64s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:13:04] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:13:04] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:13:04] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:13:04] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' - --live=True - -s delta: '0:01:59.803141' end: '2024-04-18 20:15:05.709533' msg: '' rc: 0 start: '2024-04-18 20:13:05.906392' stderr: |- Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Removed /etc/systemd/system/multi-user.target.wants/wazuh-agent.service. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-91-99-46.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-18 20:13:06] [INFO] TESTER: Checking connection to centos-8[0m [32m[2024-04-18 20:13:07] [INFO] TESTER: Connection established successfully in centos-8[0m [32m[2024-04-18 20:13:23] [INFO] TESTER: Generating Snapshot for Checkfile in centos-8[0m [32m[2024-04-18 20:13:37] [INFO] TESTER: Uninstalling Agent in centos-8[0m [32m[2024-04-18 20:14:36] [INFO] TESTER: Generating Snapshot for Checkfile in centos-8[0m [32m[2024-04-18 20:14:49] [INFO] TESTER: Applying filters in checkfiles in centos-8[0m [32m[2024-04-18 20:14:49] [INFO] TESTER: Pre and post uninstall checkfile comparison in centos-8: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m PASSED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ================== 3 passed, 2 warnings in 119.43s (0:01:59) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:15:05] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:15:05] [INFO] TESTER: Cleaning up [2024-04-18 20:15:05] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:15:05] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:15:19] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:15:19] [INFO] TESTER: Cleaning up [2024-04-18 20:15:19] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:15:19] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:15:29] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:15:29] [INFO] [3958] [ThreadPoolExecutor-0_6] [workflow_engine]: [run-agent-linux-centos-8-amd64-tests] Finished task in 545.59 seconds. [2024-04-18 20:18:07] [DEBUG] [3958] [ThreadPoolExecutor-0_1] [workflow_engine]: Finished task "run-agent-linux-centos-7-amd64-tests" execution with result: [2024-04-18 20:06:23] [INFO] TESTER: Running tests for ec2-3-80-51-50.compute-1.amazonaws.com [2024-04-18 20:06:23] [INFO] TESTER: Running tests for ec2-18-212-236-8.compute-1.amazonaws.com [2024-04-18 20:06:23] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-18-212-236-8.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-18 20:06:23] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-18 20:06:23] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:23] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-18-212-236-8.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-3-80-51-50.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.007249' end: '2024-04-18 20:06:24.459548' item: ec2-3-80-51-50.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:24.452299' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-18-212-236-8.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.004859' end: '2024-04-18 20:06:24.608743' item: ec2-18-212-236-8.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:24.603884' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:06:24] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-18-212-236-8.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:06:24] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:06:24] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:24] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' - --live=True - -s delta: '0:07:15.696361' end: '2024-04-18 20:13:42.087960' msg: '' rc: 0 start: '2024-04-18 20:06:26.391599' stderr: |- Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0100 9247k 100 9247k 0 0 16.0M 0 --:--:-- --:--:-- --:--:-- 16.0M warning: wazuh-agent-4.7.3-1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 29111145: NOKEY Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Created symlink from /etc/systemd/system/multi-user.target.wants/wazuh-agent.service to /usr/lib/systemd/system/wazuh-agent.service. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Job for wazuh-agent.service failed because the control process exited with error code. See "systemctl status wazuh-agent.service" and "journalctl -xe" for details. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-18 20:06:26] [INFO] TESTER: Checking connection to centos-7[0m [33m[2024-04-18 20:06:31] [WARNING] TESTER: Error on attempt 1 of 10: [Errno None] Unable to connect to port 2200 on 18.212.236.8[0m [33m[2024-04-18 20:07:01] [WARNING] TESTER: Error on attempt 2 of 10: [Errno None] Unable to connect to port 2200 on 18.212.236.8[0m [33m[2024-04-18 20:07:31] [WARNING] TESTER: Error on attempt 3 of 10: [Errno None] Unable to connect to port 2200 on 18.212.236.8[0m [33m[2024-04-18 20:08:02] [WARNING] TESTER: Error on attempt 4 of 10: [Errno None] Unable to connect to port 2200 on 18.212.236.8[0m [33m[2024-04-18 20:08:32] [WARNING] TESTER: Error on attempt 5 of 10: [Errno None] Unable to connect to port 2200 on 18.212.236.8[0m [33m[2024-04-18 20:09:02] [WARNING] TESTER: Error on attempt 6 of 10: [Errno None] Unable to connect to port 2200 on 18.212.236.8[0m [33m[2024-04-18 20:09:32] [WARNING] TESTER: Error on attempt 7 of 10: [Errno None] Unable to connect to port 2200 on 18.212.236.8[0m [32m[2024-04-18 20:10:04] [INFO] TESTER: Connection established successfully in centos-7[0m [32m[2024-04-18 20:10:07] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-18 20:10:08] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-18 20:10:10] [INFO] TESTER: No Firewall to disable on centos-7[0m [32m[2024-04-18 20:10:14] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-18 20:10:41] [INFO] TESTER: Installing Manager in ubuntu-22.04[0m [32m[2024-04-18 20:11:55] [INFO] TESTER: Generating Snapshot for Checkfile in centos-7[0m [32m[2024-04-18 20:12:19] [INFO] TESTER: Installing Agent in centos-7[0m [32m[2024-04-18 20:13:18] [INFO] TESTER: Generating Snapshot for Checkfile in centos-7[0m [32m[2024-04-18 20:13:31] [INFO] TESTER: Applying filters in checkfiles in centos-7[0m [32m[2024-04-18 20:13:31] [INFO] TESTER: Pre and post install checkfile comparison in centos-7: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m PASSED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-18 20:13:34] [INFO] TESTER: Getting status of centos-7[0m PASSED modules/testing/tests/test_agent/test_install.py::test_version PASSED modules/testing/tests/test_agent/test_install.py::test_revision PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ================== 4 passed, 2 warnings in 435.15s (0:07:15) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:13:42] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:13:42] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:13:42] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:13:42] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:50.297318' end: '2024-04-18 20:14:33.751869' msg: '' rc: 0 start: '2024-04-18 20:13:43.454551' stderr: |- Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-18 20:13:43] [INFO] TESTER: Checking connection to centos-7[0m [32m[2024-04-18 20:13:45] [INFO] TESTER: Connection established successfully in centos-7[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-18 20:14:04] [INFO] TESTER: Getting status of centos-7[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_connection PASSED modules/testing/tests/test_agent/test_registration.py::test_isActive PASSED modules/testing/tests/test_agent/test_registration.py::test_clientKeys PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ======================== 5 passed, 2 warnings in 49.89s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:14:33] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:14:33] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:14:33] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:14:33] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:36.319420' end: '2024-04-18 20:15:11.445237' msg: '' rc: 0 start: '2024-04-18 20:14:35.125817' stderr: |- Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-18 20:14:35] [INFO] TESTER: Checking connection to centos-7[0m [32m[2024-04-18 20:14:39] [INFO] TESTER: Connection established successfully in centos-7[0m [32m[2024-04-18 20:14:49] [INFO] TESTER: Restarting wazuh-agent in centos-7[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-18 20:15:00] [INFO] TESTER: Getting status of centos-7[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_connection PASSED modules/testing/tests/test_agent/test_restart.py::test_isActive PASSED modules/testing/tests/test_agent/test_restart.py::test_clientKeys PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ======================== 5 passed, 2 warnings in 35.95s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:15:11] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:15:11] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:15:11] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:15:11] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:41.708014' end: '2024-04-18 20:15:54.522424' msg: '' rc: 0 start: '2024-04-18 20:15:12.814410' stderr: |- Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-18 20:15:13] [INFO] TESTER: Checking connection to centos-7[0m [32m[2024-04-18 20:15:14] [INFO] TESTER: Connection established successfully in centos-7[0m [32m[2024-04-18 20:15:33] [INFO] TESTER: Stopping wazuh-agent in centos-7[0m [32m[2024-04-18 20:15:37] [INFO] TESTER: Getting status of centos-7[0m PASSED[32m[2024-04-18 20:15:44] [INFO] TESTER: Restarting wazuh-agent in centos-7[0m =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ======================== 1 passed, 2 warnings in 41.33s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:15:54] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:15:54] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:15:54] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:15:54] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' - --live=True - -s delta: '0:01:45.846587' end: '2024-04-18 20:17:41.727703' msg: '' rc: 0 start: '2024-04-18 20:15:55.881116' stderr: |- Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to execute operation: Access denied Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-212-236-8.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-18 20:15:56] [INFO] TESTER: Checking connection to centos-7[0m [32m[2024-04-18 20:15:57] [INFO] TESTER: Connection established successfully in centos-7[0m [32m[2024-04-18 20:16:17] [INFO] TESTER: Generating Snapshot for Checkfile in centos-7[0m [32m[2024-04-18 20:16:33] [INFO] TESTER: Uninstalling Agent in centos-7[0m [32m[2024-04-18 20:17:10] [INFO] TESTER: Generating Snapshot for Checkfile in centos-7[0m [32m[2024-04-18 20:17:24] [INFO] TESTER: Applying filters in checkfiles in centos-7[0m [32m[2024-04-18 20:17:24] [INFO] TESTER: Pre and post uninstall checkfile comparison in centos-7: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m PASSED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ================== 3 passed, 2 warnings in 105.47s (0:01:45) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:17:41] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:17:41] [INFO] TESTER: Cleaning up [2024-04-18 20:17:41] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:17:41] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:17:55] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:17:55] [INFO] TESTER: Cleaning up [2024-04-18 20:17:55] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:17:55] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:18:07] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:18:07] [INFO] [3958] [ThreadPoolExecutor-0_1] [workflow_engine]: [run-agent-linux-centos-7-amd64-tests] Finished task in 704.86 seconds. [2024-04-18 20:22:41] [DEBUG] [3958] [ThreadPoolExecutor-0_2] [workflow_engine]: Finished task "run-agent-linux-debian-11-amd64-tests" execution with result: [2024-04-18 20:06:23] [INFO] TESTER: Running tests for ec2-3-80-51-50.compute-1.amazonaws.com [2024-04-18 20:06:23] [INFO] TESTER: Running tests for ec2-107-21-88-205.compute-1.amazonaws.com [2024-04-18 20:06:23] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-107-21-88-205.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-18 20:06:23] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-18 20:06:23] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:23] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-107-21-88-205.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-3-80-51-50.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.006354' end: '2024-04-18 20:06:24.529514' item: ec2-3-80-51-50.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:24.523160' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-107-21-88-205.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.004886' end: '2024-04-18 20:06:24.717046' item: ec2-107-21-88-205.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:24.712160' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:06:24] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-107-21-88-205.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:06:24] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:06:24] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:24] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' - --live=True - -s delta: '0:03:05.867210' end: '2024-04-18 20:09:32.309226' msg: '' rc: 0 start: '2024-04-18 20:06:26.442016' stderr: |- Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. --2024-04-18 23:09:03-- https://packages-dev.wazuh.com/pre-release/apt/pool/main/w/wazuh-agent/wazuh-agent_4.7.3-1_amd64.deb Resolving packages-dev.wazuh.com (packages-dev.wazuh.com)... 99.84.208.61, 99.84.208.124, 99.84.208.42, ... Connecting to packages-dev.wazuh.com (packages-dev.wazuh.com)|99.84.208.61|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 9362524 (8.9M) [binary/octet-stream] Saving to: 'wazuh-agent_4.7.3-1_amd64.deb' 0K .......... .......... .......... .......... .......... 0% 30.4M 0s 50K .......... .......... .......... .......... .......... 1% 23.5M 0s 100K .......... .......... .......... .......... .......... 1% 45.9M 0s 150K .......... .......... .......... .......... .......... 2% 43.0M 0s 200K .......... .......... .......... .......... .......... 2% 145M 0s 250K .......... .......... .......... .......... .......... 3% 62.6M 0s 300K .......... .......... .......... .......... .......... 3% 127M 0s 350K .......... .......... .......... .......... .......... 4% 159M 0s 400K .......... .......... .......... .......... .......... 4% 194M 0s 450K .......... .......... .......... .......... .......... 5% 224M 0s 500K .......... .......... .......... .......... .......... 6% 84.6M 0s 550K .......... .......... .......... .......... .......... 6% 204M 0s 600K .......... .......... .......... .......... .......... 7% 193M 0s 650K .......... .......... .......... .......... .......... 7% 215M 0s 700K .......... .......... .......... .......... .......... 8% 196M 0s 750K .......... .......... .......... .......... .......... 8% 228M 0s 800K .......... .......... .......... .......... .......... 9% 67.6M 0s 850K .......... .......... .......... .......... .......... 9% 203M 0s 900K .......... .......... .......... .......... .......... 10% 228M 0s 950K .......... .......... .......... .......... .......... 10% 44.3M 0s 1000K .......... .......... .......... .......... .......... 11% 106M 0s 1050K .......... .......... .......... .......... .......... 12% 166M 0s 1100K .......... .......... .......... .......... .......... 12% 212M 0s 1150K .......... .......... .......... .......... .......... 13% 174M 0s 1200K .......... .......... .......... .......... .......... 13% 228M 0s 1250K .......... .......... .......... .......... .......... 14% 73.7M 0s 1300K .......... .......... .......... .......... .......... 14% 142M 0s 1350K .......... .......... .......... .......... .......... 15% 203M 0s 1400K .......... .......... .......... .......... .......... 15% 208M 0s 1450K .......... .......... .......... .......... .......... 16% 175M 0s 1500K .......... .......... .......... .......... .......... 16% 105M 0s 1550K .......... .......... .......... .......... .......... 17% 117M 0s 1600K .......... .......... .......... .......... .......... 18% 201M 0s 1650K .......... .......... .......... .......... .......... 18% 185M 0s 1700K .......... .......... .......... .......... .......... 19% 170M 0s 1750K .......... .......... .......... .......... .......... 19% 155M 0s 1800K .......... .......... .......... .......... .......... 20% 168M 0s 1850K .......... .......... .......... .......... .......... 20% 103M 0s 1900K .......... .......... .......... .......... .......... 21% 206M 0s 1950K .......... .......... .......... .......... .......... 21% 89.1M 0s 2000K .......... .......... .......... .......... .......... 22% 210M 0s 2050K .......... .......... .......... .......... .......... 22% 216M 0s 2100K .......... .......... .......... .......... .......... 23% 186M 0s 2150K .......... .......... .......... .......... .......... 24% 113M 0s 2200K .......... .......... .......... .......... .......... 24% 161M 0s 2250K .......... .......... .......... .......... .......... 25% 207M 0s 2300K .......... .......... .......... .......... .......... 25% 218M 0s 2350K .......... .......... .......... .......... .......... 26% 145M 0s 2400K .......... .......... .......... .......... .......... 26% 164M 0s 2450K .......... .......... .......... .......... .......... 27% 209M 0s 2500K .......... .......... .......... .......... .......... 27% 139M 0s 2550K .......... .......... .......... .......... .......... 28% 87.6M 0s 2600K .......... .......... .......... .......... .......... 28% 215M 0s 2650K .......... .......... .......... .......... .......... 29% 181M 0s 2700K .......... .......... .......... .......... .......... 30% 164M 0s 2750K .......... .......... .......... .......... .......... 30% 87.7M 0s 2800K .......... .......... .......... .......... .......... 31% 102M 0s 2850K .......... .......... .......... .......... .......... 31% 166M 0s 2900K .......... .......... .......... .......... .......... 32% 215M 0s 2950K .......... .......... .......... .......... .......... 32% 171M 0s 3000K .......... .......... .......... .......... .......... 33% 168M 0s 3050K .......... .......... .......... .......... .......... 33% 82.3M 0s 3100K .......... .......... .......... .......... .......... 34% 113M 0s 3150K .......... .......... .......... .......... .......... 34% 139M 0s 3200K .......... .......... .......... .......... .......... 35% 151M 0s 3250K .......... .......... .......... .......... .......... 36% 133M 0s 3300K .......... .......... .......... .......... .......... 36% 146M 0s 3350K .......... .......... .......... .......... .......... 37% 190M 0s 3400K .......... .......... .......... .......... .......... 37% 102M 0s 3450K .......... .......... .......... .......... .......... 38% 82.0M 0s 3500K .......... .......... .......... .......... .......... 38% 140M 0s 3550K .......... .......... .......... .......... .......... 39% 6.39M 0s 3600K .......... .......... .......... .......... .......... 39% 33.6M 0s 3650K .......... .......... .......... .......... .......... 40% 14.6M 0s 3700K .......... .......... .......... .......... .......... 41% 212M 0s 3750K .......... .......... .......... .......... .......... 41% 54.7M 0s 3800K .......... .......... .......... .......... .......... 42% 58.0M 0s 3850K .......... .......... .......... .......... .......... 42% 69.0M 0s 3900K .......... .......... .......... .......... .......... 43% 107M 0s 3950K .......... .......... .......... .......... .......... 43% 39.1M 0s 4000K .......... .......... .......... .......... .......... 44% 19.8M 0s 4050K .......... .......... .......... .......... .......... 44% 45.9M 0s 4100K .......... .......... .......... .......... .......... 45% 99.4M 0s 4150K .......... .......... .......... .......... .......... 45% 90.6M 0s 4200K .......... .......... .......... .......... .......... 46% 61.2M 0s 4250K .......... .......... .......... .......... .......... 47% 60.2M 0s 4300K .......... .......... .......... .......... .......... 47% 28.1M 0s 4350K .......... .......... .......... .......... .......... 48% 79.2M 0s 4400K .......... .......... .......... .......... .......... 48% 65.3M 0s 4450K .......... .......... .......... .......... .......... 49% 43.8M 0s 4500K .......... .......... .......... .......... .......... 49% 26.4M 0s 4550K .......... .......... .......... .......... .......... 50% 30.8M 0s 4600K .......... .......... .......... .......... .......... 50% 44.9M 0s 4650K .......... .......... .......... .......... .......... 51% 19.3M 0s 4700K .......... .......... .......... .......... .......... 51% 44.2M 0s 4750K .......... .......... .......... .......... .......... 52% 48.0M 0s 4800K .......... .......... .......... .......... .......... 53% 113M 0s 4850K .......... .......... .......... .......... .......... 53% 62.3M 0s 4900K .......... .......... .......... .......... .......... 54% 294M 0s 4950K .......... .......... .......... .......... .......... 54% 294M 0s 5000K .......... .......... .......... .......... .......... 55% 307M 0s 5050K .......... .......... .......... .......... .......... 55% 284M 0s 5100K .......... .......... .......... .......... .......... 56% 315M 0s 5150K .......... .......... .......... .......... .......... 56% 344M 0s 5200K .......... .......... .......... .......... .......... 57% 287M 0s 5250K .......... .......... .......... .......... .......... 57% 368M 0s 5300K .......... .......... .......... .......... .......... 58% 267M 0s 5350K .......... .......... .......... .......... .......... 59% 320M 0s 5400K .......... .......... .......... .......... .......... 59% 266M 0s 5450K .......... .......... .......... .......... .......... 60% 325M 0s 5500K .......... .......... .......... .......... .......... 60% 344M 0s 5550K .......... .......... .......... .......... .......... 61% 277M 0s 5600K .......... .......... .......... .......... .......... 61% 354M 0s 5650K .......... .......... .......... .......... .......... 62% 65.6M 0s 5700K .......... .......... .......... .......... .......... 62% 307M 0s 5750K .......... .......... .......... .......... .......... 63% 300M 0s 5800K .......... .......... .......... .......... .......... 63% 231M 0s 5850K .......... .......... .......... .......... .......... 64% 45.1M 0s 5900K .......... .......... .......... .......... .......... 65% 323M 0s 5950K .......... .......... .......... .......... .......... 65% 338M 0s 6000K .......... .......... .......... .......... .......... 66% 336M 0s 6050K .......... .......... .......... .......... .......... 66% 377M 0s 6100K .......... .......... .......... .......... .......... 67% 175M 0s 6150K .......... .......... .......... .......... .......... 67% 338M 0s 6200K .......... .......... .......... .......... .......... 68% 312M 0s 6250K .......... .......... .......... .......... .......... 68% 49.3M 0s 6300K .......... .......... .......... .......... .......... 69% 196M 0s 6350K .......... .......... .......... .......... .......... 69% 345M 0s 6400K .......... .......... .......... .......... .......... 70% 119M 0s 6450K .......... .......... .......... .......... .......... 71% 277M 0s 6500K .......... .......... .......... .......... .......... 71% 192M 0s 6550K .......... .......... .......... .......... .......... 72% 78.6M 0s 6600K .......... .......... .......... .......... .......... 72% 115M 0s 6650K .......... .......... .......... .......... .......... 73% 52.3M 0s 6700K .......... .......... .......... .......... .......... 73% 56.5M 0s 6750K .......... .......... .......... .......... .......... 74% 170M 0s 6800K .......... .......... .......... .......... .......... 74% 38.4M 0s 6850K .......... .......... .......... .......... .......... 75% 160M 0s 6900K .......... .......... .......... .......... .......... 76% 66.0M 0s 6950K .......... .......... .......... .......... .......... 76% 172M 0s 7000K .......... .......... .......... .......... .......... 77% 48.3M 0s 7050K .......... .......... .......... .......... .......... 77% 71.8M 0s 7100K .......... .......... .......... .......... .......... 78% 20.3M 0s 7150K .......... .......... .......... .......... .......... 78% 199M 0s 7200K .......... .......... .......... .......... .......... 79% 187M 0s 7250K .......... .......... .......... .......... .......... 79% 130M 0s 7300K .......... .......... .......... .......... .......... 80% 169M 0s 7350K .......... .......... .......... .......... .......... 80% 169M 0s 7400K .......... .......... .......... .......... .......... 81% 227M 0s 7450K .......... .......... .......... .......... .......... 82% 171M 0s 7500K .......... .......... .......... .......... .......... 82% 216M 0s 7550K .......... .......... .......... .......... .......... 83% 108M 0s 7600K .......... .......... .......... .......... .......... 83% 180M 0s 7650K .......... .......... .......... .......... .......... 84% 183M 0s 7700K .......... .......... .......... .......... .......... 84% 158M 0s 7750K .......... .......... .......... .......... .......... 85% 214M 0s 7800K .......... .......... .......... .......... .......... 85% 182M 0s 7850K .......... .......... .......... .......... .......... 86% 120M 0s 7900K .......... .......... .......... .......... .......... 86% 218M 0s 7950K .......... .......... .......... .......... .......... 87% 167M 0s 8000K .......... .......... .......... .......... .......... 88% 203M 0s 8050K .......... .......... .......... .......... .......... 88% 99.3M 0s 8100K .......... .......... .......... .......... .......... 89% 173M 0s 8150K .......... .......... .......... .......... .......... 89% 232M 0s 8200K .......... .......... .......... .......... .......... 90% 107M 0s 8250K .......... .......... .......... .......... .......... 90% 220M 0s 8300K .......... .......... .......... .......... .......... 91% 102M 0s 8350K .......... .......... .......... .......... .......... 91% 57.3M 0s 8400K .......... .......... .......... .......... .......... 92% 135M 0s 8450K .......... .......... .......... .......... .......... 92% 228M 0s 8500K .......... .......... .......... .......... .......... 93% 165M 0s 8550K .......... .......... .......... .......... .......... 94% 242M 0s 8600K .......... .......... .......... .......... .......... 94% 92.9M 0s 8650K .......... .......... .......... .......... .......... 95% 194M 0s 8700K .......... .......... .......... .......... .......... 95% 235M 0s 8750K .......... .......... .......... .......... .......... 96% 130M 0s 8800K .......... .......... .......... .......... .......... 96% 223M 0s 8850K .......... .......... .......... .......... .......... 97% 137M 0s 8900K .......... .......... .......... .......... .......... 97% 236M 0s 8950K .......... .......... .......... .......... .......... 98% 144M 0s 9000K .......... .......... .......... .......... .......... 98% 169M 0s 9050K .......... .......... .......... .......... .......... 99% 182M 0s 9100K .......... .......... .......... .......... ... 100% 245M=0.1s 2024-04-18 23:09:04 (91.4 MB/s) - 'wazuh-agent_4.7.3-1_amd64.deb' saved [9362524/9362524] Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Created symlink /etc/systemd/system/multi-user.target.wants/wazuh-agent.service → /lib/systemd/system/wazuh-agent.service. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Job for wazuh-agent.service failed because the control process exited with error code. See "systemctl status wazuh-agent.service" and "journalctl -xe" for details. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-18 20:06:26] [INFO] TESTER: Checking connection to debian-11[0m [32m[2024-04-18 20:06:28] [INFO] TESTER: Connection established successfully in debian-11[0m [32m[2024-04-18 20:06:30] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-18 20:06:31] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-18 20:06:34] [INFO] TESTER: No Firewall to disable on debian-11[0m [32m[2024-04-18 20:06:38] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-18 20:07:18] [INFO] TESTER: Installing Manager in ubuntu-22.04[0m [32m[2024-04-18 20:08:37] [INFO] TESTER: Generating Snapshot for Checkfile in debian-11[0m [32m[2024-04-18 20:09:01] [INFO] TESTER: Installing Agent in debian-11[0m [32m[2024-04-18 20:09:15] [INFO] TESTER: Generating Snapshot for Checkfile in debian-11[0m [32m[2024-04-18 20:09:24] [INFO] TESTER: Applying filters in checkfiles in debian-11[0m [32m[2024-04-18 20:09:24] [INFO] TESTER: Pre and post install checkfile comparison in debian-11: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m PASSED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-18 20:09:26] [INFO] TESTER: Getting status of debian-11[0m PASSED modules/testing/tests/test_agent/test_install.py::test_version PASSED modules/testing/tests/test_agent/test_install.py::test_revision PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ================== 4 passed, 2 warnings in 185.38s (0:03:05) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:09:32] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:09:32] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:09:32] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:09:32] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:29.605740' end: '2024-04-18 20:10:03.316633' msg: non-zero return code rc: 1 start: '2024-04-18 20:09:33.710893' stderr: |- Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-18 20:09:34] [INFO] TESTER: Checking connection to debian-11[0m [32m[2024-04-18 20:09:35] [INFO] TESTER: Connection established successfully in debian-11[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-18 20:09:51] [INFO] TESTER: Getting status of debian-11[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys PASSED =================================== FAILURES =================================== _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' E AssertionError: The agent-linux-debian-11-amd64 is not present in the master by command E assert 'agent-linux-debian-11-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_registration.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive =================== 2 failed, 3 passed, 2 warnings in 29.19s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:10:03] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:10:03] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:10:03] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:10:03] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:27.553440' end: '2024-04-18 20:10:32.273758' msg: non-zero return code rc: 1 start: '2024-04-18 20:10:04.720318' stderr: |- Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-18 20:10:05] [INFO] TESTER: Checking connection to debian-11[0m [32m[2024-04-18 20:10:06] [INFO] TESTER: Connection established successfully in debian-11[0m [32m[2024-04-18 20:10:12] [INFO] TESTER: Restarting wazuh-agent in debian-11[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-18 20:10:24] [INFO] TESTER: Getting status of debian-11[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_connection [31m[2024-04-18 20:10:28] [ERROR] TESTER: agent-linux-debian-11-amd64 is not present in agent_control information[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive PASSED modules/testing/tests/test_agent/test_restart.py::test_clientKeys PASSED =================================== FAILURES =================================== _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is not present in agent_control information') E AssertionError: None E assert 'agent-linux-debian-11-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_restart.py:76: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_restart.py::test_connection - As... =================== 1 failed, 4 passed, 2 warnings in 27.18s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:10:32] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:10:32] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:10:32] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:10:32] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:25.670279' end: '2024-04-18 20:10:59.318779' msg: non-zero return code rc: 1 start: '2024-04-18 20:10:33.648500' stderr: |- Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-18 20:10:34] [INFO] TESTER: Checking connection to debian-11[0m [32m[2024-04-18 20:10:35] [INFO] TESTER: Connection established successfully in debian-11[0m FAILED[32m[2024-04-18 20:10:47] [INFO] TESTER: Restarting wazuh-agent in debian-11[0m =================================== FAILURES =================================== __________________________________ test_stop ___________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_stop(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_stop.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_stop.py::test_stop - requests.ex... ======================== 1 failed, 2 warnings in 25.28s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:10:59] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:10:59] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:10:59] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:10:59] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' - --live=True - -s delta: '0:11:15.752495' end: '2024-04-18 20:22:16.446551' msg: non-zero return code rc: 1 start: '2024-04-18 20:11:00.694056' stderr: |- Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. apt-listchanges: Can't set locale; make sure $LC_* and $LANG are correct! perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_TIME = "es_AR.UTF-8", LC_MONETARY = "es_AR.UTF-8", LC_ADDRESS = "es_AR.UTF-8", LC_TELEPHONE = "es_AR.UTF-8", LC_NAME = "es_AR.UTF-8", LC_MEASUREMENT = "es_AR.UTF-8", LC_IDENTIFICATION = "es_AR.UTF-8", LC_NUMERIC = "es_AR.UTF-8", LC_PAPER = "es_AR.UTF-8", LANG = "C.UTF-8" are supported and installed on your system. perl: warning: Falling back to a fallback locale ("C.UTF-8"). Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Removed /etc/systemd/system/multi-user.target.wants/wazuh-agent.service. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-107-21-88-205.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-18 20:11:01] [INFO] TESTER: Checking connection to debian-11[0m [32m[2024-04-18 20:11:02] [INFO] TESTER: Connection established successfully in debian-11[0m [32m[2024-04-18 20:11:14] [INFO] TESTER: Generating Snapshot for Checkfile in debian-11[0m [32m[2024-04-18 20:11:25] [INFO] TESTER: Uninstalling Agent in debian-11[0m [32m[2024-04-18 20:11:36] [INFO] TESTER: Generating Snapshot for Checkfile in debian-11[0m [32m[2024-04-18 20:11:46] [INFO] TESTER: Applying filters in checkfiles in debian-11[0m [32m[2024-04-18 20:11:46] [INFO] TESTER: Pre and post uninstall checkfile comparison in debian-11: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m [31m[2024-04-18 20:11:48] [ERROR] TESTER: agent-linux-debian-11-amd64 is still connected in the Manager[0m FAILED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive [31m[2024-04-18 20:22:16] [ERROR] TESTER: Time out, Expected condition was not met[0m FAILED =================================== FAILURES =================================== ________________________________ test_uninstall ________________________________ wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_uninstall(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not Active before the installation') assert HostInformation.dir_exists(agent_params, WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in the host {agent_names}') # Agent installation for agent_names, agent_params in wazuh_params['agents'].items(): WazuhAgent.perform_uninstall_and_scan_for_agent(agent_params,wazuh_params) # Manager uninstallation status check for agent_names, agent_params in wazuh_params['agents'].items(): > assert 'Disconnected' in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is still connected in the Manager') E AssertionError: None E assert 'Disconnected' in '\nWazuh agent_control. List of available agents:\n ID: 000, Name: ip-172-31-20-143 (server), IP: 127.0.0.1, Active/Local\n ID: 001, Name: agent-linux-centos-8-amd64, IP: any, Never connected\n\nList of agentless devices:\n\n' E + where '\nWazuh agent_control. List of available agents:\n ID: 000, Name: ip-172-31-20-143 (server), IP: 127.0.0.1, Active/Local\n ID: 001, Name: agent-linux-centos-8-amd64, IP: any, Never connected\n\nList of agentless devices:\n\n' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_uninstall.py:77: AssertionError ________________________________ test_isActive _________________________________ wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): wazuh_api = WazuhAPI(wazuh_params['master']) for agent_names, agent_params in wazuh_params['agents'].items(): assert not GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not inactive by command') expected_condition_func = lambda: 'disconnected' == WazuhAgent.get_agent_status(wazuh_api, agent_names) > Waits.dynamic_wait(expected_condition_func, cycles=20, waiting_time=30) modules/testing/tests/test_agent/test_uninstall.py:91: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ expected_condition_func = . at 0x7d330555fac0> cycles = 20, waiting_time = 30 @staticmethod def dynamic_wait(expected_condition_func, cycles=10, waiting_time=10) -> None: """ Waits the process during assigned cycles for the assigned seconds Args: expected_condition_func (lambda function): The function that returns True when the expected condition is met cycles(int): Number of cycles waiting_Time(int): Number of seconds per cycle """ for _ in range(cycles): if expected_condition_func(): break else: time.sleep(waiting_time) else: logger.error('Time out, Expected condition was not met') > raise RuntimeError(f'Time out') E RuntimeError: Time out modules/testing/tests/helpers/generic.py:658: RuntimeError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_uninstall.py::test_uninstall - A... FAILED modules/testing/tests/test_agent/test_uninstall.py::test_isActive - Ru... ============= 2 failed, 1 passed, 2 warnings in 675.38s (0:11:15) ============== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:22:16] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:22:16] [INFO] TESTER: Cleaning up [2024-04-18 20:22:16] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:22:16] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:22:30] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:22:30] [INFO] TESTER: Cleaning up [2024-04-18 20:22:30] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:22:30] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:22:41] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:22:41] [INFO] [3958] [ThreadPoolExecutor-0_2] [workflow_engine]: [run-agent-linux-debian-11-amd64-tests] Finished task in 978.97 seconds. [2024-04-18 20:22:55] [DEBUG] [3958] [ThreadPoolExecutor-0_9] [workflow_engine]: Finished task "run-agent-linux-ubuntu-20.04-amd64-tests" execution with result: [2024-04-18 20:06:23] [INFO] TESTER: Running tests for ec2-3-80-51-50.compute-1.amazonaws.com [2024-04-18 20:06:23] [INFO] TESTER: Running tests for ec2-54-83-77-165.compute-1.amazonaws.com [2024-04-18 20:06:23] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-54-83-77-165.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-18 20:06:23] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-18 20:06:23] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:23] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-54-83-77-165.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-3-80-51-50.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.004529' end: '2024-04-18 20:06:25.092943' item: ec2-3-80-51-50.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:25.088414' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-54-83-77-165.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.006606' end: '2024-04-18 20:06:25.220648' item: ec2-54-83-77-165.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:25.214042' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:06:25] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-54-83-77-165.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:06:25] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:06:25] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:25] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:02:47.767677' end: '2024-04-18 20:09:14.891317' msg: '' rc: 0 start: '2024-04-18 20:06:27.123640' stderr: |- Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. --2024-04-18 23:08:30-- https://packages-dev.wazuh.com/pre-release/apt/pool/main/w/wazuh-agent/wazuh-agent_4.7.3-1_amd64.deb Resolving packages-dev.wazuh.com (packages-dev.wazuh.com)... 99.84.208.124, 99.84.208.42, 99.84.208.121, ... Connecting to packages-dev.wazuh.com (packages-dev.wazuh.com)|99.84.208.124|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 9362524 (8.9M) [binary/octet-stream] Saving to: 'wazuh-agent_4.7.3-1_amd64.deb' 0K .......... .......... .......... .......... .......... 0% 47.3M 0s 50K .......... .......... .......... .......... .......... 1% 175M 0s 100K .......... .......... .......... .......... .......... 1% 98.7M 0s 150K .......... .......... .......... .......... .......... 2% 97.2M 0s 200K .......... .......... .......... .......... .......... 2% 206M 0s 250K .......... .......... .......... .......... .......... 3% 148M 0s 300K .......... .......... .......... .......... .......... 3% 121M 0s 350K .......... .......... .......... .......... .......... 4% 194M 0s 400K .......... .......... .......... .......... .......... 4% 207M 0s 450K .......... .......... .......... .......... .......... 5% 207M 0s 500K .......... .......... .......... .......... .......... 6% 179M 0s 550K .......... .......... .......... .......... .......... 6% 22.8M 0s 600K .......... .......... .......... .......... .......... 7% 181M 0s 650K .......... .......... .......... .......... .......... 7% 136M 0s 700K .......... .......... .......... .......... .......... 8% 102M 0s 750K .......... .......... .......... .......... .......... 8% 91.4M 0s 800K .......... .......... .......... .......... .......... 9% 40.2M 0s 850K .......... .......... .......... .......... .......... 9% 190M 0s 900K .......... .......... .......... .......... .......... 10% 45.2M 0s 950K .......... .......... .......... .......... .......... 10% 195M 0s 1000K .......... .......... .......... .......... .......... 11% 150M 0s 1050K .......... .......... .......... .......... .......... 12% 53.2M 0s 1100K .......... .......... .......... .......... .......... 12% 47.8M 0s 1150K .......... .......... .......... .......... .......... 13% 93.3M 0s 1200K .......... .......... .......... .......... .......... 13% 20.7M 0s 1250K .......... .......... .......... .......... .......... 14% 182M 0s 1300K .......... .......... .......... .......... .......... 14% 93.9M 0s 1350K .......... .......... .......... .......... .......... 15% 27.0M 0s 1400K .......... .......... .......... .......... .......... 15% 190M 0s 1450K .......... .......... .......... .......... .......... 16% 42.2M 0s 1500K .......... .......... .......... .......... .......... 16% 194M 0s 1550K .......... .......... .......... .......... .......... 17% 29.5M 0s 1600K .......... .......... .......... .......... .......... 18% 126M 0s 1650K .......... .......... .......... .......... .......... 18% 174M 0s 1700K .......... .......... .......... .......... .......... 19% 196M 0s 1750K .......... .......... .......... .......... .......... 19% 32.5M 0s 1800K .......... .......... .......... .......... .......... 20% 99.3M 0s 1850K .......... .......... .......... .......... .......... 20% 36.8M 0s 1900K .......... .......... .......... .......... .......... 21% 190M 0s 1950K .......... .......... .......... .......... .......... 21% 144M 0s 2000K .......... .......... .......... .......... .......... 22% 40.2M 0s 2050K .......... .......... .......... .......... .......... 22% 160M 0s 2100K .......... .......... .......... .......... .......... 23% 59.6M 0s 2150K .......... .......... .......... .......... .......... 24% 26.7M 0s 2200K .......... .......... .......... .......... .......... 24% 198M 0s 2250K .......... .......... .......... .......... .......... 25% 167M 0s 2300K .......... .......... .......... .......... .......... 25% 193M 0s 2350K .......... .......... .......... .......... .......... 26% 11.3M 0s 2400K .......... .......... .......... .......... .......... 26% 192M 0s 2450K .......... .......... .......... .......... .......... 27% 190M 0s 2500K .......... .......... .......... .......... .......... 27% 175M 0s 2550K .......... .......... .......... .......... .......... 28% 183M 0s 2600K .......... .......... .......... .......... .......... 28% 166M 0s 2650K .......... .......... .......... .......... .......... 29% 195M 0s 2700K .......... .......... .......... .......... .......... 30% 217M 0s 2750K .......... .......... .......... .......... .......... 30% 176M 0s 2800K .......... .......... .......... .......... .......... 31% 192M 0s 2850K .......... .......... .......... .......... .......... 31% 176M 0s 2900K .......... .......... .......... .......... .......... 32% 36.2M 0s 2950K .......... .......... .......... .......... .......... 32% 165M 0s 3000K .......... .......... .......... .......... .......... 33% 33.8M 0s 3050K .......... .......... .......... .......... .......... 33% 189M 0s 3100K .......... .......... .......... .......... .......... 34% 177M 0s 3150K .......... .......... .......... .......... .......... 34% 27.3M 0s 3200K .......... .......... .......... .......... .......... 35% 183M 0s 3250K .......... .......... .......... .......... .......... 36% 203M 0s 3300K .......... .......... .......... .......... .......... 36% 14.7M 0s 3350K .......... .......... .......... .......... .......... 37% 191M 0s 3400K .......... .......... .......... .......... .......... 37% 124M 0s 3450K .......... .......... .......... .......... .......... 38% 180M 0s 3500K .......... .......... .......... .......... .......... 38% 199M 0s 3550K .......... .......... .......... .......... .......... 39% 112M 0s 3600K .......... .......... .......... .......... .......... 39% 161M 0s 3650K .......... .......... .......... .......... .......... 40% 22.0M 0s 3700K .......... .......... .......... .......... .......... 41% 188M 0s 3750K .......... .......... .......... .......... .......... 41% 204M 0s 3800K .......... .......... .......... .......... .......... 42% 164M 0s 3850K .......... .......... .......... .......... .......... 42% 31.9M 0s 3900K .......... .......... .......... .......... .......... 43% 186M 0s 3950K .......... .......... .......... .......... .......... 43% 20.3M 0s 4000K .......... .......... .......... .......... .......... 44% 83.6M 0s 4050K .......... .......... .......... .......... .......... 44% 178M 0s 4100K .......... .......... .......... .......... .......... 45% 194M 0s 4150K .......... .......... .......... .......... .......... 45% 143M 0s 4200K .......... .......... .......... .......... .......... 46% 12.0M 0s 4250K .......... .......... .......... .......... .......... 47% 186M 0s 4300K .......... .......... .......... .......... .......... 47% 148M 0s 4350K .......... .......... .......... .......... .......... 48% 178M 0s 4400K .......... .......... .......... .......... .......... 48% 169M 0s 4450K .......... .......... .......... .......... .......... 49% 69.4M 0s 4500K .......... .......... .......... .......... .......... 49% 189M 0s 4550K .......... .......... .......... .......... .......... 50% 27.7M 0s 4600K .......... .......... .......... .......... .......... 50% 171M 0s 4650K .......... .......... .......... .......... .......... 51% 201M 0s 4700K .......... .......... .......... .......... .......... 51% 121M 0s 4750K .......... .......... .......... .......... .......... 52% 8.77M 0s 4800K .......... .......... .......... .......... .......... 53% 159M 0s 4850K .......... .......... .......... .......... .......... 53% 178M 0s 4900K .......... .......... .......... .......... .......... 54% 181M 0s 4950K .......... .......... .......... .......... .......... 54% 180M 0s 5000K .......... .......... .......... .......... .......... 55% 165M 0s 5050K .......... .......... .......... .......... .......... 55% 189M 0s 5100K .......... .......... .......... .......... .......... 56% 184M 0s 5150K .......... .......... .......... .......... .......... 56% 173M 0s 5200K .......... .......... .......... .......... .......... 57% 180M 0s 5250K .......... .......... .......... .......... .......... 57% 143M 0s 5300K .......... .......... .......... .......... .......... 58% 17.2M 0s 5350K .......... .......... .......... .......... .......... 59% 147M 0s 5400K .......... .......... .......... .......... .......... 59% 166M 0s 5450K .......... .......... .......... .......... .......... 60% 168M 0s 5500K .......... .......... .......... .......... .......... 60% 119M 0s 5550K .......... .......... .......... .......... .......... 61% 41.0M 0s 5600K .......... .......... .......... .......... .......... 61% 39.6M 0s 5650K .......... .......... .......... .......... .......... 62% 171M 0s 5700K .......... .......... .......... .......... .......... 62% 50.8M 0s 5750K .......... .......... .......... .......... .......... 63% 31.9M 0s 5800K .......... .......... .......... .......... .......... 63% 183M 0s 5850K .......... .......... .......... .......... .......... 64% 104M 0s 5900K .......... .......... .......... .......... .......... 65% 53.9M 0s 5950K .......... .......... .......... .......... .......... 65% 43.6M 0s 6000K .......... .......... .......... .......... .......... 66% 25.1M 0s 6050K .......... .......... .......... .......... .......... 66% 188M 0s 6100K .......... .......... .......... .......... .......... 67% 28.4M 0s 6150K .......... .......... .......... .......... .......... 67% 38.5M 0s 6200K .......... .......... .......... .......... .......... 68% 27.4M 0s 6250K .......... .......... .......... .......... .......... 68% 30.0M 0s 6300K .......... .......... .......... .......... .......... 69% 172M 0s 6350K .......... .......... .......... .......... .......... 69% 26.4M 0s 6400K .......... .......... .......... .......... .......... 70% 184M 0s 6450K .......... .......... .......... .......... .......... 71% 201M 0s 6500K .......... .......... .......... .......... .......... 71% 38.3M 0s 6550K .......... .......... .......... .......... .......... 72% 47.4M 0s 6600K .......... .......... .......... .......... .......... 72% 81.4M 0s 6650K .......... .......... .......... .......... .......... 73% 70.8M 0s 6700K .......... .......... .......... .......... .......... 73% 16.2M 0s 6750K .......... .......... .......... .......... .......... 74% 161M 0s 6800K .......... .......... .......... .......... .......... 74% 107M 0s 6850K .......... .......... .......... .......... .......... 75% 123M 0s 6900K .......... .......... .......... .......... .......... 76% 135M 0s 6950K .......... .......... .......... .......... .......... 76% 179M 0s 7000K .......... .......... .......... .......... .......... 77% 164M 0s 7050K .......... .......... .......... .......... .......... 77% 149M 0s 7100K .......... .......... .......... .......... .......... 78% 168M 0s 7150K .......... .......... .......... .......... .......... 78% 125M 0s 7200K .......... .......... .......... .......... .......... 79% 14.6M 0s 7250K .......... .......... .......... .......... .......... 79% 33.6M 0s 7300K .......... .......... .......... .......... .......... 80% 166M 0s 7350K .......... .......... .......... .......... .......... 80% 62.2M 0s 7400K .......... .......... .......... .......... .......... 81% 39.3M 0s 7450K .......... .......... .......... .......... .......... 82% 19.4M 0s 7500K .......... .......... .......... .......... .......... 82% 257M 0s 7550K .......... .......... .......... .......... .......... 83% 188M 0s 7600K .......... .......... .......... .......... .......... 83% 170M 0s 7650K .......... .......... .......... .......... .......... 84% 140M 0s 7700K .......... .......... .......... .......... .......... 84% 48.4M 0s 7750K .......... .......... .......... .......... .......... 85% 17.7M 0s 7800K .......... .......... .......... .......... .......... 85% 59.9M 0s 7850K .......... .......... .......... .......... .......... 86% 52.6M 0s 7900K .......... .......... .......... .......... .......... 86% 129M 0s 7950K .......... .......... .......... .......... .......... 87% 94.6M 0s 8000K .......... .......... .......... .......... .......... 88% 91.9M 0s 8050K .......... .......... .......... .......... .......... 88% 103M 0s 8100K .......... .......... .......... .......... .......... 89% 167M 0s 8150K .......... .......... .......... .......... .......... 89% 140M 0s 8200K .......... .......... .......... .......... .......... 90% 141M 0s 8250K .......... .......... .......... .......... .......... 90% 197M 0s 8300K .......... .......... .......... .......... .......... 91% 165M 0s 8350K .......... .......... .......... .......... .......... 91% 161M 0s 8400K .......... .......... .......... .......... .......... 92% 199M 0s 8450K .......... .......... .......... .......... .......... 92% 196M 0s 8500K .......... .......... .......... .......... .......... 93% 193M 0s 8550K .......... .......... .......... .......... .......... 94% 152M 0s 8600K .......... .......... .......... .......... .......... 94% 186M 0s 8650K .......... .......... .......... .......... .......... 95% 199M 0s 8700K .......... .......... .......... .......... .......... 95% 209M 0s 8750K .......... .......... .......... .......... .......... 96% 155M 0s 8800K .......... .......... .......... .......... .......... 96% 207M 0s 8850K .......... .......... .......... .......... .......... 97% 145M 0s 8900K .......... .......... .......... .......... .......... 97% 160M 0s 8950K .......... .......... .......... .......... .......... 98% 73.8M 0s 9000K .......... .......... .......... .......... .......... 98% 51.3M 0s 9050K .......... .......... .......... .......... .......... 99% 186M 0s 9100K .......... .......... .......... .......... ... 100% 218M=0.1s 2024-04-18 23:08:31 (66.7 MB/s) - 'wazuh-agent_4.7.3-1_amd64.deb' saved [9362524/9362524] Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Created symlink /etc/systemd/system/multi-user.target.wants/wazuh-agent.service → /lib/systemd/system/wazuh-agent.service. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Job for wazuh-agent.service failed because the control process exited with error code. See "systemctl status wazuh-agent.service" and "journalctl -xe" for details. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-18 20:06:27] [INFO] TESTER: Checking connection to ubuntu-20.04[0m [33m[2024-04-18 20:06:35] [WARNING] TESTER: Error on attempt 1 of 10: [Errno None] Unable to connect to port 2200 on 54.83.77.165[0m [32m[2024-04-18 20:07:06] [INFO] TESTER: Connection established successfully in ubuntu-20.04[0m [32m[2024-04-18 20:07:10] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-18 20:07:11] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-18 20:07:14] [INFO] TESTER: No Firewall to disable on ubuntu-20.04[0m [32m[2024-04-18 20:07:18] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-18 20:07:47] [INFO] TESTER: Installing Manager in ubuntu-22.04[0m [32m[2024-04-18 20:07:56] [INFO] TESTER: Generating Snapshot for Checkfile in ubuntu-20.04[0m [32m[2024-04-18 20:08:28] [INFO] TESTER: Installing Agent in ubuntu-20.04[0m [32m[2024-04-18 20:08:49] [INFO] TESTER: Generating Snapshot for Checkfile in ubuntu-20.04[0m [32m[2024-04-18 20:09:03] [INFO] TESTER: Applying filters in checkfiles in ubuntu-20.04[0m [32m[2024-04-18 20:09:03] [INFO] TESTER: Pre and post install checkfile comparison in ubuntu-20.04: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m PASSED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-18 20:09:06] [INFO] TESTER: Getting status of ubuntu-20.04[0m PASSED modules/testing/tests/test_agent/test_install.py::test_version PASSED modules/testing/tests/test_agent/test_install.py::test_revision PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ================== 4 passed, 2 warnings in 167.34s (0:02:47) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:09:15] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:09:15] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:09:15] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:09:15] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:33.420471' end: '2024-04-18 20:09:49.729278' msg: non-zero return code rc: 1 start: '2024-04-18 20:09:16.308807' stderr: |- Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-18 20:09:16] [INFO] TESTER: Checking connection to ubuntu-20.04[0m [32m[2024-04-18 20:09:18] [INFO] TESTER: Connection established successfully in ubuntu-20.04[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-18 20:09:36] [INFO] TESTER: Getting status of ubuntu-20.04[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys PASSED =================================== FAILURES =================================== _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' E AssertionError: The agent-linux-ubuntu-2004-amd64 is not present in the master by command E assert 'agent-linux-ubuntu-2004-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_registration.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive =================== 2 failed, 3 passed, 2 warnings in 32.97s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:09:49] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:09:49] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:09:49] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:09:49] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:33.080678' end: '2024-04-18 20:10:24.263347' msg: non-zero return code rc: 1 start: '2024-04-18 20:09:51.182669' stderr: |- Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-18 20:09:51] [INFO] TESTER: Checking connection to ubuntu-20.04[0m [32m[2024-04-18 20:09:52] [INFO] TESTER: Connection established successfully in ubuntu-20.04[0m [32m[2024-04-18 20:10:01] [INFO] TESTER: Restarting wazuh-agent in ubuntu-20.04[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-18 20:10:14] [INFO] TESTER: Getting status of ubuntu-20.04[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_connection [31m[2024-04-18 20:10:18] [ERROR] TESTER: agent-linux-ubuntu-2004-amd64 is not present in agent_control information[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive PASSED modules/testing/tests/test_agent/test_restart.py::test_clientKeys PASSED =================================== FAILURES =================================== _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is not present in agent_control information') E AssertionError: None E assert 'agent-linux-ubuntu-2004-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_restart.py:76: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_restart.py::test_connection - As... =================== 1 failed, 4 passed, 2 warnings in 32.68s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:10:24] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:10:24] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:10:24] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:10:24] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:29.154104' end: '2024-04-18 20:10:54.769986' msg: non-zero return code rc: 1 start: '2024-04-18 20:10:25.615882' stderr: |- Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-18 20:10:26] [INFO] TESTER: Checking connection to ubuntu-20.04[0m [32m[2024-04-18 20:10:27] [INFO] TESTER: Connection established successfully in ubuntu-20.04[0m FAILED[32m[2024-04-18 20:10:40] [INFO] TESTER: Restarting wazuh-agent in ubuntu-20.04[0m =================================== FAILURES =================================== __________________________________ test_stop ___________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_stop(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_stop.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_stop.py::test_stop - requests.ex... ======================== 1 failed, 2 warnings in 28.77s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:10:54] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:10:54] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:10:54] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:10:54] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:11:37.895712' end: '2024-04-18 20:22:34.028640' msg: non-zero return code rc: 1 start: '2024-04-18 20:10:56.132928' stderr: |- Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_TIME = "es_AR.UTF-8", LC_MONETARY = "es_AR.UTF-8", LC_ADDRESS = "es_AR.UTF-8", LC_TELEPHONE = "es_AR.UTF-8", LC_NAME = "es_AR.UTF-8", LC_MEASUREMENT = "es_AR.UTF-8", LC_IDENTIFICATION = "es_AR.UTF-8", LC_NUMERIC = "es_AR.UTF-8", LC_PAPER = "es_AR.UTF-8", LANG = "C.UTF-8" are supported and installed on your system. perl: warning: Falling back to a fallback locale ("C.UTF-8"). locale: Cannot set LC_ALL to default locale: No such file or directory Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Removed /etc/systemd/system/multi-user.target.wants/wazuh-agent.service. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-83-77-165.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-18 20:10:56] [INFO] TESTER: Checking connection to ubuntu-20.04[0m [32m[2024-04-18 20:10:57] [INFO] TESTER: Connection established successfully in ubuntu-20.04[0m [32m[2024-04-18 20:11:14] [INFO] TESTER: Generating Snapshot for Checkfile in ubuntu-20.04[0m [32m[2024-04-18 20:11:31] [INFO] TESTER: Uninstalling Agent in ubuntu-20.04[0m [32m[2024-04-18 20:11:47] [INFO] TESTER: Generating Snapshot for Checkfile in ubuntu-20.04[0m [32m[2024-04-18 20:12:01] [INFO] TESTER: Applying filters in checkfiles in ubuntu-20.04[0m [32m[2024-04-18 20:12:01] [INFO] TESTER: Pre and post uninstall checkfile comparison in ubuntu-20.04: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m PASSED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive [31m[2024-04-18 20:22:33] [ERROR] TESTER: Time out, Expected condition was not met[0m FAILED =================================== FAILURES =================================== ________________________________ test_isActive _________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): wazuh_api = WazuhAPI(wazuh_params['master']) for agent_names, agent_params in wazuh_params['agents'].items(): assert not GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not inactive by command') expected_condition_func = lambda: 'disconnected' == WazuhAgent.get_agent_status(wazuh_api, agent_names) > Waits.dynamic_wait(expected_condition_func, cycles=20, waiting_time=30) modules/testing/tests/test_agent/test_uninstall.py:91: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ expected_condition_func = . at 0x7ec29315b5b0> cycles = 20, waiting_time = 30 @staticmethod def dynamic_wait(expected_condition_func, cycles=10, waiting_time=10) -> None: """ Waits the process during assigned cycles for the assigned seconds Args: expected_condition_func (lambda function): The function that returns True when the expected condition is met cycles(int): Number of cycles waiting_Time(int): Number of seconds per cycle """ for _ in range(cycles): if expected_condition_func(): break else: time.sleep(waiting_time) else: logger.error('Time out, Expected condition was not met') > raise RuntimeError(f'Time out') E RuntimeError: Time out modules/testing/tests/helpers/generic.py:658: RuntimeError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_uninstall.py::test_isActive - Ru... ============= 1 failed, 2 passed, 2 warnings in 697.52s (0:11:37) ============== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:22:34] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:22:34] [INFO] TESTER: Cleaning up [2024-04-18 20:22:34] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:22:34] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:22:44] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:22:44] [INFO] TESTER: Cleaning up [2024-04-18 20:22:44] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:22:44] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:22:54] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:22:55] [INFO] [3958] [ThreadPoolExecutor-0_9] [workflow_engine]: [run-agent-linux-ubuntu-20.04-amd64-tests] Finished task in 991.71 seconds. [2024-04-18 20:22:57] [DEBUG] [3958] [ThreadPoolExecutor-0_4] [workflow_engine]: Finished task "run-agent-linux-redhat-9-amd64-tests" execution with result: [2024-04-18 20:06:22] [INFO] TESTER: Running tests for ec2-3-80-51-50.compute-1.amazonaws.com [2024-04-18 20:06:22] [INFO] TESTER: Running tests for ec2-3-80-132-164.compute-1.amazonaws.com [2024-04-18 20:06:22] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-3-80-132-164.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-18 20:06:22] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-18 20:06:22] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:22] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-3-80-132-164.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-3-80-51-50.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.004329' end: '2024-04-18 20:06:24.344680' item: ec2-3-80-51-50.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:24.340351' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-3-80-132-164.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.004781' end: '2024-04-18 20:06:24.469821' item: ec2-3-80-132-164.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:24.465040' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:06:24] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-3-80-132-164.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:06:24] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:06:24] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:24] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' - --live=True - -s delta: '0:03:00.772350' end: '2024-04-18 20:09:27.214689' msg: '' rc: 0 start: '2024-04-18 20:06:26.442339' stderr: |- Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0100 9247k 100 9247k 0 0 9837k 0 --:--:-- --:--:-- --:--:-- 9837k warning: wazuh-agent-4.7.3-1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 29111145: NOKEY Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Created symlink /etc/systemd/system/multi-user.target.wants/wazuh-agent.service → /usr/lib/systemd/system/wazuh-agent.service. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Job for wazuh-agent.service failed because the control process exited with error code. See "systemctl status wazuh-agent.service" and "journalctl -xeu wazuh-agent.service" for details. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-18 20:06:26] [INFO] TESTER: Checking connection to redhat-9[0m [33m[2024-04-18 20:06:32] [WARNING] TESTER: Error on attempt 1 of 10: [Errno None] Unable to connect to port 2200 on 3.80.132.164[0m [33m[2024-04-18 20:07:02] [WARNING] TESTER: Error on attempt 2 of 10: [Errno None] Unable to connect to port 2200 on 3.80.132.164[0m [32m[2024-04-18 20:07:34] [INFO] TESTER: Connection established successfully in redhat-9[0m [32m[2024-04-18 20:07:36] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-18 20:07:38] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-18 20:07:40] [INFO] TESTER: No Firewall to disable on redhat-9[0m [32m[2024-04-18 20:07:42] [INFO] TESTER: Manager is already installed in ubuntu-22.04[0m [32m[2024-04-18 20:07:46] [INFO] TESTER: Generating Snapshot for Checkfile in redhat-9[0m [32m[2024-04-18 20:08:04] [INFO] TESTER: Installing Agent in redhat-9[0m [32m[2024-04-18 20:09:07] [INFO] TESTER: Generating Snapshot for Checkfile in redhat-9[0m [32m[2024-04-18 20:09:18] [INFO] TESTER: Applying filters in checkfiles in redhat-9[0m [32m[2024-04-18 20:09:18] [INFO] TESTER: Pre and post install checkfile comparison in redhat-9: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m PASSED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-18 20:09:20] [INFO] TESTER: Getting status of redhat-9[0m PASSED modules/testing/tests/test_agent/test_install.py::test_version PASSED modules/testing/tests/test_agent/test_install.py::test_revision PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ================== 4 passed, 2 warnings in 180.32s (0:03:00) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:09:27] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:09:27] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:09:27] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:09:27] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:31.181392' end: '2024-04-18 20:09:59.765489' msg: non-zero return code rc: 1 start: '2024-04-18 20:09:28.584097' stderr: |- Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-18 20:09:28] [INFO] TESTER: Checking connection to redhat-9[0m [32m[2024-04-18 20:09:30] [INFO] TESTER: Connection established successfully in redhat-9[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-18 20:09:47] [INFO] TESTER: Getting status of redhat-9[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys PASSED =================================== FAILURES =================================== _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' E AssertionError: The agent-linux-redhat-9-amd64 is not present in the master by command E assert 'agent-linux-redhat-9-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_registration.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive =================== 2 failed, 3 passed, 2 warnings in 30.77s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:09:59] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:09:59] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:09:59] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:09:59] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:28.255753' end: '2024-04-18 20:10:29.411527' msg: non-zero return code rc: 1 start: '2024-04-18 20:10:01.155774' stderr: |- Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-18 20:10:01] [INFO] TESTER: Checking connection to redhat-9[0m [32m[2024-04-18 20:10:03] [INFO] TESTER: Connection established successfully in redhat-9[0m [32m[2024-04-18 20:10:09] [INFO] TESTER: Restarting wazuh-agent in redhat-9[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-18 20:10:20] [INFO] TESTER: Getting status of redhat-9[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_connection [31m[2024-04-18 20:10:24] [ERROR] TESTER: agent-linux-redhat-9-amd64 is not present in agent_control information[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive PASSED modules/testing/tests/test_agent/test_restart.py::test_clientKeys PASSED =================================== FAILURES =================================== _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is not present in agent_control information') E AssertionError: None E assert 'agent-linux-redhat-9-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_restart.py:76: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_restart.py::test_connection - As... =================== 1 failed, 4 passed, 2 warnings in 27.88s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:10:29] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:10:29] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:10:29] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:10:29] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:26.002109' end: '2024-04-18 20:10:56.773927' msg: non-zero return code rc: 1 start: '2024-04-18 20:10:30.771818' stderr: |- Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-18 20:10:31] [INFO] TESTER: Checking connection to redhat-9[0m [32m[2024-04-18 20:10:32] [INFO] TESTER: Connection established successfully in redhat-9[0m FAILED[32m[2024-04-18 20:10:45] [INFO] TESTER: Restarting wazuh-agent in redhat-9[0m =================================== FAILURES =================================== __________________________________ test_stop ___________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-3-80-51-50.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6Rzg2dW5aV3hGY1JuaD9PN1VlMWczQVp5TD8uVj8uZmY=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_stop(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_stop.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-3-80-51-50.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_stop.py::test_stop - requests.ex... ======================== 1 failed, 2 warnings in 25.61s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:10:56] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:10:56] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:10:56] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:10:56] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' - --live=True - -s delta: '0:11:38.329228' end: '2024-04-18 20:22:36.472022' msg: non-zero return code rc: 1 start: '2024-04-18 20:10:58.142794' stderr: |- Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to disable unit: Unit file wazuh-agent.service does not exist. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-132-164.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-18 20:10:58] [INFO] TESTER: Checking connection to redhat-9[0m [32m[2024-04-18 20:10:59] [INFO] TESTER: Connection established successfully in redhat-9[0m [32m[2024-04-18 20:11:12] [INFO] TESTER: Generating Snapshot for Checkfile in redhat-9[0m [32m[2024-04-18 20:11:26] [INFO] TESTER: Uninstalling Agent in redhat-9[0m [32m[2024-04-18 20:11:53] [INFO] TESTER: Generating Snapshot for Checkfile in redhat-9[0m [32m[2024-04-18 20:12:05] [INFO] TESTER: Applying filters in checkfiles in redhat-9[0m [32m[2024-04-18 20:12:05] [INFO] TESTER: Pre and post uninstall checkfile comparison in redhat-9: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m [31m[2024-04-18 20:12:07] [ERROR] TESTER: agent-linux-redhat-9-amd64 is still connected in the Manager[0m FAILED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive [31m[2024-04-18 20:22:36] [ERROR] TESTER: Time out, Expected condition was not met[0m FAILED =================================== FAILURES =================================== ________________________________ test_uninstall ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_uninstall(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not Active before the installation') assert HostInformation.dir_exists(agent_params, WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in the host {agent_names}') # Agent installation for agent_names, agent_params in wazuh_params['agents'].items(): WazuhAgent.perform_uninstall_and_scan_for_agent(agent_params,wazuh_params) # Manager uninstallation status check for agent_names, agent_params in wazuh_params['agents'].items(): > assert 'Disconnected' in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is still connected in the Manager') E AssertionError: None E assert 'Disconnected' in '\nWazuh agent_control. List of available agents:\n ID: 000, Name: ip-172-31-20-143 (server), IP: 127.0.0.1, Active/Local\n ID: 001, Name: agent-linux-centos-8-amd64, IP: any, Active\n\nList of agentless devices:\n\n' E + where '\nWazuh agent_control. List of available agents:\n ID: 000, Name: ip-172-31-20-143 (server), IP: 127.0.0.1, Active/Local\n ID: 001, Name: agent-linux-centos-8-amd64, IP: any, Active\n\nList of agentless devices:\n\n' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_uninstall.py:77: AssertionError ________________________________ test_isActive _________________________________ wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): wazuh_api = WazuhAPI(wazuh_params['master']) for agent_names, agent_params in wazuh_params['agents'].items(): assert not GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not inactive by command') expected_condition_func = lambda: 'disconnected' == WazuhAgent.get_agent_status(wazuh_api, agent_names) > Waits.dynamic_wait(expected_condition_func, cycles=20, waiting_time=30) modules/testing/tests/test_agent/test_uninstall.py:91: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ expected_condition_func = . at 0x79061d64fac0> cycles = 20, waiting_time = 30 @staticmethod def dynamic_wait(expected_condition_func, cycles=10, waiting_time=10) -> None: """ Waits the process during assigned cycles for the assigned seconds Args: expected_condition_func (lambda function): The function that returns True when the expected condition is met cycles(int): Number of cycles waiting_Time(int): Number of seconds per cycle """ for _ in range(cycles): if expected_condition_func(): break else: time.sleep(waiting_time) else: logger.error('Time out, Expected condition was not met') > raise RuntimeError(f'Time out') E RuntimeError: Time out modules/testing/tests/helpers/generic.py:658: RuntimeError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_uninstall.py::test_uninstall - A... FAILED modules/testing/tests/test_agent/test_uninstall.py::test_isActive - Ru... ============= 2 failed, 1 passed, 2 warnings in 697.95s (0:11:37) ============== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:22:36] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:22:36] [INFO] TESTER: Cleaning up [2024-04-18 20:22:36] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:22:36] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:22:46] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:22:46] [INFO] TESTER: Cleaning up [2024-04-18 20:22:46] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:22:46] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:22:57] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:22:57] [INFO] [3958] [ThreadPoolExecutor-0_4] [workflow_engine]: [run-agent-linux-redhat-9-amd64-tests] Finished task in 994.74 seconds. [2024-04-18 20:24:33] [DEBUG] [3958] [ThreadPoolExecutor-0_8] [workflow_engine]: Finished task "run-agent-linux-redhat-7-amd64-tests" execution with result: [2024-04-18 20:06:24] [INFO] TESTER: Running tests for ec2-3-80-51-50.compute-1.amazonaws.com [2024-04-18 20:06:24] [INFO] TESTER: Running tests for ec2-3-93-165-197.compute-1.amazonaws.com [2024-04-18 20:06:24] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-3-93-165-197.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-18 20:06:24] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-18 20:06:24] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:24] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-3-93-165-197.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-3-80-51-50.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.004257' end: '2024-04-18 20:06:26.036011' item: ec2-3-80-51-50.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:26.031754' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-3-93-165-197.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.005190' end: '2024-04-18 20:06:26.196967' item: ec2-3-93-165-197.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-18 20:06:26.191777' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:06:26] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-3-80-51-50.compute-1.amazonaws.com', 'ec2-3-93-165-197.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-18 20:06:26] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:06:26] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:06:26] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' - --live=True - -s delta: '0:05:20.487690' end: '2024-04-18 20:11:48.408367' msg: non-zero return code rc: 1 start: '2024-04-18 20:06:27.920677' stderr: |- ssh: connect to host ec2-3-93-165-197.compute-1.amazonaws.com port 2200: Connection refused ssh: connect to host ec2-3-93-165-197.compute-1.amazonaws.com port 2200: Connection refused Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. ssh: connect to host ec2-3-93-165-197.compute-1.amazonaws.com port 2200: Connection refused ssh: connect to host ec2-3-93-165-197.compute-1.amazonaws.com port 2200: Connection refused ssh: connect to host ec2-3-93-165-197.compute-1.amazonaws.com port 2200: Connection refused ssh: connect to host ec2-3-93-165-197.compute-1.amazonaws.com port 2200: Connection refused ssh: connect to host ec2-3-93-165-197.compute-1.amazonaws.com port 2200: Connection refused stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-18 20:06:28] [INFO] TESTER: Checking connection to redhat-7[0m [33m[2024-04-18 20:06:39] [WARNING] TESTER: Error on attempt 1 of 10: [Errno None] Unable to connect to port 2200 on 3.93.165.197[0m [33m[2024-04-18 20:07:10] [WARNING] TESTER: Error on attempt 2 of 10: [Errno None] Unable to connect to port 2200 on 3.93.165.197[0m [33m[2024-04-18 20:07:40] [WARNING] TESTER: Error on attempt 3 of 10: [Errno None] Unable to connect to port 2200 on 3.93.165.197[0m [33m[2024-04-18 20:08:10] [WARNING] TESTER: Error on attempt 4 of 10: [Errno None] Unable to connect to port 2200 on 3.93.165.197[0m [33m[2024-04-18 20:08:40] [WARNING] TESTER: Error on attempt 5 of 10: [Errno None] Unable to connect to port 2200 on 3.93.165.197[0m [33m[2024-04-18 20:09:10] [WARNING] TESTER: Error on attempt 6 of 10: [Errno None] Unable to connect to port 2200 on 3.93.165.197[0m [33m[2024-04-18 20:09:41] [WARNING] TESTER: Error on attempt 7 of 10: [Errno None] Unable to connect to port 2200 on 3.93.165.197[0m [33m[2024-04-18 20:10:11] [WARNING] TESTER: Error on attempt 8 of 10: [Errno None] Unable to connect to port 2200 on 3.93.165.197[0m [33m[2024-04-18 20:10:41] [WARNING] TESTER: Error on attempt 9 of 10: [Errno None] Unable to connect to port 2200 on 3.93.165.197[0m [33m[2024-04-18 20:11:11] [WARNING] TESTER: Error on attempt 10 of 10: [Errno None] Unable to connect to port 2200 on 3.93.165.197[0m [31m[2024-04-18 20:11:41] [ERROR] TESTER: Connection attempts failed after 10 tries. Connection timeout in redhat-7[0m [32m[2024-04-18 20:11:42] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-18 20:11:43] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-18 20:11:43] [INFO] TESTER: No Firewall to disable on redhat-7[0m [32m[2024-04-18 20:11:45] [INFO] TESTER: Manager is already installed in ubuntu-22.04[0m [32m[2024-04-18 20:11:47] [INFO] TESTER: Generating Snapshot for Checkfile in redhat-7[0m [32m[2024-04-18 20:11:47] [INFO] TESTER: Unsupported operating system[0m [32m[2024-04-18 20:11:47] [INFO] TESTER: Unsupported operating system[0m [32m[2024-04-18 20:11:47] [INFO] TESTER: Unsupported operating system[0m [32m[2024-04-18 20:11:47] [INFO] TESTER: Unsupported operating system[0m [32m[2024-04-18 20:11:47] [INFO] TESTER: Installing Agent in redhat-7[0m [32m[2024-04-18 20:11:47] [INFO] TESTER: Generating Snapshot for Checkfile in redhat-7[0m [32m[2024-04-18 20:11:47] [INFO] TESTER: Unsupported operating system[0m [32m[2024-04-18 20:11:47] [INFO] TESTER: Unsupported operating system[0m [32m[2024-04-18 20:11:47] [INFO] TESTER: Unsupported operating system[0m [32m[2024-04-18 20:11:47] [INFO] TESTER: Unsupported operating system[0m FAILED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-18 20:11:47] [INFO] TESTER: Getting status of redhat-7[0m [31m[2024-04-18 20:11:47] [ERROR] TESTER: The redhat-7 status is not loaded[0m FAILED modules/testing/tests/test_agent/test_install.py::test_version [31m[2024-04-18 20:11:48] [ERROR] TESTER: The version redhat-7 is not 4.7.3 by command[0m FAILED modules/testing/tests/test_agent/test_install.py::test_revision [31m[2024-04-18 20:11:48] [ERROR] TESTER: The revision redhat-7 is not 40714 by command[0m FAILED =================================== FAILURES =================================== ______________________________ test_installation _______________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_installation(wazuh_params): # Checking connection for manager_name, manager_params in wazuh_params['managers'].items(): Utils.check_inventory_connection(manager_params) # Certs creation, firewall management and Manager installation for agent_name, agent_params in wazuh_params['agents'].items(): HostConfiguration.disable_firewall(agent_params) if HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT): logger.info(f'Manager is already installed in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') else: HostConfiguration.disable_firewall(manager_params) HostConfiguration.certs_create(wazuh_params['wazuh_version'], wazuh_params['master'], wazuh_params['dashboard'], wazuh_params['indexers'], wazuh_params['workers']) WazuhManager.install_manager(wazuh_params['master'], 'wazuh-1', wazuh_params['wazuh_version']) assert HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') # Agent installation for agent_names, agent_params in wazuh_params['agents'].items(): > WazuhAgent.perform_install_and_scan_for_agent(agent_params, agent_names, wazuh_params) modules/testing/tests/test_agent/test_install.py:85: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/agent.py:249: in perform_install_and_scan_for_agent result = WazuhAgent.perform_action_and_scan(agent_params, action_callback) modules/testing/tests/helpers/agent.py:189: in perform_action_and_scan result = CheckFiles.perform_action_and_scan(agent_params, action_callback) modules/testing/tests/helpers/generic.py:517: in perform_action_and_scan changes = {directory: CheckFiles._calculate_changes(initial_scans[directory], second_scans[directory]) for directory in directories} modules/testing/tests/helpers/generic.py:517: in changes = {directory: CheckFiles._calculate_changes(initial_scans[directory], second_scans[directory]) for directory in directories} _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ initial_scan = None, second_scan = None @staticmethod def _calculate_changes(initial_scan, second_scan): > added_files = list(set(second_scan) - set(initial_scan)) E TypeError: 'NoneType' object is not iterable modules/testing/tests/helpers/generic.py:485: TypeError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): agent_status = GeneralComponentActions.get_component_status(agent, 'wazuh-agent') > assert 'loaded' in agent_status, logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} status is not loaded') E AssertionError: None E assert 'loaded' in '' modules/testing/tests/test_agent/test_install.py:95: AssertionError _________________________________ test_version _________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_version(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_version'] in GeneralComponentActions.get_component_version(agent_params), logger.error(f"The version {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_version']} by command") E AssertionError: None E assert '4.7.3' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_version modules/testing/tests/test_agent/test_install.py:100: AssertionError ________________________________ test_revision _________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_revision(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_revision'] in GeneralComponentActions.get_component_revision(agent_params), logger.error(f"The revision {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_revision']} by command") E AssertionError: None E assert '40714' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_revision modules/testing/tests/test_agent/test_install.py:105: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_install.py::test_installation - ... FAILED modules/testing/tests/test_agent/test_install.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_install.py::test_version - Asser... FAILED modules/testing/tests/test_agent/test_install.py::test_revision - Asse... ================== 4 failed, 2 warnings in 320.10s (0:05:20) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:11:48] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:11:48] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:11:48] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:11:48] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' - --live=True - -s delta: '0:01:01.269611' end: '2024-04-18 20:12:51.026756' msg: non-zero return code rc: 1 start: '2024-04-18 20:11:49.757145' stderr: |- Warning: Permanently added '[ec2-3-93-165-197.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-93-165-197.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sed: can't read /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-3-93-165-197.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit not found. Warning: Permanently added '[ec2-3-93-165-197.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. cat: /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-3-93-165-197.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-93-165-197.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-93-165-197.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-18 20:11:50] [INFO] TESTER: Checking connection to redhat-7[0m [33m[2024-04-18 20:11:50] [WARNING] TESTER: Error on attempt 1 of 10: [Errno None] Unable to connect to port 2200 on 3.93.165.197[0m [32m[2024-04-18 20:12:22] [INFO] TESTER: Connection established successfully in redhat-7[0m [31m[2024-04-18 20:12:33] [ERROR] TESTER: Error configuring the Manager IP (172.31.20.143)in: redhat-7 agent[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-18 20:12:33] [INFO] TESTER: Getting status of redhat-7[0m [31m[2024-04-18 20:12:36] [ERROR] TESTER: The redhat-7 is not active[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive [31m[2024-04-18 20:12:48] [ERROR] TESTER: agent-linux-redhat-7-amd64 is not active by API[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys [31m[2024-04-18 20:12:50] [ERROR] TESTER: agent-linux-redhat-7-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== ______________________________ test_registration _______________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_registration(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > WazuhAgent.register_agent(agent_params, wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:67: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ inventory_path = '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml' manager_path = {'ansible_connection': 'ssh', 'ansible_host': 'ec2-3-80-51-50.compute-1.amazonaws.com', 'ansible_port': 2200, 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040', ...} @staticmethod def register_agent(inventory_path, manager_path): with open(manager_path, 'r') as yaml_file: manager_path = yaml.safe_load(yaml_file) host = manager_path.get('ansible_host') internal_ip = HostInformation.get_internal_ip_from_aws_dns(host) if 'amazonaws' in host else host commands = [ f"sed -i 's/
MANAGER_IP<\/address>/
{internal_ip}<\/address>/g' {WAZUH_CONF}", "systemctl restart wazuh-agent" ] Executor.execute_commands(inventory_path, commands) > assert internal_ip in Executor.execute_command(inventory_path, f'cat {WAZUH_CONF}'), logger.error(f'Error configuring the Manager IP ({internal_ip})in: {HostInformation.get_os_name_and_version_from_inventory(inventory_path)} agent') E AssertionError: None modules/testing/tests/helpers/agent.py:106: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): > assert 'active' in GeneralComponentActions.get_component_status(agent, 'wazuh-agent'), logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} is not active') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_registration.py:72: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' E AssertionError: The agent-linux-redhat-7-amd64 is not present in the master by command E assert 'agent-linux-redhat-7-amd64' in '\nWazuh agent_control. List of available agents:\n ID: 000, Name: ip-172-31-20-143 (server), IP: 127.0.0.1, Active/Local\n ID: 001, Name: agent-linux-centos-8-amd64, IP: any, Active\n\nList of agentless devices:\n\n' E + where '\nWazuh agent_control. List of available agents:\n ID: 000, Name: ip-172-31-20-143 (server), IP: 127.0.0.1, Active/Local\n ID: 001, Name: agent-linux-centos-8-amd64, IP: any, Active\n\nList of agentless devices:\n\n' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_registration.py:77: AssertionError ________________________________ test_isActive _________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): wazuh_api = WazuhAPI(wazuh_params['master']) for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by API') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_registration.py:85: AssertionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_registration.py:93: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_registration FAILED modules/testing/tests/test_agent/test_registration.py::test_status - A... FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys =================== 5 failed, 2 warnings in 60.86s (0:01:00) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:12:51] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:12:51] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:12:51] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:12:51] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:17.994001' end: '2024-04-18 20:13:10.384970' msg: non-zero return code rc: 1 start: '2024-04-18 20:12:52.390969' stderr: |- Warning: Permanently added '[ec2-3-93-165-197.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-93-165-197.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit not found. Warning: Permanently added '[ec2-3-93-165-197.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-93-165-197.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-93-165-197.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-18 20:12:52] [INFO] TESTER: Checking connection to redhat-7[0m [32m[2024-04-18 20:12:54] [INFO] TESTER: Connection established successfully in redhat-7[0m [32m[2024-04-18 20:12:57] [INFO] TESTER: Restarting wazuh-agent in redhat-7[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-18 20:12:59] [INFO] TESTER: Getting status of redhat-7[0m [31m[2024-04-18 20:13:03] [ERROR] TESTER: agent-linux-redhat-7-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_connection [31m[2024-04-18 20:13:05] [ERROR] TESTER: agent-linux-redhat-7-amd64 is not present in agent_control information[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive [31m[2024-04-18 20:13:08] [ERROR] TESTER: agent-linux-redhat-7-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys [31m[2024-04-18 20:13:10] [ERROR] TESTER: agent-linux-redhat-7-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert 'active' in GeneralComponentActions.get_component_status(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_restart.py:71: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is not present in agent_control information') E AssertionError: None E assert 'agent-linux-redhat-7-amd64' in '\nWazuh agent_control. List of available agents:\n ID: 000, Name: ip-172-31-20-143 (server), IP: 127.0.0.1, Active/Local\n ID: 001, Name: agent-linux-centos-8-amd64, IP: any, Active\n\nList of agentless devices:\n\n' E + where '\nWazuh agent_control. List of available agents:\n ID: 000, Name: ip-172-31-20-143 (server), IP: 127.0.0.1, Active/Local\n ID: 001, Name: agent-linux-centos-8-amd64, IP: any, Active\n\nList of agentless devices:\n\n' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_restart.py:76: AssertionError ________________________________ test_isActive _________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_restart.py:81: AssertionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_restart.py:86: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_restart.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_restart.py::test_connection - As... FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive - Asse... FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys - As... =================== 4 failed, 1 passed, 2 warnings in 17.62s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:13:10] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:13:10] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:13:10] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:13:10] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:18.364883' end: '2024-04-18 20:13:30.123811' msg: non-zero return code rc: 1 start: '2024-04-18 20:13:11.758928' stderr: |- Warning: Permanently added '[ec2-3-93-165-197.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-93-165-197.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to stop wazuh-agent.service: Unit wazuh-agent.service not loaded. Warning: Permanently added '[ec2-3-93-165-197.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-3-93-165-197.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit not found. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-18 20:13:12] [INFO] TESTER: Checking connection to redhat-7[0m [32m[2024-04-18 20:13:13] [INFO] TESTER: Connection established successfully in redhat-7[0m [32m[2024-04-18 20:13:23] [INFO] TESTER: Stopping wazuh-agent in redhat-7[0m [32m[2024-04-18 20:13:25] [INFO] TESTER: Getting status of redhat-7[0m [31m[2024-04-18 20:13:27] [ERROR] TESTER: agent-linux-redhat-7-amd64 is still active by command[0m FAILED[32m[2024-04-18 20:13:27] [INFO] TESTER: Restarting wazuh-agent in redhat-7[0m =================================== FAILURES =================================== __________________________________ test_stop ___________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_stop(wazuh_params): wazuh_api = WazuhAPI(wazuh_params['master']) for agent_names, agent_params in wazuh_params['agents'].items(): GeneralComponentActions.component_stop(agent_params, 'wazuh-agent') for agent_names, agent_params in wazuh_params['agents'].items(): > assert 'inactive' in GeneralComponentActions.get_component_status(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is still active by command') E AssertionError: None E assert 'inactive' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_stop.py:74: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_stop.py::test_stop - AssertionEr... ======================== 1 failed, 2 warnings in 17.96s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:13:30] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:13:30] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-18 20:13:30] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:13:30] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' - --live=True - -s delta: '0:10:36.217053' end: '2024-04-18 20:24:07.693100' msg: non-zero return code rc: 1 start: '2024-04-18 20:13:31.476047' stderr: |- Warning: Permanently added '[ec2-3-93-165-197.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-93-165-197.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-93-165-197.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-51-50.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-93-165-197.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-18 20:13:31] [INFO] TESTER: Checking connection to redhat-7[0m [32m[2024-04-18 20:13:33] [INFO] TESTER: Connection established successfully in redhat-7[0m [31m[2024-04-18 20:13:37] [ERROR] TESTER: agent-linux-redhat-7-amd64 is not Active before the installation[0m FAILED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive [31m[2024-04-18 20:24:07] [ERROR] TESTER: Time out, Expected condition was not met[0m FAILED =================================== FAILURES =================================== ________________________________ test_uninstall ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_uninstall(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not Active before the installation') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_uninstall.py:68: AssertionError ________________________________ test_isActive _________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): wazuh_api = WazuhAPI(wazuh_params['master']) for agent_names, agent_params in wazuh_params['agents'].items(): assert not GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not inactive by command') expected_condition_func = lambda: 'disconnected' == WazuhAgent.get_agent_status(wazuh_api, agent_names) > Waits.dynamic_wait(expected_condition_func, cycles=20, waiting_time=30) modules/testing/tests/test_agent/test_uninstall.py:91: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ expected_condition_func = . at 0x76ee8cff3ac0> cycles = 20, waiting_time = 30 @staticmethod def dynamic_wait(expected_condition_func, cycles=10, waiting_time=10) -> None: """ Waits the process during assigned cycles for the assigned seconds Args: expected_condition_func (lambda function): The function that returns True when the expected condition is met cycles(int): Number of cycles waiting_Time(int): Number of seconds per cycle """ for _ in range(cycles): if expected_condition_func(): break else: time.sleep(waiting_time) else: logger.error('Time out, Expected condition was not met') > raise RuntimeError(f'Time out') E RuntimeError: Time out modules/testing/tests/helpers/generic.py:658: RuntimeError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_uninstall.py::test_uninstall - A... FAILED modules/testing/tests/test_agent/test_uninstall.py::test_isActive - Ru... ============= 2 failed, 1 passed, 2 warnings in 635.84s (0:10:35) ============== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-18 20:24:07] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-18 20:24:07] [INFO] TESTER: Cleaning up [2024-04-18 20:24:07] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:24:07] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:24:21] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:24:21] [INFO] TESTER: Cleaning up [2024-04-18 20:24:21] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-3-80-51-50.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0dd777d0b08a75456/ubuntu-22.04-amd64-key-8040'}}}} [2024-04-18 20:24:21] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-3-80-51-50.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-3-80-51-50.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-3-80-51-50.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-18 20:24:33] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-3-80-51-50.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-3-80-51-50.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-18 20:24:33] [INFO] [3958] [ThreadPoolExecutor-0_8] [workflow_engine]: [run-agent-linux-redhat-7-amd64-tests] Finished task in 1089.81 seconds. [2024-04-18 20:24:33] [INFO] [3958] [MainThread] [workflow_engine]: Executing Reverse DAG tasks. [2024-04-18 20:24:33] [INFO] [3958] [MainThread] [workflow_engine]: Executing tasks in parallel. [2024-04-18 20:24:33] [INFO] [3958] [ThreadPoolExecutor-1_0] [workflow_engine]: [allocate-agent-linux-ubuntu-18.04-amd64] Starting task. [2024-04-18 20:24:33] [INFO] [3958] [ThreadPoolExecutor-1_1] [workflow_engine]: [allocate-agent-linux-ubuntu-20.04-amd64] Starting task. [2024-04-18 20:24:33] [DEBUG] [3958] [ThreadPoolExecutor-1_0] [workflow_engine]: Running task "allocate-agent-linux-ubuntu-18.04-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/track.yaml'] [2024-04-18 20:24:33] [INFO] [3958] [ThreadPoolExecutor-1_2] [workflow_engine]: [allocate-agent-linux-ubuntu-22.04-amd64] Starting task. [2024-04-18 20:24:33] [DEBUG] [3958] [ThreadPoolExecutor-1_1] [workflow_engine]: Running task "allocate-agent-linux-ubuntu-20.04-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/track.yaml'] [2024-04-18 20:24:33] [INFO] [3958] [ThreadPoolExecutor-1_3] [workflow_engine]: [allocate-agent-linux-debian-10-amd64] Starting task. [2024-04-18 20:24:33] [DEBUG] [3958] [ThreadPoolExecutor-1_2] [workflow_engine]: Running task "allocate-agent-linux-ubuntu-22.04-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/track.yaml'] [2024-04-18 20:24:33] [INFO] [3958] [ThreadPoolExecutor-1_4] [workflow_engine]: [allocate-agent-linux-debian-11-amd64] Starting task. [2024-04-18 20:24:33] [INFO] [3958] [ThreadPoolExecutor-1_5] [workflow_engine]: [allocate-agent-linux-debian-12-amd64] Starting task. [2024-04-18 20:24:33] [INFO] [3958] [ThreadPoolExecutor-1_6] [workflow_engine]: [allocate-agent-linux-oracle-9-amd64] Starting task. [2024-04-18 20:24:33] [DEBUG] [3958] [ThreadPoolExecutor-1_3] [workflow_engine]: Running task "allocate-agent-linux-debian-10-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-debian-10-amd64/track.yaml'] [2024-04-18 20:24:33] [INFO] [3958] [ThreadPoolExecutor-1_7] [workflow_engine]: [allocate-agent-linux-centos-7-amd64] Starting task. [2024-04-18 20:24:33] [INFO] [3958] [ThreadPoolExecutor-1_8] [workflow_engine]: [allocate-agent-linux-centos-8-amd64] Starting task. [2024-04-18 20:24:33] [INFO] [3958] [ThreadPoolExecutor-1_9] [workflow_engine]: [allocate-agent-linux-redhat-7-amd64] Starting task. [2024-04-18 20:24:33] [INFO] [3958] [ThreadPoolExecutor-1_10] [workflow_engine]: [allocate-agent-linux-redhat-8-amd64] Starting task. [2024-04-18 20:24:33] [INFO] [3958] [ThreadPoolExecutor-1_11] [workflow_engine]: [allocate-agent-linux-redhat-9-amd64] Starting task. [2024-04-18 20:24:33] [DEBUG] [3958] [ThreadPoolExecutor-1_4] [workflow_engine]: Running task "allocate-agent-linux-debian-11-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-debian-11-amd64/track.yaml'] [2024-04-18 20:24:33] [DEBUG] [3958] [ThreadPoolExecutor-1_5] [workflow_engine]: Running task "allocate-agent-linux-debian-12-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-debian-12-amd64/track.yaml'] [2024-04-18 20:24:34] [DEBUG] [3958] [ThreadPoolExecutor-1_6] [workflow_engine]: Running task "allocate-agent-linux-oracle-9-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-oracle-9-amd64/track.yaml'] [2024-04-18 20:24:34] [DEBUG] [3958] [ThreadPoolExecutor-1_7] [workflow_engine]: Running task "allocate-agent-linux-centos-7-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-centos-7-amd64/track.yaml'] [2024-04-18 20:24:34] [DEBUG] [3958] [ThreadPoolExecutor-1_8] [workflow_engine]: Running task "allocate-agent-linux-centos-8-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-centos-8-amd64/track.yaml'] [2024-04-18 20:24:34] [DEBUG] [3958] [ThreadPoolExecutor-1_9] [workflow_engine]: Running task "allocate-agent-linux-redhat-7-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-redhat-7-amd64/track.yaml'] [2024-04-18 20:24:34] [DEBUG] [3958] [ThreadPoolExecutor-1_10] [workflow_engine]: Running task "allocate-agent-linux-redhat-8-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-redhat-8-amd64/track.yaml'] [2024-04-18 20:24:34] [DEBUG] [3958] [ThreadPoolExecutor-1_11] [workflow_engine]: Running task "allocate-agent-linux-redhat-9-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-redhat-9-amd64/track.yaml'] [2024-04-18 20:25:07] [DEBUG] [3958] [ThreadPoolExecutor-1_1] [workflow_engine]: Finished task "allocate-agent-linux-ubuntu-20.04-amd64" execution with result: [2024-04-18 20:24:34] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/track.yaml [2024-04-18 20:24:35] [DEBUG] ALLOCATOR: Deleting credentials: ubuntu-20.04-amd64-key-4898 [2024-04-18 20:25:07] [INFO] ALLOCATOR: Instance i-0edc1b0a3f06c1f49 deleted. [2024-04-18 20:25:07] [INFO] [3958] [ThreadPoolExecutor-1_1] [workflow_engine]: [allocate-agent-linux-ubuntu-20.04-amd64] Finished task in 33.62 seconds. [2024-04-18 20:25:07] [INFO] [3958] [ThreadPoolExecutor-1_1] [workflow_engine]: [allocate-agent-linux-amazon-2-amd64] Starting task. [2024-04-18 20:25:07] [DEBUG] [3958] [ThreadPoolExecutor-1_1] [workflow_engine]: Running task "allocate-agent-linux-amazon-2-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-amazon-2-amd64/track.yaml'] [2024-04-18 20:25:07] [DEBUG] [3958] [ThreadPoolExecutor-1_10] [workflow_engine]: Finished task "allocate-agent-linux-redhat-8-amd64" execution with result: [2024-04-18 20:24:34] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-redhat-8-amd64/track.yaml [2024-04-18 20:24:35] [DEBUG] ALLOCATOR: Deleting credentials: redhat-8-amd64-key-6147 [2024-04-18 20:25:07] [INFO] ALLOCATOR: Instance i-04e8c1e0ce1934a54 deleted. [2024-04-18 20:25:07] [INFO] [3958] [ThreadPoolExecutor-1_10] [workflow_engine]: [allocate-agent-linux-redhat-8-amd64] Finished task in 33.71 seconds. [2024-04-18 20:25:22] [DEBUG] [3958] [ThreadPoolExecutor-1_3] [workflow_engine]: Finished task "allocate-agent-linux-debian-10-amd64" execution with result: [2024-04-18 20:24:34] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-debian-10-amd64/track.yaml [2024-04-18 20:24:35] [DEBUG] ALLOCATOR: Deleting credentials: debian-10-amd64-key-8292 [2024-04-18 20:25:22] [INFO] ALLOCATOR: Instance i-04a7937de007561bd deleted. [2024-04-18 20:25:22] [INFO] [3958] [ThreadPoolExecutor-1_3] [workflow_engine]: [allocate-agent-linux-debian-10-amd64] Finished task in 48.97 seconds. [2024-04-18 20:25:22] [DEBUG] [3958] [ThreadPoolExecutor-1_2] [workflow_engine]: Finished task "allocate-agent-linux-ubuntu-22.04-amd64" execution with result: [2024-04-18 20:24:34] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/track.yaml [2024-04-18 20:24:35] [DEBUG] ALLOCATOR: Deleting credentials: ubuntu-22.04-amd64-key-4028 [2024-04-18 20:25:22] [INFO] ALLOCATOR: Instance i-046a46ff153e56ba0 deleted. [2024-04-18 20:25:22] [INFO] [3958] [ThreadPoolExecutor-1_2] [workflow_engine]: [allocate-agent-linux-ubuntu-22.04-amd64] Finished task in 49.01 seconds. [2024-04-18 20:25:23] [DEBUG] [3958] [ThreadPoolExecutor-1_6] [workflow_engine]: Finished task "allocate-agent-linux-oracle-9-amd64" execution with result: [2024-04-18 20:24:34] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-oracle-9-amd64/track.yaml [2024-04-18 20:24:35] [DEBUG] ALLOCATOR: Deleting credentials: oracle-9-amd64-key-1080 [2024-04-18 20:25:22] [INFO] ALLOCATOR: Instance i-047688142999192b2 deleted. [2024-04-18 20:25:23] [INFO] [3958] [ThreadPoolExecutor-1_6] [workflow_engine]: [allocate-agent-linux-oracle-9-amd64] Finished task in 49.04 seconds. [2024-04-18 20:25:23] [DEBUG] [3958] [ThreadPoolExecutor-1_7] [workflow_engine]: Finished task "allocate-agent-linux-centos-7-amd64" execution with result: [2024-04-18 20:24:34] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-centos-7-amd64/track.yaml [2024-04-18 20:24:35] [DEBUG] ALLOCATOR: Deleting credentials: centos-7-amd64-key-4683 [2024-04-18 20:25:22] [INFO] ALLOCATOR: Instance i-09bbcc3f7bcd96a49 deleted. [2024-04-18 20:25:23] [INFO] [3958] [ThreadPoolExecutor-1_7] [workflow_engine]: [allocate-agent-linux-centos-7-amd64] Finished task in 49.04 seconds. [2024-04-18 20:25:23] [DEBUG] [3958] [ThreadPoolExecutor-1_11] [workflow_engine]: Finished task "allocate-agent-linux-redhat-9-amd64" execution with result: [2024-04-18 20:24:34] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-redhat-9-amd64/track.yaml [2024-04-18 20:24:35] [DEBUG] ALLOCATOR: Deleting credentials: redhat-9-amd64-key-3233 [2024-04-18 20:25:22] [INFO] ALLOCATOR: Instance i-05b2bb35be65300a1 deleted. [2024-04-18 20:25:23] [INFO] [3958] [ThreadPoolExecutor-1_11] [workflow_engine]: [allocate-agent-linux-redhat-9-amd64] Finished task in 49.04 seconds. [2024-04-18 20:25:38] [DEBUG] [3958] [ThreadPoolExecutor-1_4] [workflow_engine]: Finished task "allocate-agent-linux-debian-11-amd64" execution with result: [2024-04-18 20:24:34] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-debian-11-amd64/track.yaml [2024-04-18 20:24:35] [DEBUG] ALLOCATOR: Deleting credentials: debian-11-amd64-key-6811 [2024-04-18 20:25:38] [INFO] ALLOCATOR: Instance i-0a499b9967cdc71e3 deleted. [2024-04-18 20:25:38] [INFO] [3958] [ThreadPoolExecutor-1_4] [workflow_engine]: [allocate-agent-linux-debian-11-amd64] Finished task in 64.16 seconds. [2024-04-18 20:25:38] [DEBUG] [3958] [ThreadPoolExecutor-1_9] [workflow_engine]: Finished task "allocate-agent-linux-redhat-7-amd64" execution with result: [2024-04-18 20:24:34] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-redhat-7-amd64/track.yaml [2024-04-18 20:24:35] [DEBUG] ALLOCATOR: Deleting credentials: redhat-7-amd64-key-3192 [2024-04-18 20:25:38] [INFO] ALLOCATOR: Instance i-02fed24715255ec67 deleted. [2024-04-18 20:25:38] [INFO] [3958] [ThreadPoolExecutor-1_9] [workflow_engine]: [allocate-agent-linux-redhat-7-amd64] Finished task in 64.29 seconds. [2024-04-18 20:25:38] [DEBUG] [3958] [ThreadPoolExecutor-1_5] [workflow_engine]: Finished task "allocate-agent-linux-debian-12-amd64" execution with result: [2024-04-18 20:24:34] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-debian-12-amd64/track.yaml [2024-04-18 20:24:35] [DEBUG] ALLOCATOR: Deleting credentials: debian-12-amd64-key-5946 [2024-04-18 20:25:38] [INFO] ALLOCATOR: Instance i-0df106e158d201bb8 deleted. [2024-04-18 20:25:38] [INFO] [3958] [ThreadPoolExecutor-1_5] [workflow_engine]: [allocate-agent-linux-debian-12-amd64] Finished task in 64.42 seconds. [2024-04-18 20:25:41] [DEBUG] [3958] [ThreadPoolExecutor-1_1] [workflow_engine]: Finished task "allocate-agent-linux-amazon-2-amd64" execution with result: [2024-04-18 20:25:07] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-amazon-2-amd64/track.yaml [2024-04-18 20:25:08] [DEBUG] ALLOCATOR: Deleting credentials: amazon-2-amd64-key-1184 [2024-04-18 20:25:41] [INFO] ALLOCATOR: Instance i-091aa23e844cef28f deleted. [2024-04-18 20:25:41] [INFO] [3958] [ThreadPoolExecutor-1_1] [workflow_engine]: [allocate-agent-linux-amazon-2-amd64] Finished task in 34.27 seconds. [2024-04-18 20:25:53] [DEBUG] [3958] [ThreadPoolExecutor-1_0] [workflow_engine]: Finished task "allocate-agent-linux-ubuntu-18.04-amd64" execution with result: [2024-04-18 20:24:34] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/track.yaml [2024-04-18 20:24:35] [DEBUG] ALLOCATOR: Deleting credentials: ubuntu-18.04-amd64-key-1823 [2024-04-18 20:25:53] [INFO] ALLOCATOR: Instance i-0654f4cfe549ee66c deleted. [2024-04-18 20:25:53] [INFO] [3958] [ThreadPoolExecutor-1_0] [workflow_engine]: [allocate-agent-linux-ubuntu-18.04-amd64] Finished task in 79.33 seconds. [2024-04-18 20:25:53] [DEBUG] [3958] [ThreadPoolExecutor-1_8] [workflow_engine]: Finished task "allocate-agent-linux-centos-8-amd64" execution with result: [2024-04-18 20:24:34] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-centos-8-amd64/track.yaml [2024-04-18 20:24:35] [DEBUG] ALLOCATOR: Deleting credentials: centos-8-amd64-key-3855 [2024-04-18 20:25:53] [INFO] ALLOCATOR: Instance i-08414c48c226d0c1f deleted. [2024-04-18 20:25:53] [INFO] [3958] [ThreadPoolExecutor-1_8] [workflow_engine]: [allocate-agent-linux-centos-8-amd64] Finished task in 79.54 seconds. [2024-04-18 20:25:53] [INFO] [3958] [ThreadPoolExecutor-1_10] [workflow_engine]: [allocate-manager-linux-ubuntu-22.04-amd64] Starting task. [2024-04-18 20:25:53] [DEBUG] [3958] [ThreadPoolExecutor-1_10] [workflow_engine]: Running task "allocate-manager-linux-ubuntu-22.04-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/track.yaml'] [2024-04-18 20:26:57] [DEBUG] [3958] [ThreadPoolExecutor-1_10] [workflow_engine]: Finished task "allocate-manager-linux-ubuntu-22.04-amd64" execution with result: [2024-04-18 20:25:53] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/track.yaml [2024-04-18 20:25:54] [DEBUG] ALLOCATOR: Deleting credentials: ubuntu-22.04-amd64-key-8040 [2024-04-18 20:26:57] [INFO] ALLOCATOR: Instance i-0dd777d0b08a75456 deleted. [2024-04-18 20:26:57] [INFO] [3958] [ThreadPoolExecutor-1_10] [workflow_engine]: [allocate-manager-linux-ubuntu-22.04-amd64] Finished task in 64.40 seconds. (dtt-test) marcelo@marcelo-B460-AORUS-PRO-AC:~/wazuh/wazuh-qa/deployability$ python -m workflow_engine dtt1-threads.yaml --log-level DEBUG --threads 12 --dry-run [2024-04-18 20:28:39] [DEBUG] [19239] [MainThread] [workflow_engine]: Validating input file: dtt1-threads.yaml [2024-04-18 20:28:39] [DEBUG] [19239] [MainThread] [workflow_engine]: Loading schema file: /home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/workflow_engine/schemas/schema_v1.json [2024-04-18 20:28:39] [DEBUG] [19239] [MainThread] [workflow_engine]: Loading yaml file: dtt1-threads.yaml [2024-04-18 20:28:39] [DEBUG] [19239] [MainThread] [workflow_engine]: Loading workflow file: dtt1-threads.yaml [2024-04-18 20:28:39] [DEBUG] [19239] [MainThread] [workflow_engine]: Process workflow. [2024-04-18 20:28:39] [INFO] [19239] [MainThread] [workflow_engine]: Execution plan: { "run-agent-linux-debian-11-amd64-tests": { "allocate-agent-linux-debian-11-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-debian-10-amd64-tests": { "allocate-agent-linux-debian-10-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-debian-12-amd64-tests": { "allocate-agent-linux-debian-12-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-redhat-9-amd64-tests": { "allocate-agent-linux-redhat-9-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-oracle-9-amd64-tests": { "allocate-agent-linux-oracle-9-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-ubuntu-22.04-amd64-tests": { "allocate-agent-linux-ubuntu-22.04-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-centos-8-amd64-tests": { "allocate-agent-linux-centos-8-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-amazon-2-amd64-tests": { "allocate-agent-linux-amazon-2-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-ubuntu-18.04-amd64-tests": { "allocate-agent-linux-ubuntu-18.04-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-redhat-7-amd64-tests": { "allocate-agent-linux-redhat-7-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-centos-7-amd64-tests": { "allocate-agent-linux-centos-7-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-ubuntu-20.04-amd64-tests": { "allocate-agent-linux-ubuntu-20.04-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-redhat-8-amd64-tests": { "allocate-agent-linux-redhat-8-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } } } (dtt-test) marcelo@marcelo-B460-AORUS-PRO-AC:~/wazuh/wazuh-qa/deployability$ python -m workflow_engine dtt1-threads.yaml --log-level DEBUG --dry-run [2024-04-18 20:29:22] [DEBUG] [19544] [MainThread] [workflow_engine]: Validating input file: dtt1-threads.yaml [2024-04-18 20:29:22] [DEBUG] [19544] [MainThread] [workflow_engine]: Loading schema file: /home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/workflow_engine/schemas/schema_v1.json [2024-04-18 20:29:22] [DEBUG] [19544] [MainThread] [workflow_engine]: Loading yaml file: dtt1-threads.yaml [2024-04-18 20:29:22] [DEBUG] [19544] [MainThread] [workflow_engine]: Loading workflow file: dtt1-threads.yaml [2024-04-18 20:29:22] [DEBUG] [19544] [MainThread] [workflow_engine]: Process workflow. [2024-04-18 20:29:22] [INFO] [19544] [MainThread] [workflow_engine]: Execution plan: { "run-agent-linux-ubuntu-18.04-amd64-tests": { "allocate-agent-linux-ubuntu-18.04-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-oracle-9-amd64-tests": { "allocate-agent-linux-oracle-9-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-redhat-8-amd64-tests": { "allocate-agent-linux-redhat-8-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-amazon-2-amd64-tests": { "allocate-agent-linux-amazon-2-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-debian-10-amd64-tests": { "allocate-agent-linux-debian-10-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-centos-7-amd64-tests": { "allocate-agent-linux-centos-7-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-debian-11-amd64-tests": { "allocate-agent-linux-debian-11-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-redhat-9-amd64-tests": { "allocate-agent-linux-redhat-9-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-redhat-7-amd64-tests": { "allocate-agent-linux-redhat-7-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-ubuntu-22.04-amd64-tests": { "allocate-agent-linux-ubuntu-22.04-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-ubuntu-20.04-amd64-tests": { "allocate-agent-linux-ubuntu-20.04-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-centos-8-amd64-tests": { "allocate-agent-linux-centos-8-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } }, "run-agent-linux-debian-12-amd64-tests": { "allocate-agent-linux-debian-12-amd64": { "provision-manager-linux-ubuntu-22.04-amd64": { "allocate-manager-linux-ubuntu-22.04-amd64": {} } } } } (dtt-test) marcelo@marcelo-B460-AORUS-PRO-AC:~/wazuh/wazuh-qa/deployability$ cd (dtt-test) marcelo@marcelo-B460-AORUS-PRO-AC:~$ diff workflow-dry-run-1.log workflow-dry-run-12.log 1,8c1,8 < [2024-04-18 20:29:22,173] [DEBUG] [19544] [MainThread] [workflow_engine]: Validating input file: dtt1-threads.yaml < [2024-04-18 20:29:22,173] [DEBUG] [19544] [MainThread] [workflow_engine]: Loading schema file: /home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/workflow_engine/schemas/schema_v1.json < [2024-04-18 20:29:22,173] [DEBUG] [19544] [MainThread] [workflow_engine]: Loading yaml file: dtt1-threads.yaml < [2024-04-18 20:29:22,190] [DEBUG] [19544] [MainThread] [workflow_engine]: Loading workflow file: dtt1-threads.yaml < [2024-04-18 20:29:22,198] [DEBUG] [19544] [MainThread] [workflow_engine]: Process workflow. < [2024-04-18 20:29:22,199] [INFO] [19544] [MainThread] [workflow_engine]: Execution plan: { < "run-agent-linux-ubuntu-18.04-amd64-tests": { < "allocate-agent-linux-ubuntu-18.04-amd64": { --- > [2024-04-18 20:28:39,141] [DEBUG] [19239] [MainThread] [workflow_engine]: Validating input file: dtt1-threads.yaml > [2024-04-18 20:28:39,141] [DEBUG] [19239] [MainThread] [workflow_engine]: Loading schema file: /home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/workflow_engine/schemas/schema_v1.json > [2024-04-18 20:28:39,141] [DEBUG] [19239] [MainThread] [workflow_engine]: Loading yaml file: dtt1-threads.yaml > [2024-04-18 20:28:39,158] [DEBUG] [19239] [MainThread] [workflow_engine]: Loading workflow file: dtt1-threads.yaml > [2024-04-18 20:28:39,166] [DEBUG] [19239] [MainThread] [workflow_engine]: Process workflow. > [2024-04-18 20:28:39,167] [INFO] [19239] [MainThread] [workflow_engine]: Execution plan: { > "run-agent-linux-debian-11-amd64-tests": { > "allocate-agent-linux-debian-11-amd64": { 14,15c14,15 < "run-agent-linux-oracle-9-amd64-tests": { < "allocate-agent-linux-oracle-9-amd64": { --- > "run-agent-linux-debian-10-amd64-tests": { > "allocate-agent-linux-debian-10-amd64": { 21,22c21,22 < "run-agent-linux-redhat-8-amd64-tests": { < "allocate-agent-linux-redhat-8-amd64": { --- > "run-agent-linux-debian-12-amd64-tests": { > "allocate-agent-linux-debian-12-amd64": { 28,29c28,29 < "run-agent-linux-amazon-2-amd64-tests": { < "allocate-agent-linux-amazon-2-amd64": { --- > "run-agent-linux-redhat-9-amd64-tests": { > "allocate-agent-linux-redhat-9-amd64": { 35,36c35,36 < "run-agent-linux-debian-10-amd64-tests": { < "allocate-agent-linux-debian-10-amd64": { --- > "run-agent-linux-oracle-9-amd64-tests": { > "allocate-agent-linux-oracle-9-amd64": { 42,43c42,43 < "run-agent-linux-centos-7-amd64-tests": { < "allocate-agent-linux-centos-7-amd64": { --- > "run-agent-linux-ubuntu-22.04-amd64-tests": { > "allocate-agent-linux-ubuntu-22.04-amd64": { 49,50c49,50 < "run-agent-linux-debian-11-amd64-tests": { < "allocate-agent-linux-debian-11-amd64": { --- > "run-agent-linux-centos-8-amd64-tests": { > "allocate-agent-linux-centos-8-amd64": { 56,57c56,57 < "run-agent-linux-redhat-9-amd64-tests": { < "allocate-agent-linux-redhat-9-amd64": { --- > "run-agent-linux-amazon-2-amd64-tests": { > "allocate-agent-linux-amazon-2-amd64": { 63,64c63,64 < "run-agent-linux-redhat-7-amd64-tests": { < "allocate-agent-linux-redhat-7-amd64": { --- > "run-agent-linux-ubuntu-18.04-amd64-tests": { > "allocate-agent-linux-ubuntu-18.04-amd64": { 70,71c70,71 < "run-agent-linux-ubuntu-22.04-amd64-tests": { < "allocate-agent-linux-ubuntu-22.04-amd64": { --- > "run-agent-linux-redhat-7-amd64-tests": { > "allocate-agent-linux-redhat-7-amd64": { 77,78c77,78 < "run-agent-linux-ubuntu-20.04-amd64-tests": { < "allocate-agent-linux-ubuntu-20.04-amd64": { --- > "run-agent-linux-centos-7-amd64-tests": { > "allocate-agent-linux-centos-7-amd64": { 84,85c84,85 < "run-agent-linux-centos-8-amd64-tests": { < "allocate-agent-linux-centos-8-amd64": { --- > "run-agent-linux-ubuntu-20.04-amd64-tests": { > "allocate-agent-linux-ubuntu-20.04-amd64": { 91,92c91,92 < "run-agent-linux-debian-12-amd64-tests": { < "allocate-agent-linux-debian-12-amd64": { --- > "run-agent-linux-redhat-8-amd64-tests": { > "allocate-agent-linux-redhat-8-amd64": { (dtt-test) marcelo@marcelo-B460-AORUS-PRO-AC:~$ cd wazuh/wazuh-qa/ (dtt-test) marcelo@marcelo-B460-AORUS-PRO-AC:~/wazuh/wazuh-qa$ nano CHANGELOG.md conftest.py deployability/ deps/ .git/ .github/ .gitignore LICENSE provisioning/ README.md requirements.txt tests/ version.json .vscode/ (dtt-test) marcelo@marcelo-B460-AORUS-PRO-AC:~/wazuh/wazuh-qa$ cd dep deployability/ deps/ (dtt-test) marcelo@marcelo-B460-AORUS-PRO-AC:~/wazuh/wazuh-qa$ cd deployability/ (dtt-test) marcelo@marcelo-B460-AORUS-PRO-AC:~/wazuh/wazuh-qa/deployability$ nano dtt1-threads.yaml (dtt-test) marcelo@marcelo-B460-AORUS-PRO-AC:~/wazuh/wazuh-qa/deployability$ python -m workflow_engine dtt1-threads.yaml --log-level DEBUG --threads 12 [2024-04-19 09:28:09] [DEBUG] [65315] [MainThread] [workflow_engine]: Validating input file: dtt1-threads.yaml [2024-04-19 09:28:09] [DEBUG] [65315] [MainThread] [workflow_engine]: Loading schema file: /home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/workflow_engine/schemas/schema_v1.json [2024-04-19 09:28:09] [DEBUG] [65315] [MainThread] [workflow_engine]: Loading yaml file: dtt1-threads.yaml [2024-04-19 09:28:09] [ERROR] [65315] [MainThread] [workflow_engine]: Schema validation error: 300 is not of type 'string' Failed validating 'type' in schema[0]: {'type': 'string'} On instance: 300 [2024-04-19 09:28:09] [DEBUG] [65315] [MainThread] [workflow_engine]: Loading workflow file: dtt1-threads.yaml [2024-04-19 09:28:09] [DEBUG] [65315] [MainThread] [workflow_engine]: Process workflow. [2024-04-19 09:28:09] [INFO] [65315] [MainThread] [workflow_engine]: Executing DAG tasks. [2024-04-19 09:28:09] [INFO] [65315] [MainThread] [workflow_engine]: Executing tasks in parallel. [2024-04-19 09:28:09] [INFO] [65315] [ThreadPoolExecutor-0_0] [workflow_engine]: [allocate-manager-linux-ubuntu-22.04-amd64] Starting task. [2024-04-19 09:28:09] [DEBUG] [65315] [ThreadPoolExecutor-0_0] [workflow_engine]: Running task "allocate-manager-linux-ubuntu-22.04-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=large', '--composite-name=linux-ubuntu-22.04-amd64', '--inventory-output=/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] ^C[2024-04-19 09:28:29] [ERROR] [65315] [MainThread] [workflow_engine]: User interrupt detected. End process... [2024-04-19 09:28:29] [ERROR] [65315] [ThreadPoolExecutor-0_0] [workflow_engine]: [allocate-manager-linux-ubuntu-22.04-amd64] Task failed with error: Error executing process task with keyboard interrupt.. [2024-04-19 09:28:29] [ERROR] [65315] [MainThread] [workflow_engine]: User interrupt detected. Aborting execution... [2024-04-19 09:28:29] [INFO] [65315] [MainThread] [workflow_engine]: Executing tasks in parallel. [2024-04-19 09:28:29] [WARNING] [65315] [ThreadPoolExecutor-1_0] [workflow_engine]: [allocate-agent-linux-ubuntu-18.04-amd64] Skipping task due to dependency failure. [2024-04-19 09:28:29] [WARNING] [65315] [ThreadPoolExecutor-1_0] [workflow_engine]: [allocate-agent-linux-ubuntu-20.04-amd64] Skipping task due to dependency failure. [2024-04-19 09:28:29] [WARNING] [65315] [ThreadPoolExecutor-1_1] [workflow_engine]: [allocate-agent-linux-ubuntu-22.04-amd64] Skipping task due to dependency failure. [2024-04-19 09:28:29] [WARNING] [65315] [ThreadPoolExecutor-1_1] [workflow_engine]: [allocate-agent-linux-debian-10-amd64] Skipping task due to dependency failure. [2024-04-19 09:28:29] [WARNING] [65315] [ThreadPoolExecutor-1_0] [workflow_engine]: [allocate-agent-linux-debian-11-amd64] Skipping task due to dependency failure. [2024-04-19 09:28:29] [WARNING] [65315] [ThreadPoolExecutor-1_2] [workflow_engine]: [allocate-agent-linux-debian-12-amd64] Skipping task due to dependency failure. [2024-04-19 09:28:29] [WARNING] [65315] [ThreadPoolExecutor-1_3] [workflow_engine]: [allocate-agent-linux-oracle-9-amd64] Skipping task due to dependency failure. [2024-04-19 09:28:29] [WARNING] [65315] [ThreadPoolExecutor-1_1] [workflow_engine]: [allocate-agent-linux-centos-7-amd64] Skipping task due to dependency failure. [2024-04-19 09:28:29] [WARNING] [65315] [ThreadPoolExecutor-1_0] [workflow_engine]: [allocate-agent-linux-centos-8-amd64] Skipping task due to dependency failure. [2024-04-19 09:28:29] [WARNING] [65315] [ThreadPoolExecutor-1_4] [workflow_engine]: [allocate-agent-linux-redhat-7-amd64] Skipping task due to dependency failure. [2024-04-19 09:28:29] [WARNING] [65315] [ThreadPoolExecutor-1_5] [workflow_engine]: [allocate-agent-linux-redhat-8-amd64] Skipping task due to dependency failure. [2024-04-19 09:28:29] [WARNING] [65315] [ThreadPoolExecutor-1_2] [workflow_engine]: [allocate-agent-linux-redhat-9-amd64] Skipping task due to dependency failure. [2024-04-19 09:28:29] [WARNING] [65315] [ThreadPoolExecutor-1_6] [workflow_engine]: [allocate-agent-linux-amazon-2-amd64] Skipping task due to dependency failure. [2024-04-19 09:28:29] [INFO] [65315] [MainThread] [workflow_engine]: Executing Reverse DAG tasks. [2024-04-19 09:28:29] [INFO] [65315] [MainThread] [workflow_engine]: Executing tasks in parallel. [2024-04-19 09:28:29] [INFO] [65315] [ThreadPoolExecutor-2_0] [workflow_engine]: [allocate-agent-linux-ubuntu-18.04-amd64] Starting task. [2024-04-19 09:28:29] [INFO] [65315] [ThreadPoolExecutor-2_1] [workflow_engine]: [allocate-agent-linux-ubuntu-20.04-amd64] Starting task. [2024-04-19 09:28:29] [INFO] [65315] [ThreadPoolExecutor-2_2] [workflow_engine]: [allocate-agent-linux-ubuntu-22.04-amd64] Starting task. [2024-04-19 09:28:29] [DEBUG] [65315] [ThreadPoolExecutor-2_0] [workflow_engine]: Running task "allocate-agent-linux-ubuntu-18.04-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/track.yaml'] [2024-04-19 09:28:29] [INFO] [65315] [ThreadPoolExecutor-2_3] [workflow_engine]: [allocate-agent-linux-debian-10-amd64] Starting task. [2024-04-19 09:28:29] [DEBUG] [65315] [ThreadPoolExecutor-2_1] [workflow_engine]: Running task "allocate-agent-linux-ubuntu-20.04-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/track.yaml'] [2024-04-19 09:28:29] [INFO] [65315] [ThreadPoolExecutor-2_4] [workflow_engine]: [allocate-agent-linux-debian-11-amd64] Starting task. [2024-04-19 09:28:29] [DEBUG] [65315] [ThreadPoolExecutor-2_2] [workflow_engine]: Running task "allocate-agent-linux-ubuntu-22.04-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/track.yaml'] [2024-04-19 09:28:29] [INFO] [65315] [ThreadPoolExecutor-2_5] [workflow_engine]: [allocate-agent-linux-debian-12-amd64] Starting task. [2024-04-19 09:28:29] [INFO] [65315] [ThreadPoolExecutor-2_6] [workflow_engine]: [allocate-agent-linux-oracle-9-amd64] Starting task. [2024-04-19 09:28:29] [INFO] [65315] [ThreadPoolExecutor-2_7] [workflow_engine]: [allocate-agent-linux-centos-7-amd64] Starting task. [2024-04-19 09:28:29] [DEBUG] [65315] [ThreadPoolExecutor-2_3] [workflow_engine]: Running task "allocate-agent-linux-debian-10-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-debian-10-amd64/track.yaml'] [2024-04-19 09:28:29] [INFO] [65315] [ThreadPoolExecutor-2_8] [workflow_engine]: [allocate-agent-linux-centos-8-amd64] Starting task. [2024-04-19 09:28:29] [DEBUG] [65315] [ThreadPoolExecutor-2_4] [workflow_engine]: Running task "allocate-agent-linux-debian-11-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-debian-11-amd64/track.yaml'] [2024-04-19 09:28:29] [INFO] [65315] [ThreadPoolExecutor-2_9] [workflow_engine]: [allocate-agent-linux-redhat-7-amd64] Starting task. [2024-04-19 09:28:29] [INFO] [65315] [ThreadPoolExecutor-2_10] [workflow_engine]: [allocate-agent-linux-redhat-8-amd64] Starting task. [2024-04-19 09:28:29] [DEBUG] [65315] [ThreadPoolExecutor-2_5] [workflow_engine]: Running task "allocate-agent-linux-debian-12-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-debian-12-amd64/track.yaml'] [2024-04-19 09:28:29] [INFO] [65315] [ThreadPoolExecutor-2_11] [workflow_engine]: [allocate-agent-linux-redhat-9-amd64] Starting task. [2024-04-19 09:28:29] [DEBUG] [65315] [ThreadPoolExecutor-2_6] [workflow_engine]: Running task "allocate-agent-linux-oracle-9-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-oracle-9-amd64/track.yaml'] [2024-04-19 09:28:29] [DEBUG] [65315] [ThreadPoolExecutor-2_7] [workflow_engine]: Running task "allocate-agent-linux-centos-7-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-centos-7-amd64/track.yaml'] [2024-04-19 09:28:29] [DEBUG] [65315] [ThreadPoolExecutor-2_8] [workflow_engine]: Running task "allocate-agent-linux-centos-8-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-centos-8-amd64/track.yaml'] [2024-04-19 09:28:29] [DEBUG] [65315] [ThreadPoolExecutor-2_9] [workflow_engine]: Running task "allocate-agent-linux-redhat-7-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-redhat-7-amd64/track.yaml'] [2024-04-19 09:28:29] [DEBUG] [65315] [ThreadPoolExecutor-2_10] [workflow_engine]: Running task "allocate-agent-linux-redhat-8-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-redhat-8-amd64/track.yaml'] [2024-04-19 09:28:29] [DEBUG] [65315] [ThreadPoolExecutor-2_11] [workflow_engine]: Running task "allocate-agent-linux-redhat-9-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-redhat-9-amd64/track.yaml'] [2024-04-19 09:28:30] [ERROR] [65315] [ThreadPoolExecutor-2_0] [workflow_engine]: [allocate-agent-linux-ubuntu-18.04-amd64] Task failed with error: Error executing process task Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 106, in load if not key_pair.key_pair_id: File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 380, in property_loader self.load() File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 564, in do_action response = action(self, *args, **kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/action.py", line 88, in __call__ response = getattr(parent.meta.client, operation_name)(*args, **params) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 535, in _api_call return self._make_api_call(operation_name, kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 983, in _make_api_call raise error_class(parsed_response, operation_name) botocore.exceptions.ClientError: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'ubuntu-18.04-amd64-key-1823' does not exist During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 38, in main() File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 34, in main Allocator.run(InputPayload(**vars(parse_arguments()))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 38, in run return cls.__delete(payload) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 78, in __delete provider.destroy_instance(models.InstancePayload(**dict(track))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/generic/provider.py", line 101, in destroy_instance cls._destroy_instance(destroy_parameters) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/provider.py", line 163, in _destroy_instance credentials.load(key_id) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 115, in load raise self.CredentialsError(f"Failed to load key pair: {str(e)}") modules.allocation.generic.credentials.Credentials.CredentialsError: Failed to load key pair: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'ubuntu-18.04-amd64-key-1823' does not exist . [2024-04-19 09:28:30] [WARNING] [65315] [ThreadPoolExecutor-2_0] [workflow_engine]: [allocate-agent-linux-amazon-2-amd64] Skipping task due to dependency failure. [2024-04-19 09:28:30] [ERROR] [65315] [ThreadPoolExecutor-2_2] [workflow_engine]: [allocate-agent-linux-ubuntu-22.04-amd64] Task failed with error: Error executing process task Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 106, in load if not key_pair.key_pair_id: File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 380, in property_loader self.load() File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 564, in do_action response = action(self, *args, **kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/action.py", line 88, in __call__ response = getattr(parent.meta.client, operation_name)(*args, **params) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 535, in _api_call return self._make_api_call(operation_name, kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 983, in _make_api_call raise error_class(parsed_response, operation_name) botocore.exceptions.ClientError: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'ubuntu-22.04-amd64-key-4028' does not exist During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 38, in main() File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 34, in main Allocator.run(InputPayload(**vars(parse_arguments()))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 38, in run return cls.__delete(payload) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 78, in __delete provider.destroy_instance(models.InstancePayload(**dict(track))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/generic/provider.py", line 101, in destroy_instance cls._destroy_instance(destroy_parameters) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/provider.py", line 163, in _destroy_instance credentials.load(key_id) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 115, in load raise self.CredentialsError(f"Failed to load key pair: {str(e)}") modules.allocation.generic.credentials.Credentials.CredentialsError: Failed to load key pair: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'ubuntu-22.04-amd64-key-4028' does not exist . [2024-04-19 09:28:30] [ERROR] [65315] [ThreadPoolExecutor-2_5] [workflow_engine]: [allocate-agent-linux-debian-12-amd64] Task failed with error: Error executing process task Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 106, in load if not key_pair.key_pair_id: File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 380, in property_loader self.load() File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 564, in do_action response = action(self, *args, **kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/action.py", line 88, in __call__ response = getattr(parent.meta.client, operation_name)(*args, **params) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 535, in _api_call return self._make_api_call(operation_name, kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 983, in _make_api_call raise error_class(parsed_response, operation_name) botocore.exceptions.ClientError: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'debian-12-amd64-key-5946' does not exist During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 38, in main() File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 34, in main Allocator.run(InputPayload(**vars(parse_arguments()))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 38, in run return cls.__delete(payload) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 78, in __delete provider.destroy_instance(models.InstancePayload(**dict(track))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/generic/provider.py", line 101, in destroy_instance cls._destroy_instance(destroy_parameters) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/provider.py", line 163, in _destroy_instance credentials.load(key_id) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 115, in load raise self.CredentialsError(f"Failed to load key pair: {str(e)}") modules.allocation.generic.credentials.Credentials.CredentialsError: Failed to load key pair: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'debian-12-amd64-key-5946' does not exist . [2024-04-19 09:28:30] [ERROR] [65315] [ThreadPoolExecutor-2_3] [workflow_engine]: [allocate-agent-linux-debian-10-amd64] Task failed with error: Error executing process task Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 106, in load if not key_pair.key_pair_id: File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 380, in property_loader self.load() File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 564, in do_action response = action(self, *args, **kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/action.py", line 88, in __call__ response = getattr(parent.meta.client, operation_name)(*args, **params) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 535, in _api_call return self._make_api_call(operation_name, kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 983, in _make_api_call raise error_class(parsed_response, operation_name) botocore.exceptions.ClientError: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'debian-10-amd64-key-8292' does not exist During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 38, in main() File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 34, in main Allocator.run(InputPayload(**vars(parse_arguments()))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 38, in run return cls.__delete(payload) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 78, in __delete provider.destroy_instance(models.InstancePayload(**dict(track))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/generic/provider.py", line 101, in destroy_instance cls._destroy_instance(destroy_parameters) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/provider.py", line 163, in _destroy_instance credentials.load(key_id) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 115, in load raise self.CredentialsError(f"Failed to load key pair: {str(e)}") modules.allocation.generic.credentials.Credentials.CredentialsError: Failed to load key pair: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'debian-10-amd64-key-8292' does not exist . [2024-04-19 09:28:30] [ERROR] [65315] [ThreadPoolExecutor-2_1] [workflow_engine]: [allocate-agent-linux-ubuntu-20.04-amd64] Task failed with error: Error executing process task Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 106, in load if not key_pair.key_pair_id: File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 380, in property_loader self.load() File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 564, in do_action response = action(self, *args, **kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/action.py", line 88, in __call__ response = getattr(parent.meta.client, operation_name)(*args, **params) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 535, in _api_call return self._make_api_call(operation_name, kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 983, in _make_api_call raise error_class(parsed_response, operation_name) botocore.exceptions.ClientError: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'ubuntu-20.04-amd64-key-4898' does not exist During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 38, in main() File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 34, in main Allocator.run(InputPayload(**vars(parse_arguments()))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 38, in run return cls.__delete(payload) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 78, in __delete provider.destroy_instance(models.InstancePayload(**dict(track))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/generic/provider.py", line 101, in destroy_instance cls._destroy_instance(destroy_parameters) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/provider.py", line 163, in _destroy_instance credentials.load(key_id) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 115, in load raise self.CredentialsError(f"Failed to load key pair: {str(e)}") modules.allocation.generic.credentials.Credentials.CredentialsError: Failed to load key pair: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'ubuntu-20.04-amd64-key-4898' does not exist . [2024-04-19 09:28:30] [ERROR] [65315] [ThreadPoolExecutor-2_7] [workflow_engine]: [allocate-agent-linux-centos-7-amd64] Task failed with error: Error executing process task Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 106, in load if not key_pair.key_pair_id: File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 380, in property_loader self.load() File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 564, in do_action response = action(self, *args, **kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/action.py", line 88, in __call__ response = getattr(parent.meta.client, operation_name)(*args, **params) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 535, in _api_call return self._make_api_call(operation_name, kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 983, in _make_api_call raise error_class(parsed_response, operation_name) botocore.exceptions.ClientError: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'centos-7-amd64-key-4683' does not exist During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 38, in main() File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 34, in main Allocator.run(InputPayload(**vars(parse_arguments()))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 38, in run return cls.__delete(payload) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 78, in __delete provider.destroy_instance(models.InstancePayload(**dict(track))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/generic/provider.py", line 101, in destroy_instance cls._destroy_instance(destroy_parameters) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/provider.py", line 163, in _destroy_instance credentials.load(key_id) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 115, in load raise self.CredentialsError(f"Failed to load key pair: {str(e)}") modules.allocation.generic.credentials.Credentials.CredentialsError: Failed to load key pair: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'centos-7-amd64-key-4683' does not exist . [2024-04-19 09:28:30] [ERROR] [65315] [ThreadPoolExecutor-2_4] [workflow_engine]: [allocate-agent-linux-debian-11-amd64] Task failed with error: Error executing process task Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 106, in load if not key_pair.key_pair_id: File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 380, in property_loader self.load() File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 564, in do_action response = action(self, *args, **kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/action.py", line 88, in __call__ response = getattr(parent.meta.client, operation_name)(*args, **params) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 535, in _api_call return self._make_api_call(operation_name, kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 983, in _make_api_call raise error_class(parsed_response, operation_name) botocore.exceptions.ClientError: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'debian-11-amd64-key-6811' does not exist During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 38, in main() File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 34, in main Allocator.run(InputPayload(**vars(parse_arguments()))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 38, in run return cls.__delete(payload) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 78, in __delete provider.destroy_instance(models.InstancePayload(**dict(track))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/generic/provider.py", line 101, in destroy_instance cls._destroy_instance(destroy_parameters) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/provider.py", line 163, in _destroy_instance credentials.load(key_id) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 115, in load raise self.CredentialsError(f"Failed to load key pair: {str(e)}") modules.allocation.generic.credentials.Credentials.CredentialsError: Failed to load key pair: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'debian-11-amd64-key-6811' does not exist . [2024-04-19 09:28:30] [ERROR] [65315] [ThreadPoolExecutor-2_6] [workflow_engine]: [allocate-agent-linux-oracle-9-amd64] Task failed with error: Error executing process task Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 106, in load if not key_pair.key_pair_id: File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 380, in property_loader self.load() File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 564, in do_action response = action(self, *args, **kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/action.py", line 88, in __call__ response = getattr(parent.meta.client, operation_name)(*args, **params) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 535, in _api_call return self._make_api_call(operation_name, kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 983, in _make_api_call raise error_class(parsed_response, operation_name) botocore.exceptions.ClientError: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'oracle-9-amd64-key-1080' does not exist During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 38, in main() File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 34, in main Allocator.run(InputPayload(**vars(parse_arguments()))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 38, in run return cls.__delete(payload) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 78, in __delete provider.destroy_instance(models.InstancePayload(**dict(track))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/generic/provider.py", line 101, in destroy_instance cls._destroy_instance(destroy_parameters) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/provider.py", line 163, in _destroy_instance credentials.load(key_id) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 115, in load raise self.CredentialsError(f"Failed to load key pair: {str(e)}") modules.allocation.generic.credentials.Credentials.CredentialsError: Failed to load key pair: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'oracle-9-amd64-key-1080' does not exist . [2024-04-19 09:28:30] [ERROR] [65315] [ThreadPoolExecutor-2_10] [workflow_engine]: [allocate-agent-linux-redhat-8-amd64] Task failed with error: Error executing process task Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 106, in load if not key_pair.key_pair_id: File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 380, in property_loader self.load() File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 564, in do_action response = action(self, *args, **kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/action.py", line 88, in __call__ response = getattr(parent.meta.client, operation_name)(*args, **params) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 535, in _api_call return self._make_api_call(operation_name, kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 983, in _make_api_call raise error_class(parsed_response, operation_name) botocore.exceptions.ClientError: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'redhat-8-amd64-key-6147' does not exist During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 38, in main() File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 34, in main Allocator.run(InputPayload(**vars(parse_arguments()))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 38, in run return cls.__delete(payload) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 78, in __delete provider.destroy_instance(models.InstancePayload(**dict(track))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/generic/provider.py", line 101, in destroy_instance cls._destroy_instance(destroy_parameters) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/provider.py", line 163, in _destroy_instance credentials.load(key_id) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 115, in load raise self.CredentialsError(f"Failed to load key pair: {str(e)}") modules.allocation.generic.credentials.Credentials.CredentialsError: Failed to load key pair: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'redhat-8-amd64-key-6147' does not exist . [2024-04-19 09:28:30] [ERROR] [65315] [ThreadPoolExecutor-2_9] [workflow_engine]: [allocate-agent-linux-redhat-7-amd64] Task failed with error: Error executing process task Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 106, in load if not key_pair.key_pair_id: File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 380, in property_loader self.load() File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 564, in do_action response = action(self, *args, **kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/action.py", line 88, in __call__ response = getattr(parent.meta.client, operation_name)(*args, **params) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 535, in _api_call return self._make_api_call(operation_name, kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 983, in _make_api_call raise error_class(parsed_response, operation_name) botocore.exceptions.ClientError: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'redhat-7-amd64-key-3192' does not exist During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 38, in main() File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 34, in main Allocator.run(InputPayload(**vars(parse_arguments()))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 38, in run return cls.__delete(payload) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 78, in __delete provider.destroy_instance(models.InstancePayload(**dict(track))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/generic/provider.py", line 101, in destroy_instance cls._destroy_instance(destroy_parameters) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/provider.py", line 163, in _destroy_instance credentials.load(key_id) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 115, in load raise self.CredentialsError(f"Failed to load key pair: {str(e)}") modules.allocation.generic.credentials.Credentials.CredentialsError: Failed to load key pair: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'redhat-7-amd64-key-3192' does not exist . [2024-04-19 09:28:30] [ERROR] [65315] [ThreadPoolExecutor-2_11] [workflow_engine]: [allocate-agent-linux-redhat-9-amd64] Task failed with error: Error executing process task Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 106, in load if not key_pair.key_pair_id: File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 380, in property_loader self.load() File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 564, in do_action response = action(self, *args, **kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/action.py", line 88, in __call__ response = getattr(parent.meta.client, operation_name)(*args, **params) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 535, in _api_call return self._make_api_call(operation_name, kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 983, in _make_api_call raise error_class(parsed_response, operation_name) botocore.exceptions.ClientError: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'redhat-9-amd64-key-3233' does not exist During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 38, in main() File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 34, in main Allocator.run(InputPayload(**vars(parse_arguments()))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 38, in run return cls.__delete(payload) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 78, in __delete provider.destroy_instance(models.InstancePayload(**dict(track))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/generic/provider.py", line 101, in destroy_instance cls._destroy_instance(destroy_parameters) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/provider.py", line 163, in _destroy_instance credentials.load(key_id) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 115, in load raise self.CredentialsError(f"Failed to load key pair: {str(e)}") modules.allocation.generic.credentials.Credentials.CredentialsError: Failed to load key pair: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'redhat-9-amd64-key-3233' does not exist . [2024-04-19 09:28:30] [ERROR] [65315] [ThreadPoolExecutor-2_8] [workflow_engine]: [allocate-agent-linux-centos-8-amd64] Task failed with error: Error executing process task Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 106, in load if not key_pair.key_pair_id: File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 380, in property_loader self.load() File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/factory.py", line 564, in do_action response = action(self, *args, **kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/boto3/resources/action.py", line 88, in __call__ response = getattr(parent.meta.client, operation_name)(*args, **params) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 535, in _api_call return self._make_api_call(operation_name, kwargs) File "/home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/botocore/client.py", line 983, in _make_api_call raise error_class(parsed_response, operation_name) botocore.exceptions.ClientError: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'centos-8-amd64-key-3855' does not exist During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 38, in main() File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/main.py", line 34, in main Allocator.run(InputPayload(**vars(parse_arguments()))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 38, in run return cls.__delete(payload) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/allocation.py", line 78, in __delete provider.destroy_instance(models.InstancePayload(**dict(track))) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/generic/provider.py", line 101, in destroy_instance cls._destroy_instance(destroy_parameters) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/provider.py", line 163, in _destroy_instance credentials.load(key_id) File "/home/marcelo/wazuh/wazuh-qa/deployability/modules/allocation/aws/credentials.py", line 115, in load raise self.CredentialsError(f"Failed to load key pair: {str(e)}") modules.allocation.generic.credentials.Credentials.CredentialsError: Failed to load key pair: An error occurred (InvalidKeyPair.NotFound) when calling the DescribeKeyPairs operation: The key pair 'centos-8-amd64-key-3855' does not exist . [2024-04-19 09:28:30] [WARNING] [65315] [ThreadPoolExecutor-2_0] [workflow_engine]: [allocate-manager-linux-ubuntu-22.04-amd64] Skipping task due to dependency failure. (dtt-test) marcelo@marcelo-B460-AORUS-PRO-AC:~/wazuh/wazuh-qa/deployability$ nano dtt1-threads.yaml (dtt-test) marcelo@marcelo-B460-AORUS-PRO-AC:~/wazuh/wazuh-qa/deployability$ python -m workflow_engine dtt1-threads.yaml --log-level DEBUG --threads 12 [2024-04-19 09:29:04] [DEBUG] [65615] [MainThread] [workflow_engine]: Validating input file: dtt1-threads.yaml [2024-04-19 09:29:04] [DEBUG] [65615] [MainThread] [workflow_engine]: Loading schema file: /home/marcelo/.pyenv/versions/dtt-test/lib/python3.10/site-packages/workflow_engine/schemas/schema_v1.json [2024-04-19 09:29:04] [DEBUG] [65615] [MainThread] [workflow_engine]: Loading yaml file: dtt1-threads.yaml [2024-04-19 09:29:04] [DEBUG] [65615] [MainThread] [workflow_engine]: Loading workflow file: dtt1-threads.yaml [2024-04-19 09:29:04] [DEBUG] [65615] [MainThread] [workflow_engine]: Process workflow. [2024-04-19 09:29:04] [INFO] [65615] [MainThread] [workflow_engine]: Executing DAG tasks. [2024-04-19 09:29:04] [INFO] [65615] [MainThread] [workflow_engine]: Executing tasks in parallel. [2024-04-19 09:29:04] [INFO] [65615] [ThreadPoolExecutor-0_0] [workflow_engine]: [allocate-manager-linux-ubuntu-22.04-amd64] Starting task. [2024-04-19 09:29:04] [DEBUG] [65615] [ThreadPoolExecutor-0_0] [workflow_engine]: Running task "allocate-manager-linux-ubuntu-22.04-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=large', '--composite-name=linux-ubuntu-22.04-amd64', '--inventory-output=/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-19 09:29:26] [DEBUG] [65615] [ThreadPoolExecutor-0_0] [workflow_engine]: Finished task "allocate-manager-linux-ubuntu-22.04-amd64" execution with result: [2024-04-19 09:29:05] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-19 09:29:05] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-19 09:29:05] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-19 09:29:05] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-84577AF2-2F00-490F-AABB-816BDA9F92BD [2024-04-19 09:29:24] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-84577AF2-2F00-490F-AABB-816BDA9F92BD directory to /tmp/wazuh-qa/i-0de14d1fb21f4fe75 [2024-04-19 09:29:24] [INFO] ALLOCATOR: Instance i-0de14d1fb21f4fe75 created. [2024-04-19 09:29:26] [INFO] ALLOCATOR: Instance i-0de14d1fb21f4fe75 started. [2024-04-19 09:29:26] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml [2024-04-19 09:29:26] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/track.yaml [2024-04-19 09:29:26] [INFO] [65615] [ThreadPoolExecutor-0_0] [workflow_engine]: [allocate-manager-linux-ubuntu-22.04-amd64] Finished task in 22.05 seconds. [2024-04-19 09:29:26] [INFO] [65615] [ThreadPoolExecutor-0_0] [workflow_engine]: [provision-manager-linux-ubuntu-22.04-amd64] Starting task. [2024-04-19 09:29:26] [DEBUG] [65615] [ThreadPoolExecutor-0_0] [workflow_engine]: Running task "provision-manager-linux-ubuntu-22.04-amd64" with arguments: ['modules/provision/main.py', '--inventory=/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml', "--install={'component': 'wazuh-manager', 'type': 'assistant', 'version': '4.7.3', 'live': True}"] [2024-04-19 09:29:28] [DEBUG] [65615] [ThreadPoolExecutor-0_0] [workflow_engine]: Finished task "provision-manager-linux-ubuntu-22.04-amd64" execution with result: [2024-04-19 09:29:27] [DEBUG] PROVISIONER: Setting dependencies: {} for wazuh-manager component. [2024-04-19 09:29:27] [INFO] PROVISIONER: Initiating provisionment. [2024-04-19 09:29:27] [DEBUG] PROVISIONER: Running action install for components: [ComponentInfo(component='wazuh-manager', type='assistant', version='4.7.3', dependencies=None, live=True)] [2024-04-19 09:29:27] [INFO] PROVISIONER: Provisioning "wazuh-manager"... [2024-04-19 09:29:27] [DEBUG] PROVISIONER: Get OS family for ec2-44-223-69-111.compute-1.amazonaws.com. [2024-04-19 09:29:27] [DEBUG] PROVISIONER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:29:27] [DEBUG] PROVISIONER: Running playbook: {'hosts': 'ec2-44-223-69-111.compute-1.amazonaws.com', 'become': True, 'gather_facts': True, 'tasks': [{'name': 'Capture ansible_os_family', 'set_fact': {'ansible_os_family': "{{ ansible_facts['distribution_file_variety'] }}", 'cacheable': 'yes'}}]} No config file found; using defaults PLAY [ec2-44-223-69-111.compute-1.amazonaws.com] ******************************* TASK [Gathering Facts] ********************************************************* fatal: [ec2-44-223-69-111.compute-1.amazonaws.com]: UNREACHABLE! => changed=false msg: 'Failed to connect to the host via ssh: ssh: connect to host ec2-44-223-69-111.compute-1.amazonaws.com port 2200: Connection refused' unreachable: true PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:29:27] [DEBUG] PROVISIONER: Playbook {'hosts': 'ec2-44-223-69-111.compute-1.amazonaws.com', 'become': True, 'gather_facts': True, 'tasks': [{'name': 'Capture ansible_os_family', 'set_fact': {'ansible_os_family': "{{ ansible_facts['distribution_file_variety'] }}", 'cacheable': 'yes'}}]} finished with status {'skipped': {}, 'ok': {}, 'dark': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:29:27] [DEBUG] PROVISIONER: OS family: None. [2024-04-19 09:29:27] [DEBUG] PROVISIONER: Render playbook with vars: {'component': 'wazuh-manager', 'version': '4.7.3', 'live': True, 'type': 'assistant', 'dependencies': None, 'templates_path': '/home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/playbooks/wazuh/assistant/install', 'templates_order': ['download.j2', 'install.j2'], 'ansible_os_family': ''}. [2024-04-19 09:29:27] [DEBUG] PROVISIONER: Templates found: ['download.j2', 'install.j2'] [2024-04-19 09:29:27] [DEBUG] PROVISIONER: Rendering template download.j2 [2024-04-19 09:29:27] [DEBUG] PROVISIONER: Rendering template install.j2 [2024-04-19 09:29:27] [DEBUG] PROVISIONER: [{'name': 'Install the required packages', 'shell': ''}, {'name': 'Download the Wazuh installation assistant', 'shell': 'curl -sO https://packages.wazuh.com/4.7/wazuh-install.sh'}, {'name': 'Install wazuh-manager with assistant', 'shell': 'bash ./wazuh-install.sh -a -i'}] [2024-04-19 09:29:27] [DEBUG] PROVISIONER: Tasks to execute: [{'name': 'Install the required packages', 'shell': ''}, {'name': 'Download the Wazuh installation assistant', 'shell': 'curl -sO https://packages.wazuh.com/4.7/wazuh-install.sh'}, {'name': 'Install wazuh-manager with assistant', 'shell': 'bash ./wazuh-install.sh -a -i'}]. [2024-04-19 09:29:27] [INFO] PROVISIONER: Execute install for wazuh-manager. [2024-04-19 09:29:27] [DEBUG] PROVISIONER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:29:27] [DEBUG] PROVISIONER: Running playbook: {'hosts': 'ec2-44-223-69-111.compute-1.amazonaws.com', 'become': True, 'gather_facts': True, 'tasks': [{'name': 'Install the required packages', 'shell': ''}, {'name': 'Download the Wazuh installation assistant', 'shell': 'curl -sO https://packages.wazuh.com/4.7/wazuh-install.sh'}, {'name': 'Install wazuh-manager with assistant', 'shell': 'bash ./wazuh-install.sh -a -i'}]} No config file found; using defaults PLAY [ec2-44-223-69-111.compute-1.amazonaws.com] ******************************* TASK [Gathering Facts] ********************************************************* fatal: [ec2-44-223-69-111.compute-1.amazonaws.com]: UNREACHABLE! => changed=false msg: 'Failed to connect to the host via ssh: ssh: connect to host ec2-44-223-69-111.compute-1.amazonaws.com port 2200: Connection refused' unreachable: true PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:29:28] [DEBUG] PROVISIONER: Playbook {'hosts': 'ec2-44-223-69-111.compute-1.amazonaws.com', 'become': True, 'gather_facts': True, 'tasks': [{'name': 'Install the required packages', 'shell': ''}, {'name': 'Download the Wazuh installation assistant', 'shell': 'curl -sO https://packages.wazuh.com/4.7/wazuh-install.sh'}, {'name': 'Install wazuh-manager with assistant', 'shell': 'bash ./wazuh-install.sh -a -i'}]} finished with status {'skipped': {}, 'ok': {}, 'dark': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:29:28] [INFO] PROVISIONER: Provision of "wazuh-manager" complete successfully. [2024-04-19 09:29:28] [INFO] PROVISIONER: All components provisioned successfully. [2024-04-19 09:29:28] [DEBUG] PROVISIONER: Provision summary: {'skipped': {}, 'ok': {}, 'dark': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:29:28] [INFO] [65615] [ThreadPoolExecutor-0_0] [workflow_engine]: [provision-manager-linux-ubuntu-22.04-amd64] Finished task in 1.69 seconds. [2024-04-19 09:29:28] [INFO] [65615] [ThreadPoolExecutor-0_0] [workflow_engine]: [allocate-agent-linux-ubuntu-18.04-amd64] Starting task. [2024-04-19 09:29:28] [DEBUG] [65615] [ThreadPoolExecutor-0_0] [workflow_engine]: Running task "allocate-agent-linux-ubuntu-18.04-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-ubuntu-18.04-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-19 09:29:28] [INFO] [65615] [ThreadPoolExecutor-0_1] [workflow_engine]: [allocate-agent-linux-ubuntu-20.04-amd64] Starting task. [2024-04-19 09:29:28] [DEBUG] [65615] [ThreadPoolExecutor-0_1] [workflow_engine]: Running task "allocate-agent-linux-ubuntu-20.04-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-ubuntu-20.04-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-19 09:29:28] [INFO] [65615] [ThreadPoolExecutor-0_2] [workflow_engine]: [allocate-agent-linux-ubuntu-22.04-amd64] Starting task. [2024-04-19 09:29:28] [INFO] [65615] [ThreadPoolExecutor-0_3] [workflow_engine]: [allocate-agent-linux-debian-10-amd64] Starting task. [2024-04-19 09:29:28] [DEBUG] [65615] [ThreadPoolExecutor-0_2] [workflow_engine]: Running task "allocate-agent-linux-ubuntu-22.04-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-ubuntu-22.04-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-19 09:29:28] [DEBUG] [65615] [ThreadPoolExecutor-0_3] [workflow_engine]: Running task "allocate-agent-linux-debian-10-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-debian-10-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-debian-10-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-19 09:29:28] [INFO] [65615] [ThreadPoolExecutor-0_4] [workflow_engine]: [allocate-agent-linux-debian-11-amd64] Starting task. [2024-04-19 09:29:28] [INFO] [65615] [ThreadPoolExecutor-0_5] [workflow_engine]: [allocate-agent-linux-debian-12-amd64] Starting task. [2024-04-19 09:29:28] [INFO] [65615] [ThreadPoolExecutor-0_6] [workflow_engine]: [allocate-agent-linux-oracle-9-amd64] Starting task. [2024-04-19 09:29:28] [DEBUG] [65615] [ThreadPoolExecutor-0_4] [workflow_engine]: Running task "allocate-agent-linux-debian-11-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-debian-11-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-debian-11-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-19 09:29:28] [INFO] [65615] [ThreadPoolExecutor-0_7] [workflow_engine]: [allocate-agent-linux-centos-7-amd64] Starting task. [2024-04-19 09:29:28] [DEBUG] [65615] [ThreadPoolExecutor-0_5] [workflow_engine]: Running task "allocate-agent-linux-debian-12-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-debian-12-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-debian-12-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-19 09:29:28] [INFO] [65615] [ThreadPoolExecutor-0_8] [workflow_engine]: [allocate-agent-linux-centos-8-amd64] Starting task. [2024-04-19 09:29:28] [DEBUG] [65615] [ThreadPoolExecutor-0_6] [workflow_engine]: Running task "allocate-agent-linux-oracle-9-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-oracle-9-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-oracle-9-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-19 09:29:28] [INFO] [65615] [ThreadPoolExecutor-0_9] [workflow_engine]: [allocate-agent-linux-redhat-7-amd64] Starting task. [2024-04-19 09:29:28] [DEBUG] [65615] [ThreadPoolExecutor-0_7] [workflow_engine]: Running task "allocate-agent-linux-centos-7-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-centos-7-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-centos-7-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-19 09:29:28] [INFO] [65615] [ThreadPoolExecutor-0_10] [workflow_engine]: [allocate-agent-linux-redhat-8-amd64] Starting task. [2024-04-19 09:29:28] [INFO] [65615] [ThreadPoolExecutor-0_11] [workflow_engine]: [allocate-agent-linux-redhat-9-amd64] Starting task. [2024-04-19 09:29:28] [DEBUG] [65615] [ThreadPoolExecutor-0_8] [workflow_engine]: Running task "allocate-agent-linux-centos-8-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-centos-8-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-centos-8-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-19 09:29:28] [DEBUG] [65615] [ThreadPoolExecutor-0_9] [workflow_engine]: Running task "allocate-agent-linux-redhat-7-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-redhat-7-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-redhat-7-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-19 09:29:28] [DEBUG] [65615] [ThreadPoolExecutor-0_10] [workflow_engine]: Running task "allocate-agent-linux-redhat-8-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-redhat-8-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-redhat-8-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-19 09:29:28] [DEBUG] [65615] [ThreadPoolExecutor-0_11] [workflow_engine]: Running task "allocate-agent-linux-redhat-9-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-redhat-9-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-redhat-9-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-19 09:29:50] [DEBUG] [65615] [ThreadPoolExecutor-0_2] [workflow_engine]: Finished task "allocate-agent-linux-ubuntu-22.04-amd64" execution with result: [2024-04-19 09:29:28] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-C1534D9E-D2B4-40CB-A549-319BC0E94894 [2024-04-19 09:29:48] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-C1534D9E-D2B4-40CB-A549-319BC0E94894 directory to /tmp/wazuh-qa/i-0788b645be4a7bbdd [2024-04-19 09:29:48] [INFO] ALLOCATOR: Instance i-0788b645be4a7bbdd created. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Instance i-0788b645be4a7bbdd started. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml [2024-04-19 09:29:50] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/track.yaml [2024-04-19 09:29:50] [INFO] [65615] [ThreadPoolExecutor-0_2] [workflow_engine]: [allocate-agent-linux-ubuntu-22.04-amd64] Finished task in 21.76 seconds. [2024-04-19 09:29:50] [INFO] [65615] [ThreadPoolExecutor-0_2] [workflow_engine]: [allocate-agent-linux-amazon-2-amd64] Starting task. [2024-04-19 09:29:50] [DEBUG] [65615] [ThreadPoolExecutor-0_2] [workflow_engine]: Running task "allocate-agent-linux-amazon-2-amd64" with arguments: ['modules/allocation/main.py', '--action=create', '--provider=aws', '--size=small', '--composite-name=linux-amazon-2-amd64', '--inventory-output=/tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml', '--track-output=/tmp/dtt1-poc/agent-linux-amazon-2-amd64/track.yaml', '--label-termination-date=1d', '--label-team=qa'] [2024-04-19 09:29:50] [DEBUG] [65615] [ThreadPoolExecutor-0_4] [workflow_engine]: Finished task "allocate-agent-linux-debian-11-amd64" execution with result: [2024-04-19 09:29:28] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-3E537960-CFBC-4887-8384-37C8A440D252 [2024-04-19 09:29:48] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-3E537960-CFBC-4887-8384-37C8A440D252 directory to /tmp/wazuh-qa/i-0144986ae8ca905e2 [2024-04-19 09:29:48] [INFO] ALLOCATOR: Instance i-0144986ae8ca905e2 created. [2024-04-19 09:29:49] [INFO] ALLOCATOR: Instance i-0144986ae8ca905e2 started. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml [2024-04-19 09:29:50] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-debian-11-amd64/track.yaml [2024-04-19 09:29:50] [INFO] [65615] [ThreadPoolExecutor-0_4] [workflow_engine]: [allocate-agent-linux-debian-11-amd64] Finished task in 21.80 seconds. [2024-04-19 09:29:50] [INFO] [65615] [ThreadPoolExecutor-0_4] [workflow_engine]: [wait-provision-manager-linux-ubuntu-22.04-amd64] Starting task. [2024-04-19 09:29:50] [DEBUG] [65615] [ThreadPoolExecutor-0_4] [workflow_engine]: Running task "wait-provision-manager-linux-ubuntu-22.04-amd64" with arguments: ['300'] [2024-04-19 09:29:50] [DEBUG] [65615] [ThreadPoolExecutor-0_1] [workflow_engine]: Finished task "allocate-agent-linux-ubuntu-20.04-amd64" execution with result: [2024-04-19 09:29:28] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-33B86BAA-1707-4C9A-A26F-68A8BA3EE83B [2024-04-19 09:29:48] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-33B86BAA-1707-4C9A-A26F-68A8BA3EE83B directory to /tmp/wazuh-qa/i-0bf8a3758db255e40 [2024-04-19 09:29:48] [INFO] ALLOCATOR: Instance i-0bf8a3758db255e40 created. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Instance i-0bf8a3758db255e40 started. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml [2024-04-19 09:29:50] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/track.yaml [2024-04-19 09:29:50] [INFO] [65615] [ThreadPoolExecutor-0_1] [workflow_engine]: [allocate-agent-linux-ubuntu-20.04-amd64] Finished task in 21.84 seconds. [2024-04-19 09:29:50] [DEBUG] [65615] [ThreadPoolExecutor-0_10] [workflow_engine]: Finished task "allocate-agent-linux-redhat-8-amd64" execution with result: [2024-04-19 09:29:29] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-CEEC538F-A6D2-49EF-837C-AC2AB23F6DA2 [2024-04-19 09:29:48] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-CEEC538F-A6D2-49EF-837C-AC2AB23F6DA2 directory to /tmp/wazuh-qa/i-030faebf912a54cca [2024-04-19 09:29:48] [INFO] ALLOCATOR: Instance i-030faebf912a54cca created. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Instance i-030faebf912a54cca started. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml [2024-04-19 09:29:50] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-redhat-8-amd64/track.yaml [2024-04-19 09:29:50] [INFO] [65615] [ThreadPoolExecutor-0_10] [workflow_engine]: [allocate-agent-linux-redhat-8-amd64] Finished task in 21.81 seconds. [2024-04-19 09:29:50] [DEBUG] [65615] [ThreadPoolExecutor-0_5] [workflow_engine]: Finished task "allocate-agent-linux-debian-12-amd64" execution with result: [2024-04-19 09:29:28] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-19 09:29:28] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-19 09:29:28] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-19 09:29:28] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-620AF696-C848-48F7-A762-FC7DDCD4B701 [2024-04-19 09:29:48] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-620AF696-C848-48F7-A762-FC7DDCD4B701 directory to /tmp/wazuh-qa/i-0959f910e2ee00979 [2024-04-19 09:29:48] [INFO] ALLOCATOR: Instance i-0959f910e2ee00979 created. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Instance i-0959f910e2ee00979 started. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml [2024-04-19 09:29:50] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-debian-12-amd64/track.yaml [2024-04-19 09:29:50] [INFO] [65615] [ThreadPoolExecutor-0_5] [workflow_engine]: [allocate-agent-linux-debian-12-amd64] Finished task in 21.93 seconds. [2024-04-19 09:29:50] [DEBUG] [65615] [ThreadPoolExecutor-0_3] [workflow_engine]: Finished task "allocate-agent-linux-debian-10-amd64" execution with result: [2024-04-19 09:29:28] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-19 09:29:28] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-19 09:29:28] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-19 09:29:28] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-0B2DAEB9-888F-48FC-B0C8-CBF33FE1BE12 [2024-04-19 09:29:48] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-0B2DAEB9-888F-48FC-B0C8-CBF33FE1BE12 directory to /tmp/wazuh-qa/i-0f8940c82765909a1 [2024-04-19 09:29:48] [INFO] ALLOCATOR: Instance i-0f8940c82765909a1 created. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Instance i-0f8940c82765909a1 started. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml [2024-04-19 09:29:50] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-debian-10-amd64/track.yaml [2024-04-19 09:29:50] [INFO] [65615] [ThreadPoolExecutor-0_3] [workflow_engine]: [allocate-agent-linux-debian-10-amd64] Finished task in 21.97 seconds. [2024-04-19 09:29:50] [DEBUG] [65615] [ThreadPoolExecutor-0_7] [workflow_engine]: Finished task "allocate-agent-linux-centos-7-amd64" execution with result: [2024-04-19 09:29:29] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-8354EA4D-F2D0-4153-83E9-A54531ABE450 [2024-04-19 09:29:48] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-8354EA4D-F2D0-4153-83E9-A54531ABE450 directory to /tmp/wazuh-qa/i-0f785648cab9fa84d [2024-04-19 09:29:48] [INFO] ALLOCATOR: Instance i-0f785648cab9fa84d created. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Instance i-0f785648cab9fa84d started. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml [2024-04-19 09:29:50] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-centos-7-amd64/track.yaml [2024-04-19 09:29:50] [INFO] [65615] [ThreadPoolExecutor-0_7] [workflow_engine]: [allocate-agent-linux-centos-7-amd64] Finished task in 21.99 seconds. [2024-04-19 09:29:50] [DEBUG] [65615] [ThreadPoolExecutor-0_9] [workflow_engine]: Finished task "allocate-agent-linux-redhat-7-amd64" execution with result: [2024-04-19 09:29:29] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-47075F44-75AB-40F5-9CCA-B63332B0CA61 [2024-04-19 09:29:48] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-47075F44-75AB-40F5-9CCA-B63332B0CA61 directory to /tmp/wazuh-qa/i-0b638dddb92e18289 [2024-04-19 09:29:48] [INFO] ALLOCATOR: Instance i-0b638dddb92e18289 created. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Instance i-0b638dddb92e18289 started. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml [2024-04-19 09:29:50] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-redhat-7-amd64/track.yaml [2024-04-19 09:29:50] [INFO] [65615] [ThreadPoolExecutor-0_9] [workflow_engine]: [allocate-agent-linux-redhat-7-amd64] Finished task in 22.00 seconds. [2024-04-19 09:29:50] [DEBUG] [65615] [ThreadPoolExecutor-0_0] [workflow_engine]: Finished task "allocate-agent-linux-ubuntu-18.04-amd64" execution with result: [2024-04-19 09:29:28] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-BFE6A9E9-6C89-4E2F-A286-4BBBAF77074B [2024-04-19 09:29:48] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-BFE6A9E9-6C89-4E2F-A286-4BBBAF77074B directory to /tmp/wazuh-qa/i-09e1903663f8706a7 [2024-04-19 09:29:48] [INFO] ALLOCATOR: Instance i-09e1903663f8706a7 created. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Instance i-09e1903663f8706a7 started. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml [2024-04-19 09:29:50] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/track.yaml [2024-04-19 09:29:50] [INFO] [65615] [ThreadPoolExecutor-0_0] [workflow_engine]: [allocate-agent-linux-ubuntu-18.04-amd64] Finished task in 22.14 seconds. [2024-04-19 09:29:50] [DEBUG] [65615] [ThreadPoolExecutor-0_11] [workflow_engine]: Finished task "allocate-agent-linux-redhat-9-amd64" execution with result: [2024-04-19 09:29:29] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-4293048E-D962-44FC-8F4A-A9D02A8F92CB [2024-04-19 09:29:48] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-4293048E-D962-44FC-8F4A-A9D02A8F92CB directory to /tmp/wazuh-qa/i-085a5f30afea3e7a3 [2024-04-19 09:29:48] [INFO] ALLOCATOR: Instance i-085a5f30afea3e7a3 created. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Instance i-085a5f30afea3e7a3 started. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml [2024-04-19 09:29:50] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-redhat-9-amd64/track.yaml [2024-04-19 09:29:50] [INFO] [65615] [ThreadPoolExecutor-0_11] [workflow_engine]: [allocate-agent-linux-redhat-9-amd64] Finished task in 22.12 seconds. [2024-04-19 09:29:50] [DEBUG] [65615] [ThreadPoolExecutor-0_8] [workflow_engine]: Finished task "allocate-agent-linux-centos-8-amd64" execution with result: [2024-04-19 09:29:29] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-19 09:29:29] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-49195FBE-CAE5-4B7C-B82E-CA26CACF6973 [2024-04-19 09:29:48] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-49195FBE-CAE5-4B7C-B82E-CA26CACF6973 directory to /tmp/wazuh-qa/i-08244012cd8a3d82d [2024-04-19 09:29:48] [INFO] ALLOCATOR: Instance i-08244012cd8a3d82d created. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Instance i-08244012cd8a3d82d started. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml [2024-04-19 09:29:50] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-centos-8-amd64/track.yaml [2024-04-19 09:29:50] [INFO] [65615] [ThreadPoolExecutor-0_8] [workflow_engine]: [allocate-agent-linux-centos-8-amd64] Finished task in 22.20 seconds. [2024-04-19 09:29:51] [DEBUG] [65615] [ThreadPoolExecutor-0_6] [workflow_engine]: Finished task "allocate-agent-linux-oracle-9-amd64" execution with result: [2024-04-19 09:29:28] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-19 09:29:28] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-19 09:29:28] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-19 09:29:28] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-9E023A39-D345-4EE6-ADE8-79507FC7CEF3 [2024-04-19 09:29:49] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-9E023A39-D345-4EE6-ADE8-79507FC7CEF3 directory to /tmp/wazuh-qa/i-02c9cafb176f8b496 [2024-04-19 09:29:49] [INFO] ALLOCATOR: Instance i-02c9cafb176f8b496 created. [2024-04-19 09:29:50] [INFO] ALLOCATOR: Instance i-02c9cafb176f8b496 started. [2024-04-19 09:29:51] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml [2024-04-19 09:29:51] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-oracle-9-amd64/track.yaml [2024-04-19 09:29:51] [INFO] [65615] [ThreadPoolExecutor-0_6] [workflow_engine]: [allocate-agent-linux-oracle-9-amd64] Finished task in 22.80 seconds. [2024-04-19 09:30:13] [DEBUG] [65615] [ThreadPoolExecutor-0_2] [workflow_engine]: Finished task "allocate-agent-linux-amazon-2-amd64" execution with result: [2024-04-19 09:29:50] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa [2024-04-19 09:29:50] [DEBUG] ALLOCATOR: No config provided. Generating from payload [2024-04-19 09:29:50] [DEBUG] ALLOCATOR: Generating new key pair [2024-04-19 09:29:50] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-57B9CE78-FEC5-496E-AAC4-AACCD84E3FC9 [2024-04-19 09:30:11] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-57B9CE78-FEC5-496E-AAC4-AACCD84E3FC9 directory to /tmp/wazuh-qa/i-0adb50dba247267ce [2024-04-19 09:30:11] [INFO] ALLOCATOR: Instance i-0adb50dba247267ce created. [2024-04-19 09:30:12] [INFO] ALLOCATOR: Instance i-0adb50dba247267ce started. [2024-04-19 09:30:13] [INFO] ALLOCATOR: Inventory file generated at /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml [2024-04-19 09:30:13] [INFO] ALLOCATOR: Track file generated at /tmp/dtt1-poc/agent-linux-amazon-2-amd64/track.yaml [2024-04-19 09:30:13] [INFO] [65615] [ThreadPoolExecutor-0_2] [workflow_engine]: [allocate-agent-linux-amazon-2-amd64] Finished task in 22.82 seconds. [2024-04-19 09:34:50] [DEBUG] [65615] [ThreadPoolExecutor-0_4] [workflow_engine]: Finished task "wait-provision-manager-linux-ubuntu-22.04-amd64" execution with result: [2024-04-19 09:34:50] [INFO] [65615] [ThreadPoolExecutor-0_4] [workflow_engine]: [wait-provision-manager-linux-ubuntu-22.04-amd64] Finished task in 300.03 seconds. [2024-04-19 09:34:50] [INFO] [65615] [ThreadPoolExecutor-0_1] [workflow_engine]: [run-agent-linux-ubuntu-18.04-amd64-tests] Starting task. [2024-04-19 09:34:50] [INFO] [65615] [ThreadPoolExecutor-0_10] [workflow_engine]: [run-agent-linux-ubuntu-20.04-amd64-tests] Starting task. [2024-04-19 09:34:50] [DEBUG] [65615] [ThreadPoolExecutor-0_1] [workflow_engine]: Running task "run-agent-linux-ubuntu-18.04-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-19 09:34:50] [INFO] [65615] [ThreadPoolExecutor-0_5] [workflow_engine]: [run-agent-linux-ubuntu-22.04-amd64-tests] Starting task. [2024-04-19 09:34:50] [DEBUG] [65615] [ThreadPoolExecutor-0_10] [workflow_engine]: Running task "run-agent-linux-ubuntu-20.04-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-19 09:34:50] [INFO] [65615] [ThreadPoolExecutor-0_3] [workflow_engine]: [run-agent-linux-debian-10-amd64-tests] Starting task. [2024-04-19 09:34:50] [INFO] [65615] [ThreadPoolExecutor-0_7] [workflow_engine]: [run-agent-linux-debian-11-amd64-tests] Starting task. [2024-04-19 09:34:50] [DEBUG] [65615] [ThreadPoolExecutor-0_5] [workflow_engine]: Running task "run-agent-linux-ubuntu-22.04-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-19 09:34:50] [INFO] [65615] [ThreadPoolExecutor-0_9] [workflow_engine]: [run-agent-linux-debian-12-amd64-tests] Starting task. [2024-04-19 09:34:50] [INFO] [65615] [ThreadPoolExecutor-0_0] [workflow_engine]: [run-agent-linux-oracle-9-amd64-tests] Starting task. [2024-04-19 09:34:50] [INFO] [65615] [ThreadPoolExecutor-0_11] [workflow_engine]: [run-agent-linux-centos-7-amd64-tests] Starting task. [2024-04-19 09:34:50] [INFO] [65615] [ThreadPoolExecutor-0_8] [workflow_engine]: [run-agent-linux-centos-8-amd64-tests] Starting task. [2024-04-19 09:34:50] [DEBUG] [65615] [ThreadPoolExecutor-0_3] [workflow_engine]: Running task "run-agent-linux-debian-10-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-19 09:34:50] [INFO] [65615] [ThreadPoolExecutor-0_6] [workflow_engine]: [run-agent-linux-redhat-7-amd64-tests] Starting task. [2024-04-19 09:34:50] [INFO] [65615] [ThreadPoolExecutor-0_2] [workflow_engine]: [run-agent-linux-redhat-8-amd64-tests] Starting task. [2024-04-19 09:34:50] [DEBUG] [65615] [ThreadPoolExecutor-0_7] [workflow_engine]: Running task "run-agent-linux-debian-11-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-19 09:34:50] [INFO] [65615] [ThreadPoolExecutor-0_4] [workflow_engine]: [run-agent-linux-redhat-9-amd64-tests] Starting task. [2024-04-19 09:34:50] [DEBUG] [65615] [ThreadPoolExecutor-0_9] [workflow_engine]: Running task "run-agent-linux-debian-12-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-19 09:34:50] [DEBUG] [65615] [ThreadPoolExecutor-0_0] [workflow_engine]: Running task "run-agent-linux-oracle-9-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-19 09:34:50] [DEBUG] [65615] [ThreadPoolExecutor-0_11] [workflow_engine]: Running task "run-agent-linux-centos-7-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-19 09:34:50] [DEBUG] [65615] [ThreadPoolExecutor-0_8] [workflow_engine]: Running task "run-agent-linux-centos-8-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-19 09:34:50] [DEBUG] [65615] [ThreadPoolExecutor-0_6] [workflow_engine]: Running task "run-agent-linux-redhat-7-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-19 09:34:50] [DEBUG] [65615] [ThreadPoolExecutor-0_2] [workflow_engine]: Running task "run-agent-linux-redhat-8-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-19 09:34:50] [DEBUG] [65615] [ThreadPoolExecutor-0_4] [workflow_engine]: Running task "run-agent-linux-redhat-9-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-19 09:37:28] [DEBUG] [65615] [ThreadPoolExecutor-0_11] [workflow_engine]: Finished task "run-agent-linux-centos-7-amd64-tests" execution with result: [2024-04-19 09:34:51] [INFO] TESTER: Running tests for ec2-44-223-69-111.compute-1.amazonaws.com [2024-04-19 09:34:51] [INFO] TESTER: Running tests for ec2-54-224-32-139.compute-1.amazonaws.com [2024-04-19 09:34:51] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-54-224-32-139.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-19 09:34:51] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-19 09:34:51] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:51] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-54-224-32-139.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-44-223-69-111.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.005905' end: '2024-04-19 09:34:53.105766' item: ec2-44-223-69-111.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:53.099861' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-54-224-32-139.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.006002' end: '2024-04-19 09:34:53.292435' item: ec2-54-224-32-139.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:53.286433' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:34:53] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-54-224-32-139.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:34:53] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:34:53] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:53] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:59.199491' end: '2024-04-19 09:35:54.958314' msg: non-zero return code rc: 1 start: '2024-04-19 09:34:55.758823' stderr: |- Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-19 09:34:56] [INFO] TESTER: Checking connection to centos-7[0m [32m[2024-04-19 09:34:58] [INFO] TESTER: Connection established successfully in centos-7[0m [32m[2024-04-19 09:35:00] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-19 09:35:01] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-19 09:35:03] [INFO] TESTER: No Firewall to disable on centos-7[0m [32m[2024-04-19 09:35:07] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-19 09:35:37] [INFO] TESTER: Installing Manager in ubuntu-22.04[0m [31m[2024-04-19 09:35:48] [ERROR] TESTER: The /var/ossec is not present in ubuntu-22.04[0m FAILED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-19 09:35:48] [INFO] TESTER: Getting status of centos-7[0m [31m[2024-04-19 09:35:50] [ERROR] TESTER: The centos-7 status is not loaded[0m FAILED modules/testing/tests/test_agent/test_install.py::test_version [31m[2024-04-19 09:35:52] [ERROR] TESTER: The version centos-7 is not 4.7.3 by command[0m FAILED modules/testing/tests/test_agent/test_install.py::test_revision [31m[2024-04-19 09:35:54] [ERROR] TESTER: The revision centos-7 is not 40714 by command[0m FAILED =================================== FAILURES =================================== ______________________________ test_installation _______________________________ wazuh_params = {'agents': {'agent-linux-centos-7-amd64': '/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_installation(wazuh_params): # Checking connection for manager_name, manager_params in wazuh_params['managers'].items(): Utils.check_inventory_connection(manager_params) # Certs creation, firewall management and Manager installation for agent_name, agent_params in wazuh_params['agents'].items(): HostConfiguration.disable_firewall(agent_params) if HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT): logger.info(f'Manager is already installed in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') else: HostConfiguration.disable_firewall(manager_params) HostConfiguration.certs_create(wazuh_params['wazuh_version'], wazuh_params['master'], wazuh_params['dashboard'], wazuh_params['indexers'], wazuh_params['workers']) WazuhManager.install_manager(wazuh_params['master'], 'wazuh-1', wazuh_params['wazuh_version']) > assert HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml', PosixPath('/var/ossec')) E + where = HostInformation.dir_exists modules/testing/tests/test_agent/test_install.py:81: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-centos-7-amd64': '/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): agent_status = GeneralComponentActions.get_component_status(agent, 'wazuh-agent') > assert 'loaded' in agent_status, logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} status is not loaded') E AssertionError: None E assert 'loaded' in '' modules/testing/tests/test_agent/test_install.py:95: AssertionError _________________________________ test_version _________________________________ wazuh_params = {'agents': {'agent-linux-centos-7-amd64': '/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_version(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_version'] in GeneralComponentActions.get_component_version(agent_params), logger.error(f"The version {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_version']} by command") E AssertionError: None E assert '4.7.3' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_version modules/testing/tests/test_agent/test_install.py:100: AssertionError ________________________________ test_revision _________________________________ wazuh_params = {'agents': {'agent-linux-centos-7-amd64': '/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_revision(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_revision'] in GeneralComponentActions.get_component_revision(agent_params), logger.error(f"The revision {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_revision']} by command") E AssertionError: None E assert '40714' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_revision modules/testing/tests/test_agent/test_install.py:105: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_install.py::test_installation - ... FAILED modules/testing/tests/test_agent/test_install.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_install.py::test_version - Asser... FAILED modules/testing/tests/test_agent/test_install.py::test_revision - Asse... ======================== 4 failed, 2 warnings in 58.49s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:35:55] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:35:55] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:35:55] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:35:55] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:25.348534' end: '2024-04-19 09:36:21.663416' msg: non-zero return code rc: 1 start: '2024-04-19 09:35:56.314882' stderr: |- Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sed: can't read /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit not found. Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. cat: /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-19 09:35:56] [INFO] TESTER: Checking connection to centos-7[0m [32m[2024-04-19 09:35:58] [INFO] TESTER: Connection established successfully in centos-7[0m [31m[2024-04-19 09:36:07] [ERROR] TESTER: Error configuring the Manager IP (172.31.18.156)in: centos-7 agent[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-19 09:36:07] [INFO] TESTER: Getting status of centos-7[0m [31m[2024-04-19 09:36:09] [ERROR] TESTER: The centos-7 is not active[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys [31m[2024-04-19 09:36:21] [ERROR] TESTER: agent-linux-centos-7-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== ______________________________ test_registration _______________________________ wazuh_params = {'agents': {'agent-linux-centos-7-amd64': '/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_registration(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > WazuhAgent.register_agent(agent_params, wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:67: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ inventory_path = '/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml' manager_path = {'ansible_connection': 'ssh', 'ansible_host': 'ec2-44-223-69-111.compute-1.amazonaws.com', 'ansible_port': 2200, 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322', ...} @staticmethod def register_agent(inventory_path, manager_path): with open(manager_path, 'r') as yaml_file: manager_path = yaml.safe_load(yaml_file) host = manager_path.get('ansible_host') internal_ip = HostInformation.get_internal_ip_from_aws_dns(host) if 'amazonaws' in host else host commands = [ f"sed -i 's/
MANAGER_IP<\/address>/
{internal_ip}<\/address>/g' {WAZUH_CONF}", "systemctl restart wazuh-agent" ] Executor.execute_commands(inventory_path, commands) > assert internal_ip in Executor.execute_command(inventory_path, f'cat {WAZUH_CONF}'), logger.error(f'Error configuring the Manager IP ({internal_ip})in: {HostInformation.get_os_name_and_version_from_inventory(inventory_path)} agent') E AssertionError: None modules/testing/tests/helpers/agent.py:106: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-centos-7-amd64': '/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): > assert 'active' in GeneralComponentActions.get_component_status(agent, 'wazuh-agent'), logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} is not active') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_registration.py:72: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-centos-7-amd64': '/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' E AssertionError: The agent-linux-centos-7-amd64 is not present in the master by command E assert 'agent-linux-centos-7-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_registration.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-centos-7-amd64': '/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-centos-7-amd64': '/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_registration.py:93: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_registration FAILED modules/testing/tests/test_agent/test_registration.py::test_status - A... FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys ======================== 5 failed, 2 warnings in 24.91s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:21] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:21] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:21] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:21] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:14.124745' end: '2024-04-19 09:36:37.156307' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:23.031562' stderr: |- Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit not found. Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-19 09:36:23] [INFO] TESTER: Checking connection to centos-7[0m [32m[2024-04-19 09:36:24] [INFO] TESTER: Connection established successfully in centos-7[0m [32m[2024-04-19 09:36:26] [INFO] TESTER: Restarting wazuh-agent in centos-7[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-19 09:36:28] [INFO] TESTER: Getting status of centos-7[0m [31m[2024-04-19 09:36:31] [ERROR] TESTER: agent-linux-centos-7-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_connection [31m[2024-04-19 09:36:32] [ERROR] TESTER: agent-linux-centos-7-amd64 is not present in agent_control information[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive [31m[2024-04-19 09:36:35] [ERROR] TESTER: agent-linux-centos-7-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys [31m[2024-04-19 09:36:37] [ERROR] TESTER: agent-linux-centos-7-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-centos-7-amd64': '/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert 'active' in GeneralComponentActions.get_component_status(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_restart.py:71: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-centos-7-amd64': '/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is not present in agent_control information') E AssertionError: None E assert 'agent-linux-centos-7-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_restart.py:76: AssertionError ________________________________ test_isActive _________________________________ wazuh_params = {'agents': {'agent-linux-centos-7-amd64': '/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_restart.py:81: AssertionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-centos-7-amd64': '/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_restart.py:86: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_restart.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_restart.py::test_connection - As... FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive - Asse... FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys - As... =================== 4 failed, 1 passed, 2 warnings in 13.73s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:37] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:37] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:37] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:37] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:11.714175' end: '2024-04-19 09:36:50.257856' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:38.543681' stderr: |- Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit not found. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-19 09:36:38] [INFO] TESTER: Checking connection to centos-7[0m [32m[2024-04-19 09:36:40] [INFO] TESTER: Connection established successfully in centos-7[0m FAILED[32m[2024-04-19 09:36:48] [INFO] TESTER: Restarting wazuh-agent in centos-7[0m =================================== FAILURES =================================== __________________________________ test_stop ___________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-centos-7-amd64': '/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_stop(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_stop.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_stop.py::test_stop - requests.ex... ======================== 1 failed, 2 warnings in 11.31s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:50] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:50] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:50] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:50] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:13.904496' end: '2024-04-19 09:37:05.571265' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:51.666769' stderr: |- Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-224-32-139.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-19 09:36:52] [INFO] TESTER: Checking connection to centos-7[0m [32m[2024-04-19 09:36:53] [INFO] TESTER: Connection established successfully in centos-7[0m [31m[2024-04-19 09:36:57] [ERROR] TESTER: agent-linux-centos-7-amd64 is not Active before the installation[0m FAILED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive FAILED =================================== FAILURES =================================== ________________________________ test_uninstall ________________________________ wazuh_params = {'agents': {'agent-linux-centos-7-amd64': '/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_uninstall(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not Active before the installation') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_uninstall.py:68: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-centos-7-amd64': '/tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_uninstall.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_uninstall.py::test_uninstall - A... FAILED modules/testing/tests/test_agent/test_uninstall.py::test_isActive - re... =================== 2 failed, 1 passed, 2 warnings in 13.51s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:05] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:05] [INFO] TESTER: Cleaning up [2024-04-19 09:37:05] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:05] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:17] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:37:17] [INFO] TESTER: Cleaning up [2024-04-19 09:37:17] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:17] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:27] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:37:28] [INFO] [65615] [ThreadPoolExecutor-0_11] [workflow_engine]: [run-agent-linux-centos-7-amd64-tests] Finished task in 157.45 seconds. [2024-04-19 09:37:28] [INFO] [65615] [ThreadPoolExecutor-0_11] [workflow_engine]: [run-agent-linux-amazon-2-amd64-tests] Starting task. [2024-04-19 09:37:28] [DEBUG] [65615] [ThreadPoolExecutor-0_11] [workflow_engine]: Running task "run-agent-linux-amazon-2-amd64-tests" with arguments: ['modules/testing/main.py', "--targets={'wazuh-1': '/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'}", "--targets={'agent': '/tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml'}", '--tests=install,registration,restart,stop,uninstall', '--component=agent', '--wazuh-version=4.7.3', '--wazuh-revision=40714', '--live=True'] [2024-04-19 09:37:28] [DEBUG] [65615] [ThreadPoolExecutor-0_7] [workflow_engine]: Finished task "run-agent-linux-debian-11-amd64-tests" execution with result: [2024-04-19 09:34:50] [INFO] TESTER: Running tests for ec2-44-223-69-111.compute-1.amazonaws.com [2024-04-19 09:34:50] [INFO] TESTER: Running tests for ec2-18-208-249-231.compute-1.amazonaws.com [2024-04-19 09:34:50] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-18-208-249-231.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-19 09:34:50] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-19 09:34:50] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:50] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-18-208-249-231.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-44-223-69-111.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.007574' end: '2024-04-19 09:34:52.991814' item: ec2-44-223-69-111.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:52.984240' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-18-208-249-231.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.005528' end: '2024-04-19 09:34:53.145570' item: ec2-18-208-249-231.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:53.140042' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:34:53] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-18-208-249-231.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:34:53] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:34:53] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:53] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' - --live=True - -s delta: '0:01:03.579233' end: '2024-04-19 09:35:59.006994' msg: non-zero return code rc: 1 start: '2024-04-19 09:34:55.427761' stderr: |- Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-19 09:34:56] [INFO] TESTER: Checking connection to debian-11[0m [32m[2024-04-19 09:34:58] [INFO] TESTER: Connection established successfully in debian-11[0m [32m[2024-04-19 09:35:00] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-19 09:35:01] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-19 09:35:03] [INFO] TESTER: No Firewall to disable on debian-11[0m [32m[2024-04-19 09:35:07] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-19 09:35:38] [INFO] TESTER: Installing Manager in ubuntu-22.04[0m [31m[2024-04-19 09:35:53] [ERROR] TESTER: The /var/ossec is not present in ubuntu-22.04[0m FAILED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-19 09:35:53] [INFO] TESTER: Getting status of debian-11[0m [31m[2024-04-19 09:35:54] [ERROR] TESTER: The debian-11 status is not loaded[0m FAILED modules/testing/tests/test_agent/test_install.py::test_version [31m[2024-04-19 09:35:56] [ERROR] TESTER: The version debian-11 is not 4.7.3 by command[0m FAILED modules/testing/tests/test_agent/test_install.py::test_revision [31m[2024-04-19 09:35:58] [ERROR] TESTER: The revision debian-11 is not 40714 by command[0m FAILED =================================== FAILURES =================================== ______________________________ test_installation _______________________________ wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_installation(wazuh_params): # Checking connection for manager_name, manager_params in wazuh_params['managers'].items(): Utils.check_inventory_connection(manager_params) # Certs creation, firewall management and Manager installation for agent_name, agent_params in wazuh_params['agents'].items(): HostConfiguration.disable_firewall(agent_params) if HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT): logger.info(f'Manager is already installed in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') else: HostConfiguration.disable_firewall(manager_params) HostConfiguration.certs_create(wazuh_params['wazuh_version'], wazuh_params['master'], wazuh_params['dashboard'], wazuh_params['indexers'], wazuh_params['workers']) WazuhManager.install_manager(wazuh_params['master'], 'wazuh-1', wazuh_params['wazuh_version']) > assert HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml', PosixPath('/var/ossec')) E + where = HostInformation.dir_exists modules/testing/tests/test_agent/test_install.py:81: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): agent_status = GeneralComponentActions.get_component_status(agent, 'wazuh-agent') > assert 'loaded' in agent_status, logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} status is not loaded') E AssertionError: None E assert 'loaded' in '' modules/testing/tests/test_agent/test_install.py:95: AssertionError _________________________________ test_version _________________________________ wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_version(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_version'] in GeneralComponentActions.get_component_version(agent_params), logger.error(f"The version {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_version']} by command") E AssertionError: None E assert '4.7.3' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_version modules/testing/tests/test_agent/test_install.py:100: AssertionError ________________________________ test_revision _________________________________ wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_revision(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_revision'] in GeneralComponentActions.get_component_revision(agent_params), logger.error(f"The revision {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_revision']} by command") E AssertionError: None E assert '40714' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_revision modules/testing/tests/test_agent/test_install.py:105: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_install.py::test_installation - ... FAILED modules/testing/tests/test_agent/test_install.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_install.py::test_version - Asser... FAILED modules/testing/tests/test_agent/test_install.py::test_revision - Asse... =================== 4 failed, 2 warnings in 62.76s (0:01:02) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:35:59] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:35:59] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:35:59] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:35:59] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:22.853407' end: '2024-04-19 09:36:23.282099' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:00.428692' stderr: |- Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sed: can't read /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. cat: /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-19 09:36:00] [INFO] TESTER: Checking connection to debian-11[0m [32m[2024-04-19 09:36:02] [INFO] TESTER: Connection established successfully in debian-11[0m [31m[2024-04-19 09:36:11] [ERROR] TESTER: Error configuring the Manager IP (172.31.18.156)in: debian-11 agent[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-19 09:36:11] [INFO] TESTER: Getting status of debian-11[0m [31m[2024-04-19 09:36:13] [ERROR] TESTER: The debian-11 is not active[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys [31m[2024-04-19 09:36:23] [ERROR] TESTER: agent-linux-debian-11-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== ______________________________ test_registration _______________________________ wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_registration(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > WazuhAgent.register_agent(agent_params, wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:67: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ inventory_path = '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml' manager_path = {'ansible_connection': 'ssh', 'ansible_host': 'ec2-44-223-69-111.compute-1.amazonaws.com', 'ansible_port': 2200, 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322', ...} @staticmethod def register_agent(inventory_path, manager_path): with open(manager_path, 'r') as yaml_file: manager_path = yaml.safe_load(yaml_file) host = manager_path.get('ansible_host') internal_ip = HostInformation.get_internal_ip_from_aws_dns(host) if 'amazonaws' in host else host commands = [ f"sed -i 's/
MANAGER_IP<\/address>/
{internal_ip}<\/address>/g' {WAZUH_CONF}", "systemctl restart wazuh-agent" ] Executor.execute_commands(inventory_path, commands) > assert internal_ip in Executor.execute_command(inventory_path, f'cat {WAZUH_CONF}'), logger.error(f'Error configuring the Manager IP ({internal_ip})in: {HostInformation.get_os_name_and_version_from_inventory(inventory_path)} agent') E AssertionError: None modules/testing/tests/helpers/agent.py:106: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): > assert 'active' in GeneralComponentActions.get_component_status(agent, 'wazuh-agent'), logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} is not active') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_registration.py:72: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' E AssertionError: The agent-linux-debian-11-amd64 is not present in the master by command E assert 'agent-linux-debian-11-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_registration.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_registration.py:93: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_registration FAILED modules/testing/tests/test_agent/test_registration.py::test_status - A... FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys ======================== 5 failed, 2 warnings in 22.37s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:23] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:23] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:23] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:23] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:13.358558' end: '2024-04-19 09:36:38.068533' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:24.709975' stderr: |- Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-19 09:36:25] [INFO] TESTER: Checking connection to debian-11[0m [32m[2024-04-19 09:36:26] [INFO] TESTER: Connection established successfully in debian-11[0m [32m[2024-04-19 09:36:28] [INFO] TESTER: Restarting wazuh-agent in debian-11[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-19 09:36:30] [INFO] TESTER: Getting status of debian-11[0m [31m[2024-04-19 09:36:32] [ERROR] TESTER: agent-linux-debian-11-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_connection [31m[2024-04-19 09:36:34] [ERROR] TESTER: agent-linux-debian-11-amd64 is not present in agent_control information[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive [31m[2024-04-19 09:36:36] [ERROR] TESTER: agent-linux-debian-11-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys [31m[2024-04-19 09:36:38] [ERROR] TESTER: agent-linux-debian-11-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert 'active' in GeneralComponentActions.get_component_status(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_restart.py:71: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is not present in agent_control information') E AssertionError: None E assert 'agent-linux-debian-11-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_restart.py:76: AssertionError ________________________________ test_isActive _________________________________ wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_restart.py:81: AssertionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_restart.py:86: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_restart.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_restart.py::test_connection - As... FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive - Asse... FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys - As... =================== 4 failed, 1 passed, 2 warnings in 12.97s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:38] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:38] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:38] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:38] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:11.816063' end: '2024-04-19 09:36:51.307518' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:39.491455' stderr: |- Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-19 09:36:39] [INFO] TESTER: Checking connection to debian-11[0m [32m[2024-04-19 09:36:41] [INFO] TESTER: Connection established successfully in debian-11[0m FAILED[32m[2024-04-19 09:36:49] [INFO] TESTER: Restarting wazuh-agent in debian-11[0m =================================== FAILURES =================================== __________________________________ test_stop ___________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_stop(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_stop.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_stop.py::test_stop - requests.ex... ======================== 1 failed, 2 warnings in 11.42s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:51] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:51] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:51] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:51] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:13.979490' end: '2024-04-19 09:37:06.710646' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:52.731156' stderr: |- Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-208-249-231.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-19 09:36:53] [INFO] TESTER: Checking connection to debian-11[0m [32m[2024-04-19 09:36:54] [INFO] TESTER: Connection established successfully in debian-11[0m [31m[2024-04-19 09:36:58] [ERROR] TESTER: agent-linux-debian-11-amd64 is not Active before the installation[0m FAILED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive FAILED =================================== FAILURES =================================== ________________________________ test_uninstall ________________________________ wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_uninstall(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not Active before the installation') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_uninstall.py:68: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-debian-11-amd64': '/tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_uninstall.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_uninstall.py::test_uninstall - A... FAILED modules/testing/tests/test_agent/test_uninstall.py::test_isActive - re... =================== 2 failed, 1 passed, 2 warnings in 13.59s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:06] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-11-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:06] [INFO] TESTER: Cleaning up [2024-04-19 09:37:06] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:06] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:18] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:37:18] [INFO] TESTER: Cleaning up [2024-04-19 09:37:18] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:18] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:28] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:37:28] [INFO] [65615] [ThreadPoolExecutor-0_7] [workflow_engine]: [run-agent-linux-debian-11-amd64-tests] Finished task in 157.97 seconds. [2024-04-19 09:37:28] [DEBUG] [65615] [ThreadPoolExecutor-0_9] [workflow_engine]: Finished task "run-agent-linux-debian-12-amd64-tests" execution with result: [2024-04-19 09:34:51] [INFO] TESTER: Running tests for ec2-44-223-69-111.compute-1.amazonaws.com [2024-04-19 09:34:51] [INFO] TESTER: Running tests for ec2-184-72-78-208.compute-1.amazonaws.com [2024-04-19 09:34:51] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-184-72-78-208.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-19 09:34:51] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-19 09:34:51] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:51] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-184-72-78-208.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-44-223-69-111.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.005240' end: '2024-04-19 09:34:53.020657' item: ec2-44-223-69-111.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:53.015417' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-184-72-78-208.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.005418' end: '2024-04-19 09:34:53.189900' item: ec2-184-72-78-208.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:53.184482' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:34:53] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-184-72-78-208.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:34:53] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:34:53] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:53] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' - --live=True - -s delta: '0:01:00.877628' end: '2024-04-19 09:35:56.291845' msg: non-zero return code rc: 1 start: '2024-04-19 09:34:55.414217' stderr: |- Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-19 09:34:56] [INFO] TESTER: Checking connection to debian-12[0m [32m[2024-04-19 09:34:57] [INFO] TESTER: Connection established successfully in debian-12[0m [32m[2024-04-19 09:34:59] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-19 09:35:01] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-19 09:35:03] [INFO] TESTER: No Firewall to disable on debian-12[0m [32m[2024-04-19 09:35:06] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-19 09:35:37] [INFO] TESTER: Installing Manager in ubuntu-22.04[0m [31m[2024-04-19 09:35:50] [ERROR] TESTER: The /var/ossec is not present in ubuntu-22.04[0m FAILED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-19 09:35:50] [INFO] TESTER: Getting status of debian-12[0m [31m[2024-04-19 09:35:52] [ERROR] TESTER: The debian-12 status is not loaded[0m FAILED modules/testing/tests/test_agent/test_install.py::test_version [31m[2024-04-19 09:35:54] [ERROR] TESTER: The version debian-12 is not 4.7.3 by command[0m FAILED modules/testing/tests/test_agent/test_install.py::test_revision [31m[2024-04-19 09:35:56] [ERROR] TESTER: The revision debian-12 is not 40714 by command[0m FAILED =================================== FAILURES =================================== ______________________________ test_installation _______________________________ wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_installation(wazuh_params): # Checking connection for manager_name, manager_params in wazuh_params['managers'].items(): Utils.check_inventory_connection(manager_params) # Certs creation, firewall management and Manager installation for agent_name, agent_params in wazuh_params['agents'].items(): HostConfiguration.disable_firewall(agent_params) if HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT): logger.info(f'Manager is already installed in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') else: HostConfiguration.disable_firewall(manager_params) HostConfiguration.certs_create(wazuh_params['wazuh_version'], wazuh_params['master'], wazuh_params['dashboard'], wazuh_params['indexers'], wazuh_params['workers']) WazuhManager.install_manager(wazuh_params['master'], 'wazuh-1', wazuh_params['wazuh_version']) > assert HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml', PosixPath('/var/ossec')) E + where = HostInformation.dir_exists modules/testing/tests/test_agent/test_install.py:81: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): agent_status = GeneralComponentActions.get_component_status(agent, 'wazuh-agent') > assert 'loaded' in agent_status, logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} status is not loaded') E AssertionError: None E assert 'loaded' in '' modules/testing/tests/test_agent/test_install.py:95: AssertionError _________________________________ test_version _________________________________ wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_version(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_version'] in GeneralComponentActions.get_component_version(agent_params), logger.error(f"The version {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_version']} by command") E AssertionError: None E assert '4.7.3' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_version modules/testing/tests/test_agent/test_install.py:100: AssertionError ________________________________ test_revision _________________________________ wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_revision(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_revision'] in GeneralComponentActions.get_component_revision(agent_params), logger.error(f"The revision {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_revision']} by command") E AssertionError: None E assert '40714' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_revision modules/testing/tests/test_agent/test_install.py:105: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_install.py::test_installation - ... FAILED modules/testing/tests/test_agent/test_install.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_install.py::test_version - Asser... FAILED modules/testing/tests/test_agent/test_install.py::test_revision - Asse... =================== 4 failed, 2 warnings in 60.07s (0:01:00) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:35:56] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:35:56] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:35:56] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:35:56] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:24.964892' end: '2024-04-19 09:36:22.657031' msg: non-zero return code rc: 1 start: '2024-04-19 09:35:57.692139' stderr: |- Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sed: can't read /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. cat: /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-19 09:35:58] [INFO] TESTER: Checking connection to debian-12[0m [32m[2024-04-19 09:35:59] [INFO] TESTER: Connection established successfully in debian-12[0m [31m[2024-04-19 09:36:08] [ERROR] TESTER: Error configuring the Manager IP (172.31.18.156)in: debian-12 agent[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-19 09:36:08] [INFO] TESTER: Getting status of debian-12[0m [31m[2024-04-19 09:36:10] [ERROR] TESTER: The debian-12 is not active[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys [31m[2024-04-19 09:36:22] [ERROR] TESTER: agent-linux-debian-12-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== ______________________________ test_registration _______________________________ wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_registration(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > WazuhAgent.register_agent(agent_params, wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:67: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ inventory_path = '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml' manager_path = {'ansible_connection': 'ssh', 'ansible_host': 'ec2-44-223-69-111.compute-1.amazonaws.com', 'ansible_port': 2200, 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322', ...} @staticmethod def register_agent(inventory_path, manager_path): with open(manager_path, 'r') as yaml_file: manager_path = yaml.safe_load(yaml_file) host = manager_path.get('ansible_host') internal_ip = HostInformation.get_internal_ip_from_aws_dns(host) if 'amazonaws' in host else host commands = [ f"sed -i 's/
MANAGER_IP<\/address>/
{internal_ip}<\/address>/g' {WAZUH_CONF}", "systemctl restart wazuh-agent" ] Executor.execute_commands(inventory_path, commands) > assert internal_ip in Executor.execute_command(inventory_path, f'cat {WAZUH_CONF}'), logger.error(f'Error configuring the Manager IP ({internal_ip})in: {HostInformation.get_os_name_and_version_from_inventory(inventory_path)} agent') E AssertionError: None modules/testing/tests/helpers/agent.py:106: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): > assert 'active' in GeneralComponentActions.get_component_status(agent, 'wazuh-agent'), logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} is not active') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_registration.py:72: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' E AssertionError: The agent-linux-debian-12-amd64 is not present in the master by command E assert 'agent-linux-debian-12-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_registration.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_registration.py:93: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_registration FAILED modules/testing/tests/test_agent/test_registration.py::test_status - A... FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys ======================== 5 failed, 2 warnings in 24.55s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:22] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:22] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:22] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:22] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:13.698244' end: '2024-04-19 09:36:37.762689' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:24.064445' stderr: |- Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-19 09:36:24] [INFO] TESTER: Checking connection to debian-12[0m [32m[2024-04-19 09:36:25] [INFO] TESTER: Connection established successfully in debian-12[0m [32m[2024-04-19 09:36:27] [INFO] TESTER: Restarting wazuh-agent in debian-12[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-19 09:36:29] [INFO] TESTER: Getting status of debian-12[0m [31m[2024-04-19 09:36:31] [ERROR] TESTER: agent-linux-debian-12-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_connection [31m[2024-04-19 09:36:33] [ERROR] TESTER: agent-linux-debian-12-amd64 is not present in agent_control information[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive [31m[2024-04-19 09:36:35] [ERROR] TESTER: agent-linux-debian-12-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys [31m[2024-04-19 09:36:37] [ERROR] TESTER: agent-linux-debian-12-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert 'active' in GeneralComponentActions.get_component_status(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_restart.py:71: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is not present in agent_control information') E AssertionError: None E assert 'agent-linux-debian-12-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_restart.py:76: AssertionError ________________________________ test_isActive _________________________________ wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_restart.py:81: AssertionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_restart.py:86: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_restart.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_restart.py::test_connection - As... FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive - Asse... FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys - As... =================== 4 failed, 1 passed, 2 warnings in 13.29s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:37] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:37] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:37] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:37] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:11.782336' end: '2024-04-19 09:36:50.987539' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:39.205203' stderr: |- Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-19 09:36:39] [INFO] TESTER: Checking connection to debian-12[0m [32m[2024-04-19 09:36:40] [INFO] TESTER: Connection established successfully in debian-12[0m FAILED[32m[2024-04-19 09:36:49] [INFO] TESTER: Restarting wazuh-agent in debian-12[0m =================================== FAILURES =================================== __________________________________ test_stop ___________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_stop(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_stop.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_stop.py::test_stop - requests.ex... ======================== 1 failed, 2 warnings in 11.38s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:51] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:51] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:51] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:51] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:13.663712' end: '2024-04-19 09:37:06.140846' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:52.477134' stderr: |- Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-184-72-78-208.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-19 09:36:52] [INFO] TESTER: Checking connection to debian-12[0m [32m[2024-04-19 09:36:54] [INFO] TESTER: Connection established successfully in debian-12[0m [31m[2024-04-19 09:36:58] [ERROR] TESTER: agent-linux-debian-12-amd64 is not Active before the installation[0m FAILED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive FAILED =================================== FAILURES =================================== ________________________________ test_uninstall ________________________________ wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_uninstall(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not Active before the installation') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_uninstall.py:68: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-debian-12-amd64': '/tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_uninstall.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_uninstall.py::test_uninstall - A... FAILED modules/testing/tests/test_agent/test_uninstall.py::test_isActive - re... =================== 2 failed, 1 passed, 2 warnings in 13.27s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:06] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-12-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:06] [INFO] TESTER: Cleaning up [2024-04-19 09:37:06] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:06] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:18] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:37:18] [INFO] TESTER: Cleaning up [2024-04-19 09:37:18] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:18] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:28] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:37:28] [INFO] [65615] [ThreadPoolExecutor-0_9] [workflow_engine]: [run-agent-linux-debian-12-amd64-tests] Finished task in 158.41 seconds. [2024-04-19 09:37:29] [DEBUG] [65615] [ThreadPoolExecutor-0_8] [workflow_engine]: Finished task "run-agent-linux-centos-8-amd64-tests" execution with result: [2024-04-19 09:34:51] [INFO] TESTER: Running tests for ec2-44-223-69-111.compute-1.amazonaws.com [2024-04-19 09:34:51] [INFO] TESTER: Running tests for ec2-3-90-251-190.compute-1.amazonaws.com [2024-04-19 09:34:51] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-3-90-251-190.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-19 09:34:51] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-19 09:34:51] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:51] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-3-90-251-190.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-44-223-69-111.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.005683' end: '2024-04-19 09:34:53.079034' item: ec2-44-223-69-111.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:53.073351' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-3-90-251-190.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.005194' end: '2024-04-19 09:34:53.274157' item: ec2-3-90-251-190.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:53.268963' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:34:53] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-3-90-251-190.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:34:53] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:34:53] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:53] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' - --live=True - -s delta: '0:01:04.391963' end: '2024-04-19 09:36:00.117595' msg: non-zero return code rc: 1 start: '2024-04-19 09:34:55.725632' stderr: |- Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-19 09:34:56] [INFO] TESTER: Checking connection to centos-8[0m [32m[2024-04-19 09:34:57] [INFO] TESTER: Connection established successfully in centos-8[0m [32m[2024-04-19 09:35:00] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-19 09:35:01] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-19 09:35:03] [INFO] TESTER: No Firewall to disable on centos-8[0m [32m[2024-04-19 09:35:07] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-19 09:35:37] [INFO] TESTER: Installing Manager in ubuntu-22.04[0m [31m[2024-04-19 09:35:53] [ERROR] TESTER: The /var/ossec is not present in ubuntu-22.04[0m FAILED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-19 09:35:53] [INFO] TESTER: Getting status of centos-8[0m [31m[2024-04-19 09:35:55] [ERROR] TESTER: The centos-8 status is not loaded[0m FAILED modules/testing/tests/test_agent/test_install.py::test_version [31m[2024-04-19 09:35:57] [ERROR] TESTER: The version centos-8 is not 4.7.3 by command[0m FAILED modules/testing/tests/test_agent/test_install.py::test_revision [31m[2024-04-19 09:35:59] [ERROR] TESTER: The revision centos-8 is not 40714 by command[0m FAILED =================================== FAILURES =================================== ______________________________ test_installation _______________________________ wazuh_params = {'agents': {'agent-linux-centos-8-amd64': '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_installation(wazuh_params): # Checking connection for manager_name, manager_params in wazuh_params['managers'].items(): Utils.check_inventory_connection(manager_params) # Certs creation, firewall management and Manager installation for agent_name, agent_params in wazuh_params['agents'].items(): HostConfiguration.disable_firewall(agent_params) if HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT): logger.info(f'Manager is already installed in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') else: HostConfiguration.disable_firewall(manager_params) HostConfiguration.certs_create(wazuh_params['wazuh_version'], wazuh_params['master'], wazuh_params['dashboard'], wazuh_params['indexers'], wazuh_params['workers']) WazuhManager.install_manager(wazuh_params['master'], 'wazuh-1', wazuh_params['wazuh_version']) > assert HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml', PosixPath('/var/ossec')) E + where = HostInformation.dir_exists modules/testing/tests/test_agent/test_install.py:81: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-centos-8-amd64': '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): agent_status = GeneralComponentActions.get_component_status(agent, 'wazuh-agent') > assert 'loaded' in agent_status, logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} status is not loaded') E AssertionError: None E assert 'loaded' in '' modules/testing/tests/test_agent/test_install.py:95: AssertionError _________________________________ test_version _________________________________ wazuh_params = {'agents': {'agent-linux-centos-8-amd64': '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_version(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_version'] in GeneralComponentActions.get_component_version(agent_params), logger.error(f"The version {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_version']} by command") E AssertionError: None E assert '4.7.3' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_version modules/testing/tests/test_agent/test_install.py:100: AssertionError ________________________________ test_revision _________________________________ wazuh_params = {'agents': {'agent-linux-centos-8-amd64': '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_revision(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_revision'] in GeneralComponentActions.get_component_revision(agent_params), logger.error(f"The revision {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_revision']} by command") E AssertionError: None E assert '40714' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_revision modules/testing/tests/test_agent/test_install.py:105: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_install.py::test_installation - ... FAILED modules/testing/tests/test_agent/test_install.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_install.py::test_version - Asser... FAILED modules/testing/tests/test_agent/test_install.py::test_revision - Asse... =================== 4 failed, 2 warnings in 63.50s (0:01:03) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:00] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:00] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:00] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:00] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:23.064915' end: '2024-04-19 09:36:24.648950' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:01.584035' stderr: |- Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sed: can't read /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. cat: /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-19 09:36:01] [INFO] TESTER: Checking connection to centos-8[0m [32m[2024-04-19 09:36:03] [INFO] TESTER: Connection established successfully in centos-8[0m [31m[2024-04-19 09:36:12] [ERROR] TESTER: Error configuring the Manager IP (172.31.18.156)in: centos-8 agent[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-19 09:36:12] [INFO] TESTER: Getting status of centos-8[0m [31m[2024-04-19 09:36:14] [ERROR] TESTER: The centos-8 is not active[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys [31m[2024-04-19 09:36:24] [ERROR] TESTER: agent-linux-centos-8-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== ______________________________ test_registration _______________________________ wazuh_params = {'agents': {'agent-linux-centos-8-amd64': '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_registration(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > WazuhAgent.register_agent(agent_params, wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:67: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ inventory_path = '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml' manager_path = {'ansible_connection': 'ssh', 'ansible_host': 'ec2-44-223-69-111.compute-1.amazonaws.com', 'ansible_port': 2200, 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322', ...} @staticmethod def register_agent(inventory_path, manager_path): with open(manager_path, 'r') as yaml_file: manager_path = yaml.safe_load(yaml_file) host = manager_path.get('ansible_host') internal_ip = HostInformation.get_internal_ip_from_aws_dns(host) if 'amazonaws' in host else host commands = [ f"sed -i 's/
MANAGER_IP<\/address>/
{internal_ip}<\/address>/g' {WAZUH_CONF}", "systemctl restart wazuh-agent" ] Executor.execute_commands(inventory_path, commands) > assert internal_ip in Executor.execute_command(inventory_path, f'cat {WAZUH_CONF}'), logger.error(f'Error configuring the Manager IP ({internal_ip})in: {HostInformation.get_os_name_and_version_from_inventory(inventory_path)} agent') E AssertionError: None modules/testing/tests/helpers/agent.py:106: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-centos-8-amd64': '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): > assert 'active' in GeneralComponentActions.get_component_status(agent, 'wazuh-agent'), logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} is not active') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_registration.py:72: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-centos-8-amd64': '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' E AssertionError: The agent-linux-centos-8-amd64 is not present in the master by command E assert 'agent-linux-centos-8-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_registration.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-centos-8-amd64': '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-centos-8-amd64': '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_registration.py:93: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_registration FAILED modules/testing/tests/test_agent/test_registration.py::test_status - A... FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys ======================== 5 failed, 2 warnings in 22.63s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:24] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:24] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:24] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:24] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:14.115358' end: '2024-04-19 09:36:40.184292' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:26.068934' stderr: |- Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-19 09:36:26] [INFO] TESTER: Checking connection to centos-8[0m [32m[2024-04-19 09:36:27] [INFO] TESTER: Connection established successfully in centos-8[0m [32m[2024-04-19 09:36:29] [INFO] TESTER: Restarting wazuh-agent in centos-8[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-19 09:36:31] [INFO] TESTER: Getting status of centos-8[0m [31m[2024-04-19 09:36:34] [ERROR] TESTER: agent-linux-centos-8-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_connection [31m[2024-04-19 09:36:36] [ERROR] TESTER: agent-linux-centos-8-amd64 is not present in agent_control information[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive [31m[2024-04-19 09:36:38] [ERROR] TESTER: agent-linux-centos-8-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys [31m[2024-04-19 09:36:40] [ERROR] TESTER: agent-linux-centos-8-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-centos-8-amd64': '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert 'active' in GeneralComponentActions.get_component_status(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_restart.py:71: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-centos-8-amd64': '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is not present in agent_control information') E AssertionError: None E assert 'agent-linux-centos-8-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_restart.py:76: AssertionError ________________________________ test_isActive _________________________________ wazuh_params = {'agents': {'agent-linux-centos-8-amd64': '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_restart.py:81: AssertionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-centos-8-amd64': '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_restart.py:86: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_restart.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_restart.py::test_connection - As... FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive - Asse... FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys - As... =================== 4 failed, 1 passed, 2 warnings in 13.73s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:40] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:40] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:40] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:40] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:12.178112' end: '2024-04-19 09:36:53.743615' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:41.565503' stderr: |- Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-19 09:36:41] [INFO] TESTER: Checking connection to centos-8[0m [32m[2024-04-19 09:36:43] [INFO] TESTER: Connection established successfully in centos-8[0m FAILED[32m[2024-04-19 09:36:51] [INFO] TESTER: Restarting wazuh-agent in centos-8[0m =================================== FAILURES =================================== __________________________________ test_stop ___________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-centos-8-amd64': '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_stop(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_stop.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_stop.py::test_stop - requests.ex... ======================== 1 failed, 2 warnings in 11.78s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:53] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:53] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:53] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:53] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:14.396944' end: '2024-04-19 09:37:09.559586' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:55.162642' stderr: |- Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-90-251-190.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-19 09:36:55] [INFO] TESTER: Checking connection to centos-8[0m [32m[2024-04-19 09:36:56] [INFO] TESTER: Connection established successfully in centos-8[0m [31m[2024-04-19 09:37:01] [ERROR] TESTER: agent-linux-centos-8-amd64 is not Active before the installation[0m FAILED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive FAILED =================================== FAILURES =================================== ________________________________ test_uninstall ________________________________ wazuh_params = {'agents': {'agent-linux-centos-8-amd64': '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_uninstall(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not Active before the installation') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_uninstall.py:68: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-centos-8-amd64': '/tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_uninstall.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_uninstall.py::test_uninstall - A... FAILED modules/testing/tests/test_agent/test_uninstall.py::test_isActive - re... =================== 2 failed, 1 passed, 2 warnings in 14.00s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:09] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-centos-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:09] [INFO] TESTER: Cleaning up [2024-04-19 09:37:09] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:09] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:19] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:37:19] [INFO] TESTER: Cleaning up [2024-04-19 09:37:19] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:19] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:29] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:37:29] [INFO] [65615] [ThreadPoolExecutor-0_8] [workflow_engine]: [run-agent-linux-centos-8-amd64-tests] Finished task in 159.26 seconds. [2024-04-19 09:37:30] [DEBUG] [65615] [ThreadPoolExecutor-0_2] [workflow_engine]: Finished task "run-agent-linux-redhat-8-amd64-tests" execution with result: [2024-04-19 09:34:51] [INFO] TESTER: Running tests for ec2-44-223-69-111.compute-1.amazonaws.com [2024-04-19 09:34:51] [INFO] TESTER: Running tests for ec2-3-95-215-141.compute-1.amazonaws.com [2024-04-19 09:34:51] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-3-95-215-141.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-19 09:34:51] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-19 09:34:51] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:51] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-3-95-215-141.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-44-223-69-111.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.004616' end: '2024-04-19 09:34:53.061148' item: ec2-44-223-69-111.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:53.056532' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-3-95-215-141.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.005121' end: '2024-04-19 09:34:53.245364' item: ec2-3-95-215-141.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:53.240243' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:34:53] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-3-95-215-141.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:34:53] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:34:53] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:53] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml}' - --live=True - -s delta: '0:01:04.563715' end: '2024-04-19 09:36:00.117598' msg: non-zero return code rc: 1 start: '2024-04-19 09:34:55.553883' stderr: |- Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-19 09:34:56] [INFO] TESTER: Checking connection to redhat-8[0m [32m[2024-04-19 09:34:57] [INFO] TESTER: Connection established successfully in redhat-8[0m [32m[2024-04-19 09:35:00] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-19 09:35:01] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-19 09:35:03] [INFO] TESTER: No Firewall to disable on redhat-8[0m [32m[2024-04-19 09:35:07] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-19 09:35:38] [INFO] TESTER: Installing Manager in ubuntu-22.04[0m [31m[2024-04-19 09:35:53] [ERROR] TESTER: The /var/ossec is not present in ubuntu-22.04[0m FAILED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-19 09:35:53] [INFO] TESTER: Getting status of redhat-8[0m [31m[2024-04-19 09:35:55] [ERROR] TESTER: The redhat-8 status is not loaded[0m FAILED modules/testing/tests/test_agent/test_install.py::test_version [31m[2024-04-19 09:35:57] [ERROR] TESTER: The version redhat-8 is not 4.7.3 by command[0m FAILED modules/testing/tests/test_agent/test_install.py::test_revision [31m[2024-04-19 09:35:59] [ERROR] TESTER: The revision redhat-8 is not 40714 by command[0m FAILED =================================== FAILURES =================================== ______________________________ test_installation _______________________________ wazuh_params = {'agents': {'agent-linux-redhat-8-amd64': '/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_installation(wazuh_params): # Checking connection for manager_name, manager_params in wazuh_params['managers'].items(): Utils.check_inventory_connection(manager_params) # Certs creation, firewall management and Manager installation for agent_name, agent_params in wazuh_params['agents'].items(): HostConfiguration.disable_firewall(agent_params) if HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT): logger.info(f'Manager is already installed in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') else: HostConfiguration.disable_firewall(manager_params) HostConfiguration.certs_create(wazuh_params['wazuh_version'], wazuh_params['master'], wazuh_params['dashboard'], wazuh_params['indexers'], wazuh_params['workers']) WazuhManager.install_manager(wazuh_params['master'], 'wazuh-1', wazuh_params['wazuh_version']) > assert HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml', PosixPath('/var/ossec')) E + where = HostInformation.dir_exists modules/testing/tests/test_agent/test_install.py:81: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-redhat-8-amd64': '/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): agent_status = GeneralComponentActions.get_component_status(agent, 'wazuh-agent') > assert 'loaded' in agent_status, logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} status is not loaded') E AssertionError: None E assert 'loaded' in '' modules/testing/tests/test_agent/test_install.py:95: AssertionError _________________________________ test_version _________________________________ wazuh_params = {'agents': {'agent-linux-redhat-8-amd64': '/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_version(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_version'] in GeneralComponentActions.get_component_version(agent_params), logger.error(f"The version {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_version']} by command") E AssertionError: None E assert '4.7.3' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_version modules/testing/tests/test_agent/test_install.py:100: AssertionError ________________________________ test_revision _________________________________ wazuh_params = {'agents': {'agent-linux-redhat-8-amd64': '/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_revision(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_revision'] in GeneralComponentActions.get_component_revision(agent_params), logger.error(f"The revision {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_revision']} by command") E AssertionError: None E assert '40714' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_revision modules/testing/tests/test_agent/test_install.py:105: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_install.py::test_installation - ... FAILED modules/testing/tests/test_agent/test_install.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_install.py::test_version - Asser... FAILED modules/testing/tests/test_agent/test_install.py::test_revision - Asse... =================== 4 failed, 2 warnings in 63.62s (0:01:03) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:00] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:00] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:00] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:00] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:23.688017' end: '2024-04-19 09:36:25.271548' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:01.583531' stderr: |- Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sed: can't read /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. cat: /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-19 09:36:01] [INFO] TESTER: Checking connection to redhat-8[0m [32m[2024-04-19 09:36:03] [INFO] TESTER: Connection established successfully in redhat-8[0m [31m[2024-04-19 09:36:12] [ERROR] TESTER: Error configuring the Manager IP (172.31.18.156)in: redhat-8 agent[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-19 09:36:13] [INFO] TESTER: Getting status of redhat-8[0m [31m[2024-04-19 09:36:15] [ERROR] TESTER: The redhat-8 is not active[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys [31m[2024-04-19 09:36:25] [ERROR] TESTER: agent-linux-redhat-8-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== ______________________________ test_registration _______________________________ wazuh_params = {'agents': {'agent-linux-redhat-8-amd64': '/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_registration(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > WazuhAgent.register_agent(agent_params, wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:67: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ inventory_path = '/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml' manager_path = {'ansible_connection': 'ssh', 'ansible_host': 'ec2-44-223-69-111.compute-1.amazonaws.com', 'ansible_port': 2200, 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322', ...} @staticmethod def register_agent(inventory_path, manager_path): with open(manager_path, 'r') as yaml_file: manager_path = yaml.safe_load(yaml_file) host = manager_path.get('ansible_host') internal_ip = HostInformation.get_internal_ip_from_aws_dns(host) if 'amazonaws' in host else host commands = [ f"sed -i 's/
MANAGER_IP<\/address>/
{internal_ip}<\/address>/g' {WAZUH_CONF}", "systemctl restart wazuh-agent" ] Executor.execute_commands(inventory_path, commands) > assert internal_ip in Executor.execute_command(inventory_path, f'cat {WAZUH_CONF}'), logger.error(f'Error configuring the Manager IP ({internal_ip})in: {HostInformation.get_os_name_and_version_from_inventory(inventory_path)} agent') E AssertionError: None modules/testing/tests/helpers/agent.py:106: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-redhat-8-amd64': '/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): > assert 'active' in GeneralComponentActions.get_component_status(agent, 'wazuh-agent'), logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} is not active') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_registration.py:72: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-8-amd64': '/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' E AssertionError: The agent-linux-redhat-8-amd64 is not present in the master by command E assert 'agent-linux-redhat-8-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_registration.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-redhat-8-amd64': '/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-8-amd64': '/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_registration.py:93: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_registration FAILED modules/testing/tests/test_agent/test_registration.py::test_status - A... FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys ======================== 5 failed, 2 warnings in 23.25s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:25] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:25] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:25] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:25] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:14.551969' end: '2024-04-19 09:36:41.259424' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:26.707455' stderr: |- Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-19 09:36:27] [INFO] TESTER: Checking connection to redhat-8[0m [32m[2024-04-19 09:36:28] [INFO] TESTER: Connection established successfully in redhat-8[0m [32m[2024-04-19 09:36:30] [INFO] TESTER: Restarting wazuh-agent in redhat-8[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-19 09:36:32] [INFO] TESTER: Getting status of redhat-8[0m [31m[2024-04-19 09:36:34] [ERROR] TESTER: agent-linux-redhat-8-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_connection [31m[2024-04-19 09:36:36] [ERROR] TESTER: agent-linux-redhat-8-amd64 is not present in agent_control information[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive [31m[2024-04-19 09:36:38] [ERROR] TESTER: agent-linux-redhat-8-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys [31m[2024-04-19 09:36:41] [ERROR] TESTER: agent-linux-redhat-8-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-redhat-8-amd64': '/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert 'active' in GeneralComponentActions.get_component_status(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_restart.py:71: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-8-amd64': '/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is not present in agent_control information') E AssertionError: None E assert 'agent-linux-redhat-8-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_restart.py:76: AssertionError ________________________________ test_isActive _________________________________ wazuh_params = {'agents': {'agent-linux-redhat-8-amd64': '/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_restart.py:81: AssertionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-8-amd64': '/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_restart.py:86: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_restart.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_restart.py::test_connection - As... FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive - Asse... FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys - As... =================== 4 failed, 1 passed, 2 warnings in 14.17s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:41] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:41] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:41] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:41] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:12.139030' end: '2024-04-19 09:36:54.782172' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:42.643142' stderr: |- Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-19 09:36:43] [INFO] TESTER: Checking connection to redhat-8[0m [32m[2024-04-19 09:36:44] [INFO] TESTER: Connection established successfully in redhat-8[0m FAILED[32m[2024-04-19 09:36:52] [INFO] TESTER: Restarting wazuh-agent in redhat-8[0m =================================== FAILURES =================================== __________________________________ test_stop ___________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-redhat-8-amd64': '/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_stop(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_stop.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_stop.py::test_stop - requests.ex... ======================== 1 failed, 2 warnings in 11.75s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:54] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:54] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:54] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:54] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:14.542959' end: '2024-04-19 09:37:10.737643' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:56.194684' stderr: |- Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-95-215-141.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-19 09:36:56] [INFO] TESTER: Checking connection to redhat-8[0m [32m[2024-04-19 09:36:57] [INFO] TESTER: Connection established successfully in redhat-8[0m [31m[2024-04-19 09:37:02] [ERROR] TESTER: agent-linux-redhat-8-amd64 is not Active before the installation[0m FAILED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive FAILED =================================== FAILURES =================================== ________________________________ test_uninstall ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-8-amd64': '/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_uninstall(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not Active before the installation') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_uninstall.py:68: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-redhat-8-amd64': '/tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_uninstall.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_uninstall.py::test_uninstall - A... FAILED modules/testing/tests/test_agent/test_uninstall.py::test_isActive - re... =================== 2 failed, 1 passed, 2 warnings in 14.12s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:10] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-8-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:10] [INFO] TESTER: Cleaning up [2024-04-19 09:37:10] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:10] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:20] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:37:20] [INFO] TESTER: Cleaning up [2024-04-19 09:37:20] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:20] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:30] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:37:30] [INFO] [65615] [ThreadPoolExecutor-0_2] [workflow_engine]: [run-agent-linux-redhat-8-amd64-tests] Finished task in 160.16 seconds. [2024-04-19 09:37:30] [DEBUG] [65615] [ThreadPoolExecutor-0_4] [workflow_engine]: Finished task "run-agent-linux-redhat-9-amd64-tests" execution with result: [2024-04-19 09:34:51] [INFO] TESTER: Running tests for ec2-44-223-69-111.compute-1.amazonaws.com [2024-04-19 09:34:51] [INFO] TESTER: Running tests for ec2-54-82-162-196.compute-1.amazonaws.com [2024-04-19 09:34:51] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-54-82-162-196.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-19 09:34:51] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-19 09:34:51] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:51] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-54-82-162-196.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-44-223-69-111.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.007018' end: '2024-04-19 09:34:52.889817' item: ec2-44-223-69-111.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:52.882799' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-54-82-162-196.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.006820' end: '2024-04-19 09:34:53.070750' item: ec2-54-82-162-196.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:53.063930' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:34:53] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-54-82-162-196.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:34:53] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:34:53] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:53] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' - --live=True - -s delta: '0:01:04.239488' end: '2024-04-19 09:35:59.426187' msg: non-zero return code rc: 1 start: '2024-04-19 09:34:55.186699' stderr: |- Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-19 09:34:56] [INFO] TESTER: Checking connection to redhat-9[0m [32m[2024-04-19 09:34:57] [INFO] TESTER: Connection established successfully in redhat-9[0m [32m[2024-04-19 09:34:59] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-19 09:35:01] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-19 09:35:03] [INFO] TESTER: No Firewall to disable on redhat-9[0m [32m[2024-04-19 09:35:07] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-19 09:35:38] [INFO] TESTER: Installing Manager in ubuntu-22.04[0m [31m[2024-04-19 09:35:52] [ERROR] TESTER: The /var/ossec is not present in ubuntu-22.04[0m FAILED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-19 09:35:52] [INFO] TESTER: Getting status of redhat-9[0m [31m[2024-04-19 09:35:54] [ERROR] TESTER: The redhat-9 status is not loaded[0m FAILED modules/testing/tests/test_agent/test_install.py::test_version [31m[2024-04-19 09:35:57] [ERROR] TESTER: The version redhat-9 is not 4.7.3 by command[0m FAILED modules/testing/tests/test_agent/test_install.py::test_revision [31m[2024-04-19 09:35:59] [ERROR] TESTER: The revision redhat-9 is not 40714 by command[0m FAILED =================================== FAILURES =================================== ______________________________ test_installation _______________________________ wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_installation(wazuh_params): # Checking connection for manager_name, manager_params in wazuh_params['managers'].items(): Utils.check_inventory_connection(manager_params) # Certs creation, firewall management and Manager installation for agent_name, agent_params in wazuh_params['agents'].items(): HostConfiguration.disable_firewall(agent_params) if HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT): logger.info(f'Manager is already installed in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') else: HostConfiguration.disable_firewall(manager_params) HostConfiguration.certs_create(wazuh_params['wazuh_version'], wazuh_params['master'], wazuh_params['dashboard'], wazuh_params['indexers'], wazuh_params['workers']) WazuhManager.install_manager(wazuh_params['master'], 'wazuh-1', wazuh_params['wazuh_version']) > assert HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml', PosixPath('/var/ossec')) E + where = HostInformation.dir_exists modules/testing/tests/test_agent/test_install.py:81: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): agent_status = GeneralComponentActions.get_component_status(agent, 'wazuh-agent') > assert 'loaded' in agent_status, logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} status is not loaded') E AssertionError: None E assert 'loaded' in '' modules/testing/tests/test_agent/test_install.py:95: AssertionError _________________________________ test_version _________________________________ wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_version(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_version'] in GeneralComponentActions.get_component_version(agent_params), logger.error(f"The version {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_version']} by command") E AssertionError: None E assert '4.7.3' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_version modules/testing/tests/test_agent/test_install.py:100: AssertionError ________________________________ test_revision _________________________________ wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_revision(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_revision'] in GeneralComponentActions.get_component_revision(agent_params), logger.error(f"The revision {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_revision']} by command") E AssertionError: None E assert '40714' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_revision modules/testing/tests/test_agent/test_install.py:105: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_install.py::test_installation - ... FAILED modules/testing/tests/test_agent/test_install.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_install.py::test_version - Asser... FAILED modules/testing/tests/test_agent/test_install.py::test_revision - Asse... =================== 4 failed, 2 warnings in 63.43s (0:01:03) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:35:59] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:35:59] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:35:59] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:35:59] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:24.644217' end: '2024-04-19 09:36:25.509867' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:00.865650' stderr: |- Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sed: can't read /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. cat: /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-19 09:36:01] [INFO] TESTER: Checking connection to redhat-9[0m [32m[2024-04-19 09:36:02] [INFO] TESTER: Connection established successfully in redhat-9[0m [31m[2024-04-19 09:36:12] [ERROR] TESTER: Error configuring the Manager IP (172.31.18.156)in: redhat-9 agent[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-19 09:36:12] [INFO] TESTER: Getting status of redhat-9[0m [31m[2024-04-19 09:36:15] [ERROR] TESTER: The redhat-9 is not active[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys [31m[2024-04-19 09:36:25] [ERROR] TESTER: agent-linux-redhat-9-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== ______________________________ test_registration _______________________________ wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_registration(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > WazuhAgent.register_agent(agent_params, wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:67: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ inventory_path = '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml' manager_path = {'ansible_connection': 'ssh', 'ansible_host': 'ec2-44-223-69-111.compute-1.amazonaws.com', 'ansible_port': 2200, 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322', ...} @staticmethod def register_agent(inventory_path, manager_path): with open(manager_path, 'r') as yaml_file: manager_path = yaml.safe_load(yaml_file) host = manager_path.get('ansible_host') internal_ip = HostInformation.get_internal_ip_from_aws_dns(host) if 'amazonaws' in host else host commands = [ f"sed -i 's/
MANAGER_IP<\/address>/
{internal_ip}<\/address>/g' {WAZUH_CONF}", "systemctl restart wazuh-agent" ] Executor.execute_commands(inventory_path, commands) > assert internal_ip in Executor.execute_command(inventory_path, f'cat {WAZUH_CONF}'), logger.error(f'Error configuring the Manager IP ({internal_ip})in: {HostInformation.get_os_name_and_version_from_inventory(inventory_path)} agent') E AssertionError: None modules/testing/tests/helpers/agent.py:106: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): > assert 'active' in GeneralComponentActions.get_component_status(agent, 'wazuh-agent'), logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} is not active') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_registration.py:72: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' E AssertionError: The agent-linux-redhat-9-amd64 is not present in the master by command E assert 'agent-linux-redhat-9-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_registration.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_registration.py:93: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_registration FAILED modules/testing/tests/test_agent/test_registration.py::test_status - A... FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys ======================== 5 failed, 2 warnings in 24.19s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:25] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:25] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:25] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:25] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:14.502842' end: '2024-04-19 09:36:41.434323' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:26.931481' stderr: |- Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-19 09:36:27] [INFO] TESTER: Checking connection to redhat-9[0m [32m[2024-04-19 09:36:28] [INFO] TESTER: Connection established successfully in redhat-9[0m [32m[2024-04-19 09:36:30] [INFO] TESTER: Restarting wazuh-agent in redhat-9[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-19 09:36:33] [INFO] TESTER: Getting status of redhat-9[0m [31m[2024-04-19 09:36:35] [ERROR] TESTER: agent-linux-redhat-9-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_connection [31m[2024-04-19 09:36:37] [ERROR] TESTER: agent-linux-redhat-9-amd64 is not present in agent_control information[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive [31m[2024-04-19 09:36:39] [ERROR] TESTER: agent-linux-redhat-9-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys [31m[2024-04-19 09:36:41] [ERROR] TESTER: agent-linux-redhat-9-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert 'active' in GeneralComponentActions.get_component_status(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_restart.py:71: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is not present in agent_control information') E AssertionError: None E assert 'agent-linux-redhat-9-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_restart.py:76: AssertionError ________________________________ test_isActive _________________________________ wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_restart.py:81: AssertionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_restart.py:86: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_restart.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_restart.py::test_connection - As... FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive - Asse... FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys - As... =================== 4 failed, 1 passed, 2 warnings in 14.11s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:41] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:41] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:41] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:41] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:12.098218' end: '2024-04-19 09:36:54.921776' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:42.823558' stderr: |- Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-19 09:36:43] [INFO] TESTER: Checking connection to redhat-9[0m [32m[2024-04-19 09:36:44] [INFO] TESTER: Connection established successfully in redhat-9[0m FAILED[32m[2024-04-19 09:36:52] [INFO] TESTER: Restarting wazuh-agent in redhat-9[0m =================================== FAILURES =================================== __________________________________ test_stop ___________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_stop(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_stop.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_stop.py::test_stop - requests.ex... ======================== 1 failed, 2 warnings in 11.71s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:55] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:55] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:55] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:55] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:14.352493' end: '2024-04-19 09:37:10.736704' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:56.384211' stderr: |- Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-82-162-196.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-19 09:36:56] [INFO] TESTER: Checking connection to redhat-9[0m [32m[2024-04-19 09:36:58] [INFO] TESTER: Connection established successfully in redhat-9[0m [31m[2024-04-19 09:37:02] [ERROR] TESTER: agent-linux-redhat-9-amd64 is not Active before the installation[0m FAILED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive FAILED =================================== FAILURES =================================== ________________________________ test_uninstall ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_uninstall(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not Active before the installation') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_uninstall.py:68: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-redhat-9-amd64': '/tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_uninstall.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_uninstall.py::test_uninstall - A... FAILED modules/testing/tests/test_agent/test_uninstall.py::test_isActive - re... =================== 2 failed, 1 passed, 2 warnings in 13.94s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:10] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:10] [INFO] TESTER: Cleaning up [2024-04-19 09:37:10] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:10] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:20] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:37:20] [INFO] TESTER: Cleaning up [2024-04-19 09:37:20] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:20] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:30] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:37:30] [INFO] [65615] [ThreadPoolExecutor-0_4] [workflow_engine]: [run-agent-linux-redhat-9-amd64-tests] Finished task in 160.17 seconds. [2024-04-19 09:37:42] [DEBUG] [65615] [ThreadPoolExecutor-0_10] [workflow_engine]: Finished task "run-agent-linux-ubuntu-20.04-amd64-tests" execution with result: [2024-04-19 09:34:50] [INFO] TESTER: Running tests for ec2-44-223-69-111.compute-1.amazonaws.com [2024-04-19 09:34:50] [INFO] TESTER: Running tests for ec2-54-88-185-66.compute-1.amazonaws.com [2024-04-19 09:34:50] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-54-88-185-66.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-19 09:34:50] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-19 09:34:50] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:50] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-54-88-185-66.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-44-223-69-111.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.005082' end: '2024-04-19 09:34:52.501738' item: ec2-44-223-69-111.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:52.496656' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-54-88-185-66.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.004604' end: '2024-04-19 09:34:52.638050' item: ec2-54-88-185-66.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:52.633446' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:34:52] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-54-88-185-66.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:34:52] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:34:52] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:52] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:01:04.423141' end: '2024-04-19 09:36:00.507882' msg: non-zero return code rc: 1 start: '2024-04-19 09:34:56.084741' stderr: |- Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-19 09:34:56] [INFO] TESTER: Checking connection to ubuntu-20.04[0m [32m[2024-04-19 09:34:58] [INFO] TESTER: Connection established successfully in ubuntu-20.04[0m [32m[2024-04-19 09:35:01] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-19 09:35:02] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-19 09:35:06] [INFO] TESTER: No Firewall to disable on ubuntu-20.04[0m [32m[2024-04-19 09:35:10] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-19 09:35:37] [INFO] TESTER: Installing Manager in ubuntu-22.04[0m [31m[2024-04-19 09:35:52] [ERROR] TESTER: The /var/ossec is not present in ubuntu-22.04[0m FAILED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-19 09:35:52] [INFO] TESTER: Getting status of ubuntu-20.04[0m [31m[2024-04-19 09:35:55] [ERROR] TESTER: The ubuntu-20.04 status is not loaded[0m FAILED modules/testing/tests/test_agent/test_install.py::test_version [31m[2024-04-19 09:35:57] [ERROR] TESTER: The version ubuntu-20.04 is not 4.7.3 by command[0m FAILED modules/testing/tests/test_agent/test_install.py::test_revision [31m[2024-04-19 09:36:00] [ERROR] TESTER: The revision ubuntu-20.04 is not 40714 by command[0m FAILED =================================== FAILURES =================================== ______________________________ test_installation _______________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_installation(wazuh_params): # Checking connection for manager_name, manager_params in wazuh_params['managers'].items(): Utils.check_inventory_connection(manager_params) # Certs creation, firewall management and Manager installation for agent_name, agent_params in wazuh_params['agents'].items(): HostConfiguration.disable_firewall(agent_params) if HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT): logger.info(f'Manager is already installed in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') else: HostConfiguration.disable_firewall(manager_params) HostConfiguration.certs_create(wazuh_params['wazuh_version'], wazuh_params['master'], wazuh_params['dashboard'], wazuh_params['indexers'], wazuh_params['workers']) WazuhManager.install_manager(wazuh_params['master'], 'wazuh-1', wazuh_params['wazuh_version']) > assert HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml', PosixPath('/var/ossec')) E + where = HostInformation.dir_exists modules/testing/tests/test_agent/test_install.py:81: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): agent_status = GeneralComponentActions.get_component_status(agent, 'wazuh-agent') > assert 'loaded' in agent_status, logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} status is not loaded') E AssertionError: None E assert 'loaded' in '' modules/testing/tests/test_agent/test_install.py:95: AssertionError _________________________________ test_version _________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_version(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_version'] in GeneralComponentActions.get_component_version(agent_params), logger.error(f"The version {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_version']} by command") E AssertionError: None E assert '4.7.3' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_version modules/testing/tests/test_agent/test_install.py:100: AssertionError ________________________________ test_revision _________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_revision(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_revision'] in GeneralComponentActions.get_component_revision(agent_params), logger.error(f"The revision {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_revision']} by command") E AssertionError: None E assert '40714' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_revision modules/testing/tests/test_agent/test_install.py:105: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_install.py::test_installation - ... FAILED modules/testing/tests/test_agent/test_install.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_install.py::test_version - Asser... FAILED modules/testing/tests/test_agent/test_install.py::test_revision - Asse... =================== 4 failed, 2 warnings in 63.79s (0:01:03) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:00] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:00] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:00] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:00] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:29.790832' end: '2024-04-19 09:36:31.740894' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:01.950062' stderr: |- Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sed: can't read /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. cat: /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-19 09:36:02] [INFO] TESTER: Checking connection to ubuntu-20.04[0m [32m[2024-04-19 09:36:03] [INFO] TESTER: Connection established successfully in ubuntu-20.04[0m [31m[2024-04-19 09:36:17] [ERROR] TESTER: Error configuring the Manager IP (172.31.18.156)in: ubuntu-20.04 agent[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-19 09:36:17] [INFO] TESTER: Getting status of ubuntu-20.04[0m [31m[2024-04-19 09:36:20] [ERROR] TESTER: The ubuntu-20.04 is not active[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys [31m[2024-04-19 09:36:31] [ERROR] TESTER: agent-linux-ubuntu-2004-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== ______________________________ test_registration _______________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_registration(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > WazuhAgent.register_agent(agent_params, wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:67: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ inventory_path = '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml' manager_path = {'ansible_connection': 'ssh', 'ansible_host': 'ec2-44-223-69-111.compute-1.amazonaws.com', 'ansible_port': 2200, 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322', ...} @staticmethod def register_agent(inventory_path, manager_path): with open(manager_path, 'r') as yaml_file: manager_path = yaml.safe_load(yaml_file) host = manager_path.get('ansible_host') internal_ip = HostInformation.get_internal_ip_from_aws_dns(host) if 'amazonaws' in host else host commands = [ f"sed -i 's/
MANAGER_IP<\/address>/
{internal_ip}<\/address>/g' {WAZUH_CONF}", "systemctl restart wazuh-agent" ] Executor.execute_commands(inventory_path, commands) > assert internal_ip in Executor.execute_command(inventory_path, f'cat {WAZUH_CONF}'), logger.error(f'Error configuring the Manager IP ({internal_ip})in: {HostInformation.get_os_name_and_version_from_inventory(inventory_path)} agent') E AssertionError: None modules/testing/tests/helpers/agent.py:106: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): > assert 'active' in GeneralComponentActions.get_component_status(agent, 'wazuh-agent'), logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} is not active') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_registration.py:72: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' E AssertionError: The agent-linux-ubuntu-2004-amd64 is not present in the master by command E assert 'agent-linux-ubuntu-2004-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_registration.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_registration.py:93: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_registration FAILED modules/testing/tests/test_agent/test_registration.py::test_status - A... FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys ======================== 5 failed, 2 warnings in 29.36s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:31] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:31] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:31] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:31] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:17.345144' end: '2024-04-19 09:36:50.499396' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:33.154252' stderr: |- Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-19 09:36:33] [INFO] TESTER: Checking connection to ubuntu-20.04[0m [32m[2024-04-19 09:36:34] [INFO] TESTER: Connection established successfully in ubuntu-20.04[0m [32m[2024-04-19 09:36:37] [INFO] TESTER: Restarting wazuh-agent in ubuntu-20.04[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-19 09:36:40] [INFO] TESTER: Getting status of ubuntu-20.04[0m [31m[2024-04-19 09:36:43] [ERROR] TESTER: agent-linux-ubuntu-2004-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_connection [31m[2024-04-19 09:36:45] [ERROR] TESTER: agent-linux-ubuntu-2004-amd64 is not present in agent_control information[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive [31m[2024-04-19 09:36:47] [ERROR] TESTER: agent-linux-ubuntu-2004-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys [31m[2024-04-19 09:36:50] [ERROR] TESTER: agent-linux-ubuntu-2004-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert 'active' in GeneralComponentActions.get_component_status(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_restart.py:71: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is not present in agent_control information') E AssertionError: None E assert 'agent-linux-ubuntu-2004-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_restart.py:76: AssertionError ________________________________ test_isActive _________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_restart.py:81: AssertionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_restart.py:86: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_restart.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_restart.py::test_connection - As... FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive - Asse... FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys - As... =================== 4 failed, 1 passed, 2 warnings in 16.96s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:50] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:50] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:50] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:50] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:13.948781' end: '2024-04-19 09:37:05.925500' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:51.976719' stderr: |- Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-19 09:36:52] [INFO] TESTER: Checking connection to ubuntu-20.04[0m [32m[2024-04-19 09:36:53] [INFO] TESTER: Connection established successfully in ubuntu-20.04[0m FAILED[32m[2024-04-19 09:37:02] [INFO] TESTER: Restarting wazuh-agent in ubuntu-20.04[0m =================================== FAILURES =================================== __________________________________ test_stop ___________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_stop(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_stop.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_stop.py::test_stop - requests.ex... ======================== 1 failed, 2 warnings in 13.55s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:06] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:06] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:37:06] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:06] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:16.093925' end: '2024-04-19 09:37:23.439876' msg: non-zero return code rc: 1 start: '2024-04-19 09:37:07.345951' stderr: |- Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-88-185-66.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-19 09:37:07] [INFO] TESTER: Checking connection to ubuntu-20.04[0m [32m[2024-04-19 09:37:09] [INFO] TESTER: Connection established successfully in ubuntu-20.04[0m [31m[2024-04-19 09:37:14] [ERROR] TESTER: agent-linux-ubuntu-2004-amd64 is not Active before the installation[0m FAILED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive FAILED =================================== FAILURES =================================== ________________________________ test_uninstall ________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_uninstall(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not Active before the installation') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_uninstall.py:68: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-ubuntu-2004-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_uninstall.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_uninstall.py::test_uninstall - A... FAILED modules/testing/tests/test_agent/test_uninstall.py::test_isActive - re... =================== 2 failed, 1 passed, 2 warnings in 15.71s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:23] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:23] [INFO] TESTER: Cleaning up [2024-04-19 09:37:23] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:23] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:33] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:37:33] [INFO] TESTER: Cleaning up [2024-04-19 09:37:33] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:33] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:42] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:37:42] [INFO] [65615] [ThreadPoolExecutor-0_10] [workflow_engine]: [run-agent-linux-ubuntu-20.04-amd64-tests] Finished task in 172.31 seconds. [2024-04-19 09:37:45] [DEBUG] [65615] [ThreadPoolExecutor-0_0] [workflow_engine]: Finished task "run-agent-linux-oracle-9-amd64-tests" execution with result: [2024-04-19 09:34:51] [INFO] TESTER: Running tests for ec2-44-223-69-111.compute-1.amazonaws.com [2024-04-19 09:34:51] [INFO] TESTER: Running tests for ec2-18-206-235-39.compute-1.amazonaws.com [2024-04-19 09:34:51] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-18-206-235-39.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-19 09:34:51] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-19 09:34:51] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:51] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-18-206-235-39.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-44-223-69-111.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.006712' end: '2024-04-19 09:34:53.091431' item: ec2-44-223-69-111.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:53.084719' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-18-206-235-39.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.006182' end: '2024-04-19 09:34:53.267917' item: ec2-18-206-235-39.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:53.261735' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:34:53] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-18-206-235-39.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:34:53] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:34:53] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:53] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml}' - --live=True - -s delta: '0:01:17.285308' end: '2024-04-19 09:36:13.048724' msg: non-zero return code rc: 1 start: '2024-04-19 09:34:55.763416' stderr: |- Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Removed "/etc/systemd/system/multi-user.target.wants/firewalld.service". Removed "/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service". Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sed: can't read /home/ubuntu/config.yml: No such file or directory Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-19 09:34:56] [INFO] TESTER: Checking connection to oracle-9[0m [32m[2024-04-19 09:34:57] [INFO] TESTER: Connection established successfully in oracle-9[0m [32m[2024-04-19 09:35:00] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-19 09:35:01] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-19 09:35:09] [INFO] TESTER: Firewall disabled on oracle-9[0m [32m[2024-04-19 09:35:13] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-19 09:35:40] [INFO] TESTER: Installing Manager in ubuntu-22.04[0m [31m[2024-04-19 09:36:05] [ERROR] TESTER: The /var/ossec is not present in ubuntu-22.04[0m FAILED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-19 09:36:05] [INFO] TESTER: Getting status of oracle-9[0m [31m[2024-04-19 09:36:08] [ERROR] TESTER: The oracle-9 status is not loaded[0m FAILED modules/testing/tests/test_agent/test_install.py::test_version [31m[2024-04-19 09:36:10] [ERROR] TESTER: The version oracle-9 is not 4.7.3 by command[0m FAILED modules/testing/tests/test_agent/test_install.py::test_revision [31m[2024-04-19 09:36:12] [ERROR] TESTER: The revision oracle-9 is not 40714 by command[0m FAILED =================================== FAILURES =================================== ______________________________ test_installation _______________________________ wazuh_params = {'agents': {'agent-linux-oracle-9-amd64': '/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_installation(wazuh_params): # Checking connection for manager_name, manager_params in wazuh_params['managers'].items(): Utils.check_inventory_connection(manager_params) # Certs creation, firewall management and Manager installation for agent_name, agent_params in wazuh_params['agents'].items(): HostConfiguration.disable_firewall(agent_params) if HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT): logger.info(f'Manager is already installed in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') else: HostConfiguration.disable_firewall(manager_params) HostConfiguration.certs_create(wazuh_params['wazuh_version'], wazuh_params['master'], wazuh_params['dashboard'], wazuh_params['indexers'], wazuh_params['workers']) WazuhManager.install_manager(wazuh_params['master'], 'wazuh-1', wazuh_params['wazuh_version']) > assert HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml', PosixPath('/var/ossec')) E + where = HostInformation.dir_exists modules/testing/tests/test_agent/test_install.py:81: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-oracle-9-amd64': '/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): agent_status = GeneralComponentActions.get_component_status(agent, 'wazuh-agent') > assert 'loaded' in agent_status, logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} status is not loaded') E AssertionError: None E assert 'loaded' in '' modules/testing/tests/test_agent/test_install.py:95: AssertionError _________________________________ test_version _________________________________ wazuh_params = {'agents': {'agent-linux-oracle-9-amd64': '/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_version(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_version'] in GeneralComponentActions.get_component_version(agent_params), logger.error(f"The version {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_version']} by command") E AssertionError: None E assert '4.7.3' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_version modules/testing/tests/test_agent/test_install.py:100: AssertionError ________________________________ test_revision _________________________________ wazuh_params = {'agents': {'agent-linux-oracle-9-amd64': '/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_revision(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_revision'] in GeneralComponentActions.get_component_revision(agent_params), logger.error(f"The revision {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_revision']} by command") E AssertionError: None E assert '40714' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_revision modules/testing/tests/test_agent/test_install.py:105: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_install.py::test_installation - ... FAILED modules/testing/tests/test_agent/test_install.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_install.py::test_version - Asser... FAILED modules/testing/tests/test_agent/test_install.py::test_revision - Asse... =================== 4 failed, 2 warnings in 76.61s (0:01:16) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:13] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:13] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:13] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:13] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:24.646712' end: '2024-04-19 09:36:39.058330' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:14.411618' stderr: |- Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sed: can't read /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. cat: /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-19 09:36:14] [INFO] TESTER: Checking connection to oracle-9[0m [32m[2024-04-19 09:36:16] [INFO] TESTER: Connection established successfully in oracle-9[0m [31m[2024-04-19 09:36:26] [ERROR] TESTER: Error configuring the Manager IP (172.31.18.156)in: oracle-9 agent[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-19 09:36:26] [INFO] TESTER: Getting status of oracle-9[0m [31m[2024-04-19 09:36:28] [ERROR] TESTER: The oracle-9 is not active[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys [31m[2024-04-19 09:36:38] [ERROR] TESTER: agent-linux-oracle-9-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== ______________________________ test_registration _______________________________ wazuh_params = {'agents': {'agent-linux-oracle-9-amd64': '/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_registration(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > WazuhAgent.register_agent(agent_params, wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:67: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ inventory_path = '/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml' manager_path = {'ansible_connection': 'ssh', 'ansible_host': 'ec2-44-223-69-111.compute-1.amazonaws.com', 'ansible_port': 2200, 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322', ...} @staticmethod def register_agent(inventory_path, manager_path): with open(manager_path, 'r') as yaml_file: manager_path = yaml.safe_load(yaml_file) host = manager_path.get('ansible_host') internal_ip = HostInformation.get_internal_ip_from_aws_dns(host) if 'amazonaws' in host else host commands = [ f"sed -i 's/
MANAGER_IP<\/address>/
{internal_ip}<\/address>/g' {WAZUH_CONF}", "systemctl restart wazuh-agent" ] Executor.execute_commands(inventory_path, commands) > assert internal_ip in Executor.execute_command(inventory_path, f'cat {WAZUH_CONF}'), logger.error(f'Error configuring the Manager IP ({internal_ip})in: {HostInformation.get_os_name_and_version_from_inventory(inventory_path)} agent') E AssertionError: None modules/testing/tests/helpers/agent.py:106: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-oracle-9-amd64': '/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): > assert 'active' in GeneralComponentActions.get_component_status(agent, 'wazuh-agent'), logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} is not active') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_registration.py:72: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-oracle-9-amd64': '/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' E AssertionError: The agent-linux-oracle-9-amd64 is not present in the master by command E assert 'agent-linux-oracle-9-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_registration.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-oracle-9-amd64': '/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-oracle-9-amd64': '/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_registration.py:93: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_registration FAILED modules/testing/tests/test_agent/test_registration.py::test_status - A... FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys ======================== 5 failed, 2 warnings in 24.21s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:39] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:39] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:39] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:39] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:15.744823' end: '2024-04-19 09:36:56.209073' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:40.464250' stderr: |- Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-19 09:36:40] [INFO] TESTER: Checking connection to oracle-9[0m [32m[2024-04-19 09:36:42] [INFO] TESTER: Connection established successfully in oracle-9[0m [32m[2024-04-19 09:36:44] [INFO] TESTER: Restarting wazuh-agent in oracle-9[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-19 09:36:46] [INFO] TESTER: Getting status of oracle-9[0m [31m[2024-04-19 09:36:49] [ERROR] TESTER: agent-linux-oracle-9-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_connection [31m[2024-04-19 09:36:51] [ERROR] TESTER: agent-linux-oracle-9-amd64 is not present in agent_control information[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive [31m[2024-04-19 09:36:53] [ERROR] TESTER: agent-linux-oracle-9-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys [31m[2024-04-19 09:36:56] [ERROR] TESTER: agent-linux-oracle-9-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-oracle-9-amd64': '/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert 'active' in GeneralComponentActions.get_component_status(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_restart.py:71: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-oracle-9-amd64': '/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is not present in agent_control information') E AssertionError: None E assert 'agent-linux-oracle-9-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_restart.py:76: AssertionError ________________________________ test_isActive _________________________________ wazuh_params = {'agents': {'agent-linux-oracle-9-amd64': '/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_restart.py:81: AssertionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-oracle-9-amd64': '/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_restart.py:86: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_restart.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_restart.py::test_connection - As... FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive - Asse... FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys - As... =================== 4 failed, 1 passed, 2 warnings in 15.35s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:56] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:56] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:56] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:56] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:12.889995' end: '2024-04-19 09:37:10.488021' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:57.598026' stderr: |- Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-19 09:36:57] [INFO] TESTER: Checking connection to oracle-9[0m [32m[2024-04-19 09:36:59] [INFO] TESTER: Connection established successfully in oracle-9[0m FAILED[32m[2024-04-19 09:37:08] [INFO] TESTER: Restarting wazuh-agent in oracle-9[0m =================================== FAILURES =================================== __________________________________ test_stop ___________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-oracle-9-amd64': '/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_stop(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_stop.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_stop.py::test_stop - requests.ex... ======================== 1 failed, 2 warnings in 12.52s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:10] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:10] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:37:10] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:10] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:14.747291' end: '2024-04-19 09:37:26.685547' msg: non-zero return code rc: 1 start: '2024-04-19 09:37:11.938256' stderr: |- Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-206-235-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-19 09:37:12] [INFO] TESTER: Checking connection to oracle-9[0m [32m[2024-04-19 09:37:13] [INFO] TESTER: Connection established successfully in oracle-9[0m [31m[2024-04-19 09:37:18] [ERROR] TESTER: agent-linux-oracle-9-amd64 is not Active before the installation[0m FAILED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive FAILED =================================== FAILURES =================================== ________________________________ test_uninstall ________________________________ wazuh_params = {'agents': {'agent-linux-oracle-9-amd64': '/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_uninstall(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not Active before the installation') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_uninstall.py:68: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-oracle-9-amd64': '/tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_uninstall.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_uninstall.py::test_uninstall - A... FAILED modules/testing/tests/test_agent/test_uninstall.py::test_isActive - re... =================== 2 failed, 1 passed, 2 warnings in 14.36s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:26] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-oracle-9-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:26] [INFO] TESTER: Cleaning up [2024-04-19 09:37:26] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:26] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:36] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:37:36] [INFO] TESTER: Cleaning up [2024-04-19 09:37:36] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:36] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:45] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:37:45] [INFO] [65615] [ThreadPoolExecutor-0_0] [workflow_engine]: [run-agent-linux-oracle-9-amd64-tests] Finished task in 175.28 seconds. [2024-04-19 09:37:57] [DEBUG] [65615] [ThreadPoolExecutor-0_6] [workflow_engine]: Finished task "run-agent-linux-redhat-7-amd64-tests" execution with result: [2024-04-19 09:34:51] [INFO] TESTER: Running tests for ec2-44-223-69-111.compute-1.amazonaws.com [2024-04-19 09:34:51] [INFO] TESTER: Running tests for ec2-18-234-64-16.compute-1.amazonaws.com [2024-04-19 09:34:51] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-18-234-64-16.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-19 09:34:51] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-19 09:34:51] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:51] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-18-234-64-16.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-44-223-69-111.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.004921' end: '2024-04-19 09:34:53.081793' item: ec2-44-223-69-111.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:53.076872' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-18-234-64-16.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.006160' end: '2024-04-19 09:34:53.267712' item: ec2-18-234-64-16.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:53.261552' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:34:53] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-18-234-64-16.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:34:53] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:34:53] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:53] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' - --live=True - -s delta: '0:01:32.991258' end: '2024-04-19 09:36:28.631621' msg: non-zero return code rc: 1 start: '2024-04-19 09:34:55.640363' stderr: |- Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-19 09:34:56] [INFO] TESTER: Checking connection to redhat-7[0m [32m[2024-04-19 09:34:58] [INFO] TESTER: Connection established successfully in redhat-7[0m [32m[2024-04-19 09:35:00] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-19 09:35:01] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-19 09:35:04] [INFO] TESTER: No Firewall to disable on redhat-7[0m [32m[2024-04-19 09:35:07] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-19 09:35:37] [INFO] TESTER: Installing Manager in ubuntu-22.04[0m [31m[2024-04-19 09:36:22] [ERROR] TESTER: The /var/ossec is not present in ubuntu-22.04[0m FAILED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-19 09:36:22] [INFO] TESTER: Getting status of redhat-7[0m [31m[2024-04-19 09:36:24] [ERROR] TESTER: The redhat-7 status is not loaded[0m FAILED modules/testing/tests/test_agent/test_install.py::test_version [31m[2024-04-19 09:36:26] [ERROR] TESTER: The version redhat-7 is not 4.7.3 by command[0m FAILED modules/testing/tests/test_agent/test_install.py::test_revision [31m[2024-04-19 09:36:28] [ERROR] TESTER: The revision redhat-7 is not 40714 by command[0m FAILED =================================== FAILURES =================================== ______________________________ test_installation _______________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_installation(wazuh_params): # Checking connection for manager_name, manager_params in wazuh_params['managers'].items(): Utils.check_inventory_connection(manager_params) # Certs creation, firewall management and Manager installation for agent_name, agent_params in wazuh_params['agents'].items(): HostConfiguration.disable_firewall(agent_params) if HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT): logger.info(f'Manager is already installed in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') else: HostConfiguration.disable_firewall(manager_params) HostConfiguration.certs_create(wazuh_params['wazuh_version'], wazuh_params['master'], wazuh_params['dashboard'], wazuh_params['indexers'], wazuh_params['workers']) WazuhManager.install_manager(wazuh_params['master'], 'wazuh-1', wazuh_params['wazuh_version']) > assert HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml', PosixPath('/var/ossec')) E + where = HostInformation.dir_exists modules/testing/tests/test_agent/test_install.py:81: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): agent_status = GeneralComponentActions.get_component_status(agent, 'wazuh-agent') > assert 'loaded' in agent_status, logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} status is not loaded') E AssertionError: None E assert 'loaded' in '' modules/testing/tests/test_agent/test_install.py:95: AssertionError _________________________________ test_version _________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_version(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_version'] in GeneralComponentActions.get_component_version(agent_params), logger.error(f"The version {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_version']} by command") E AssertionError: None E assert '4.7.3' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_version modules/testing/tests/test_agent/test_install.py:100: AssertionError ________________________________ test_revision _________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_revision(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_revision'] in GeneralComponentActions.get_component_revision(agent_params), logger.error(f"The revision {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_revision']} by command") E AssertionError: None E assert '40714' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_revision modules/testing/tests/test_agent/test_install.py:105: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_install.py::test_installation - ... FAILED modules/testing/tests/test_agent/test_install.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_install.py::test_version - Asser... FAILED modules/testing/tests/test_agent/test_install.py::test_revision - Asse... =================== 4 failed, 2 warnings in 92.11s (0:01:32) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:28] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:28] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:28] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:28] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:23.365826' end: '2024-04-19 09:36:53.356406' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:29.990580' stderr: |- Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sed: can't read /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit not found. Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. cat: /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-19 09:36:30] [INFO] TESTER: Checking connection to redhat-7[0m [32m[2024-04-19 09:36:31] [INFO] TESTER: Connection established successfully in redhat-7[0m [31m[2024-04-19 09:36:41] [ERROR] TESTER: Error configuring the Manager IP (172.31.18.156)in: redhat-7 agent[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-19 09:36:41] [INFO] TESTER: Getting status of redhat-7[0m [31m[2024-04-19 09:36:43] [ERROR] TESTER: The redhat-7 is not active[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys [31m[2024-04-19 09:36:53] [ERROR] TESTER: agent-linux-redhat-7-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== ______________________________ test_registration _______________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_registration(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > WazuhAgent.register_agent(agent_params, wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:67: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ inventory_path = '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml' manager_path = {'ansible_connection': 'ssh', 'ansible_host': 'ec2-44-223-69-111.compute-1.amazonaws.com', 'ansible_port': 2200, 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322', ...} @staticmethod def register_agent(inventory_path, manager_path): with open(manager_path, 'r') as yaml_file: manager_path = yaml.safe_load(yaml_file) host = manager_path.get('ansible_host') internal_ip = HostInformation.get_internal_ip_from_aws_dns(host) if 'amazonaws' in host else host commands = [ f"sed -i 's/
MANAGER_IP<\/address>/
{internal_ip}<\/address>/g' {WAZUH_CONF}", "systemctl restart wazuh-agent" ] Executor.execute_commands(inventory_path, commands) > assert internal_ip in Executor.execute_command(inventory_path, f'cat {WAZUH_CONF}'), logger.error(f'Error configuring the Manager IP ({internal_ip})in: {HostInformation.get_os_name_and_version_from_inventory(inventory_path)} agent') E AssertionError: None modules/testing/tests/helpers/agent.py:106: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): > assert 'active' in GeneralComponentActions.get_component_status(agent, 'wazuh-agent'), logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} is not active') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_registration.py:72: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' E AssertionError: The agent-linux-redhat-7-amd64 is not present in the master by command E assert 'agent-linux-redhat-7-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_registration.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_registration.py:93: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_registration FAILED modules/testing/tests/test_agent/test_registration.py::test_status - A... FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys ======================== 5 failed, 2 warnings in 22.95s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:53] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:53] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:53] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:53] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:14.572832' end: '2024-04-19 09:37:09.343550' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:54.770718' stderr: |- Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit not found. Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-19 09:36:55] [INFO] TESTER: Checking connection to redhat-7[0m [32m[2024-04-19 09:36:56] [INFO] TESTER: Connection established successfully in redhat-7[0m [32m[2024-04-19 09:36:58] [INFO] TESTER: Restarting wazuh-agent in redhat-7[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-19 09:37:00] [INFO] TESTER: Getting status of redhat-7[0m [31m[2024-04-19 09:37:03] [ERROR] TESTER: agent-linux-redhat-7-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_connection [31m[2024-04-19 09:37:05] [ERROR] TESTER: agent-linux-redhat-7-amd64 is not present in agent_control information[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive [31m[2024-04-19 09:37:07] [ERROR] TESTER: agent-linux-redhat-7-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys [31m[2024-04-19 09:37:09] [ERROR] TESTER: agent-linux-redhat-7-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert 'active' in GeneralComponentActions.get_component_status(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_restart.py:71: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is not present in agent_control information') E AssertionError: None E assert 'agent-linux-redhat-7-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_restart.py:76: AssertionError ________________________________ test_isActive _________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_restart.py:81: AssertionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_restart.py:86: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_restart.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_restart.py::test_connection - As... FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive - Asse... FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys - As... =================== 4 failed, 1 passed, 2 warnings in 14.17s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:09] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:09] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:37:09] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:09] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:11.981795' end: '2024-04-19 09:37:22.717871' msg: non-zero return code rc: 1 start: '2024-04-19 09:37:10.736076' stderr: |- Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit not found. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-19 09:37:11] [INFO] TESTER: Checking connection to redhat-7[0m [32m[2024-04-19 09:37:12] [INFO] TESTER: Connection established successfully in redhat-7[0m FAILED[32m[2024-04-19 09:37:20] [INFO] TESTER: Restarting wazuh-agent in redhat-7[0m =================================== FAILURES =================================== __________________________________ test_stop ___________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_stop(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_stop.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_stop.py::test_stop - requests.ex... ======================== 1 failed, 2 warnings in 11.59s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:22] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:22] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:37:22] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:22] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:14.066614' end: '2024-04-19 09:37:38.187551' msg: non-zero return code rc: 1 start: '2024-04-19 09:37:24.120937' stderr: |- Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-18-234-64-16.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-19 09:37:24] [INFO] TESTER: Checking connection to redhat-7[0m [32m[2024-04-19 09:37:25] [INFO] TESTER: Connection established successfully in redhat-7[0m [31m[2024-04-19 09:37:30] [ERROR] TESTER: agent-linux-redhat-7-amd64 is not Active before the installation[0m FAILED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive FAILED =================================== FAILURES =================================== ________________________________ test_uninstall ________________________________ wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_uninstall(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not Active before the installation') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_uninstall.py:68: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-redhat-7-amd64': '/tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml'}, 'dashboard': '/t...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_uninstall.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_uninstall.py::test_uninstall - A... FAILED modules/testing/tests/test_agent/test_uninstall.py::test_isActive - re... =================== 2 failed, 1 passed, 2 warnings in 13.69s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:38] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-redhat-7-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:38] [INFO] TESTER: Cleaning up [2024-04-19 09:37:38] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:38] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:47] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:37:47] [INFO] TESTER: Cleaning up [2024-04-19 09:37:47] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:47] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:57] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:37:57] [INFO] [65615] [ThreadPoolExecutor-0_6] [workflow_engine]: [run-agent-linux-redhat-7-amd64-tests] Finished task in 186.96 seconds. [2024-04-19 09:38:10] [DEBUG] [65615] [ThreadPoolExecutor-0_1] [workflow_engine]: Finished task "run-agent-linux-ubuntu-18.04-amd64-tests" execution with result: [2024-04-19 09:34:50] [INFO] TESTER: Running tests for ec2-44-223-69-111.compute-1.amazonaws.com [2024-04-19 09:34:50] [INFO] TESTER: Running tests for ec2-3-80-226-171.compute-1.amazonaws.com [2024-04-19 09:34:50] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-3-80-226-171.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-19 09:34:50] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-19 09:34:50] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:50] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-3-80-226-171.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-44-223-69-111.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.004722' end: '2024-04-19 09:34:52.528655' item: ec2-44-223-69-111.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:52.523933' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-3-80-226-171.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.005378' end: '2024-04-19 09:34:52.661102' item: ec2-3-80-226-171.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:52.655724' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:34:52] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-3-80-226-171.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:34:52] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:34:52] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:52] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:01:36.991119' end: '2024-04-19 09:36:31.819599' msg: non-zero return code rc: 1 start: '2024-04-19 09:34:54.828480' stderr: |- Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-19 09:34:55] [INFO] TESTER: Checking connection to ubuntu-18.04[0m [32m[2024-04-19 09:34:57] [INFO] TESTER: Connection established successfully in ubuntu-18.04[0m [32m[2024-04-19 09:34:59] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-19 09:35:00] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-19 09:35:04] [INFO] TESTER: No Firewall to disable on ubuntu-18.04[0m [32m[2024-04-19 09:35:08] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-19 09:35:38] [INFO] TESTER: Installing Manager in ubuntu-22.04[0m [31m[2024-04-19 09:36:23] [ERROR] TESTER: The /var/ossec is not present in ubuntu-22.04[0m FAILED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-19 09:36:23] [INFO] TESTER: Getting status of ubuntu-18.04[0m [31m[2024-04-19 09:36:26] [ERROR] TESTER: The ubuntu-18.04 status is not loaded[0m FAILED modules/testing/tests/test_agent/test_install.py::test_version [31m[2024-04-19 09:36:28] [ERROR] TESTER: The version ubuntu-18.04 is not 4.7.3 by command[0m FAILED modules/testing/tests/test_agent/test_install.py::test_revision [31m[2024-04-19 09:36:31] [ERROR] TESTER: The revision ubuntu-18.04 is not 40714 by command[0m FAILED =================================== FAILURES =================================== ______________________________ test_installation _______________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_installation(wazuh_params): # Checking connection for manager_name, manager_params in wazuh_params['managers'].items(): Utils.check_inventory_connection(manager_params) # Certs creation, firewall management and Manager installation for agent_name, agent_params in wazuh_params['agents'].items(): HostConfiguration.disable_firewall(agent_params) if HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT): logger.info(f'Manager is already installed in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') else: HostConfiguration.disable_firewall(manager_params) HostConfiguration.certs_create(wazuh_params['wazuh_version'], wazuh_params['master'], wazuh_params['dashboard'], wazuh_params['indexers'], wazuh_params['workers']) WazuhManager.install_manager(wazuh_params['master'], 'wazuh-1', wazuh_params['wazuh_version']) > assert HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml', PosixPath('/var/ossec')) E + where = HostInformation.dir_exists modules/testing/tests/test_agent/test_install.py:81: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): agent_status = GeneralComponentActions.get_component_status(agent, 'wazuh-agent') > assert 'loaded' in agent_status, logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} status is not loaded') E AssertionError: None E assert 'loaded' in '' modules/testing/tests/test_agent/test_install.py:95: AssertionError _________________________________ test_version _________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_version(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_version'] in GeneralComponentActions.get_component_version(agent_params), logger.error(f"The version {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_version']} by command") E AssertionError: None E assert '4.7.3' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_version modules/testing/tests/test_agent/test_install.py:100: AssertionError ________________________________ test_revision _________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_revision(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_revision'] in GeneralComponentActions.get_component_revision(agent_params), logger.error(f"The revision {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_revision']} by command") E AssertionError: None E assert '40714' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_revision modules/testing/tests/test_agent/test_install.py:105: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_install.py::test_installation - ... FAILED modules/testing/tests/test_agent/test_install.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_install.py::test_version - Asser... FAILED modules/testing/tests/test_agent/test_install.py::test_revision - Asse... =================== 4 failed, 2 warnings in 96.11s (0:01:36) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:36:31] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:36:31] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:36:31] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:36:31] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:27.425395' end: '2024-04-19 09:37:00.625782' msg: non-zero return code rc: 1 start: '2024-04-19 09:36:33.200387' stderr: |- Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sed: can't read /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. cat: /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-19 09:36:33] [INFO] TESTER: Checking connection to ubuntu-18.04[0m [32m[2024-04-19 09:36:34] [INFO] TESTER: Connection established successfully in ubuntu-18.04[0m [31m[2024-04-19 09:36:46] [ERROR] TESTER: Error configuring the Manager IP (172.31.18.156)in: ubuntu-18.04 agent[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-19 09:36:46] [INFO] TESTER: Getting status of ubuntu-18.04[0m [31m[2024-04-19 09:36:49] [ERROR] TESTER: The ubuntu-18.04 is not active[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys [31m[2024-04-19 09:37:00] [ERROR] TESTER: agent-linux-ubuntu-1804-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== ______________________________ test_registration _______________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_registration(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > WazuhAgent.register_agent(agent_params, wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:67: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ inventory_path = '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml' manager_path = {'ansible_connection': 'ssh', 'ansible_host': 'ec2-44-223-69-111.compute-1.amazonaws.com', 'ansible_port': 2200, 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322', ...} @staticmethod def register_agent(inventory_path, manager_path): with open(manager_path, 'r') as yaml_file: manager_path = yaml.safe_load(yaml_file) host = manager_path.get('ansible_host') internal_ip = HostInformation.get_internal_ip_from_aws_dns(host) if 'amazonaws' in host else host commands = [ f"sed -i 's/
MANAGER_IP<\/address>/
{internal_ip}<\/address>/g' {WAZUH_CONF}", "systemctl restart wazuh-agent" ] Executor.execute_commands(inventory_path, commands) > assert internal_ip in Executor.execute_command(inventory_path, f'cat {WAZUH_CONF}'), logger.error(f'Error configuring the Manager IP ({internal_ip})in: {HostInformation.get_os_name_and_version_from_inventory(inventory_path)} agent') E AssertionError: None modules/testing/tests/helpers/agent.py:106: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): > assert 'active' in GeneralComponentActions.get_component_status(agent, 'wazuh-agent'), logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} is not active') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_registration.py:72: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' E AssertionError: The agent-linux-ubuntu-1804-amd64 is not present in the master by command E assert 'agent-linux-ubuntu-1804-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_registration.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_registration.py:93: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_registration FAILED modules/testing/tests/test_agent/test_registration.py::test_status - A... FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys ======================== 5 failed, 2 warnings in 27.00s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:00] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:00] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:37:00] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:00] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:16.897751' end: '2024-04-19 09:37:18.914648' msg: non-zero return code rc: 1 start: '2024-04-19 09:37:02.016897' stderr: |- Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-19 09:37:02] [INFO] TESTER: Checking connection to ubuntu-18.04[0m [32m[2024-04-19 09:37:03] [INFO] TESTER: Connection established successfully in ubuntu-18.04[0m [32m[2024-04-19 09:37:06] [INFO] TESTER: Restarting wazuh-agent in ubuntu-18.04[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-19 09:37:09] [INFO] TESTER: Getting status of ubuntu-18.04[0m [31m[2024-04-19 09:37:11] [ERROR] TESTER: agent-linux-ubuntu-1804-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_connection [31m[2024-04-19 09:37:13] [ERROR] TESTER: agent-linux-ubuntu-1804-amd64 is not present in agent_control information[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive [31m[2024-04-19 09:37:16] [ERROR] TESTER: agent-linux-ubuntu-1804-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys [31m[2024-04-19 09:37:18] [ERROR] TESTER: agent-linux-ubuntu-1804-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert 'active' in GeneralComponentActions.get_component_status(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_restart.py:71: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is not present in agent_control information') E AssertionError: None E assert 'agent-linux-ubuntu-1804-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_restart.py:76: AssertionError ________________________________ test_isActive _________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_restart.py:81: AssertionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_restart.py:86: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_restart.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_restart.py::test_connection - As... FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive - Asse... FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys - As... =================== 4 failed, 1 passed, 2 warnings in 16.50s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:19] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:19] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:37:19] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:19] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:13.068948' end: '2024-04-19 09:37:33.371409' msg: non-zero return code rc: 1 start: '2024-04-19 09:37:20.302461' stderr: |- Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-19 09:37:20] [INFO] TESTER: Checking connection to ubuntu-18.04[0m [32m[2024-04-19 09:37:21] [INFO] TESTER: Connection established successfully in ubuntu-18.04[0m FAILED[32m[2024-04-19 09:37:30] [INFO] TESTER: Restarting wazuh-agent in ubuntu-18.04[0m =================================== FAILURES =================================== __________________________________ test_stop ___________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_stop(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_stop.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_stop.py::test_stop - requests.ex... ======================== 1 failed, 2 warnings in 12.68s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:33] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:33] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:37:33] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:33] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:15.392696' end: '2024-04-19 09:37:50.157170' msg: non-zero return code rc: 1 start: '2024-04-19 09:37:34.764474' stderr: |- Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-3-80-226-171.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-19 09:37:35] [INFO] TESTER: Checking connection to ubuntu-18.04[0m [32m[2024-04-19 09:37:36] [INFO] TESTER: Connection established successfully in ubuntu-18.04[0m [31m[2024-04-19 09:37:41] [ERROR] TESTER: agent-linux-ubuntu-1804-amd64 is not Active before the installation[0m FAILED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive FAILED =================================== FAILURES =================================== ________________________________ test_uninstall ________________________________ wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_uninstall(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not Active before the installation') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_uninstall.py:68: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-ubuntu-1804-amd64': '/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml'}, 'dashboar...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_uninstall.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_uninstall.py::test_uninstall - A... FAILED modules/testing/tests/test_agent/test_uninstall.py::test_isActive - re... =================== 2 failed, 1 passed, 2 warnings in 15.02s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:50] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:50] [INFO] TESTER: Cleaning up [2024-04-19 09:37:50] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:50] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:38:00] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:38:00] [INFO] TESTER: Cleaning up [2024-04-19 09:38:00] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:38:00] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:38:10] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:38:10] [INFO] [65615] [ThreadPoolExecutor-0_1] [workflow_engine]: [run-agent-linux-ubuntu-18.04-amd64-tests] Finished task in 199.91 seconds. [2024-04-19 09:38:31] [DEBUG] [65615] [ThreadPoolExecutor-0_3] [workflow_engine]: Finished task "run-agent-linux-debian-10-amd64-tests" execution with result: [2024-04-19 09:34:50] [INFO] TESTER: Running tests for ec2-44-223-69-111.compute-1.amazonaws.com [2024-04-19 09:34:50] [INFO] TESTER: Running tests for ec2-44-223-54-39.compute-1.amazonaws.com [2024-04-19 09:34:50] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-44-223-54-39.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-19 09:34:50] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-19 09:34:50] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:50] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-44-223-54-39.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-44-223-69-111.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.006075' end: '2024-04-19 09:34:52.703156' item: ec2-44-223-69-111.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:52.697081' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-44-223-54-39.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.005790' end: '2024-04-19 09:34:52.863729' item: ec2-44-223-54-39.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:52.857939' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:34:53] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-44-223-54-39.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:34:53] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:34:53] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:53] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' - --live=True - -s delta: '0:02:05.932278' end: '2024-04-19 09:37:00.836754' msg: non-zero return code rc: 1 start: '2024-04-19 09:34:54.904476' stderr: |- Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: /var/ossec/bin/wazuh-control: command not found stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-19 09:34:55] [INFO] TESTER: Checking connection to debian-10[0m [32m[2024-04-19 09:34:57] [INFO] TESTER: Connection established successfully in debian-10[0m [32m[2024-04-19 09:34:59] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-19 09:35:00] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-19 09:35:02] [INFO] TESTER: No Firewall to disable on debian-10[0m [32m[2024-04-19 09:35:06] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-19 09:35:37] [INFO] TESTER: Installing Manager in ubuntu-22.04[0m [31m[2024-04-19 09:36:54] [ERROR] TESTER: The /var/ossec is not present in ubuntu-22.04[0m FAILED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-19 09:36:54] [INFO] TESTER: Getting status of debian-10[0m [31m[2024-04-19 09:36:56] [ERROR] TESTER: The debian-10 status is not loaded[0m FAILED modules/testing/tests/test_agent/test_install.py::test_version [31m[2024-04-19 09:36:58] [ERROR] TESTER: The version debian-10 is not 4.7.3 by command[0m FAILED modules/testing/tests/test_agent/test_install.py::test_revision [31m[2024-04-19 09:37:00] [ERROR] TESTER: The revision debian-10 is not 40714 by command[0m FAILED =================================== FAILURES =================================== ______________________________ test_installation _______________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_installation(wazuh_params): # Checking connection for manager_name, manager_params in wazuh_params['managers'].items(): Utils.check_inventory_connection(manager_params) # Certs creation, firewall management and Manager installation for agent_name, agent_params in wazuh_params['agents'].items(): HostConfiguration.disable_firewall(agent_params) if HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT): logger.info(f'Manager is already installed in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') else: HostConfiguration.disable_firewall(manager_params) HostConfiguration.certs_create(wazuh_params['wazuh_version'], wazuh_params['master'], wazuh_params['dashboard'], wazuh_params['indexers'], wazuh_params['workers']) WazuhManager.install_manager(wazuh_params['master'], 'wazuh-1', wazuh_params['wazuh_version']) > assert HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml', PosixPath('/var/ossec')) E + where = HostInformation.dir_exists modules/testing/tests/test_agent/test_install.py:81: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): agent_status = GeneralComponentActions.get_component_status(agent, 'wazuh-agent') > assert 'loaded' in agent_status, logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} status is not loaded') E AssertionError: None E assert 'loaded' in '' modules/testing/tests/test_agent/test_install.py:95: AssertionError _________________________________ test_version _________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_version(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_version'] in GeneralComponentActions.get_component_version(agent_params), logger.error(f"The version {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_version']} by command") E AssertionError: None E assert '4.7.3' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_version modules/testing/tests/test_agent/test_install.py:100: AssertionError ________________________________ test_revision _________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_revision(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert wazuh_params['wazuh_revision'] in GeneralComponentActions.get_component_revision(agent_params), logger.error(f"The revision {HostInformation.get_os_name_and_version_from_inventory(agent_params)} is not {wazuh_params['wazuh_revision']} by command") E AssertionError: None E assert '40714' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml') E + where = GeneralComponentActions.get_component_revision modules/testing/tests/test_agent/test_install.py:105: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_install.py::test_installation - ... FAILED modules/testing/tests/test_agent/test_install.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_install.py::test_version - Asser... FAILED modules/testing/tests/test_agent/test_install.py::test_revision - Asse... ================== 4 failed, 2 warnings in 125.07s (0:02:05) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:00] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:00] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:37:00] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:00] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:22.769937' end: '2024-04-19 09:37:24.985570' msg: non-zero return code rc: 1 start: '2024-04-19 09:37:02.215633' stderr: |- Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sed: can't read /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. cat: /var/ossec/etc/ossec.conf: No such file or directory Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-19 09:37:02] [INFO] TESTER: Checking connection to debian-10[0m [32m[2024-04-19 09:37:03] [INFO] TESTER: Connection established successfully in debian-10[0m [31m[2024-04-19 09:37:12] [ERROR] TESTER: Error configuring the Manager IP (172.31.18.156)in: debian-10 agent[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-19 09:37:12] [INFO] TESTER: Getting status of debian-10[0m [31m[2024-04-19 09:37:14] [ERROR] TESTER: The debian-10 is not active[0m FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys [31m[2024-04-19 09:37:24] [ERROR] TESTER: agent-linux-debian-10-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== ______________________________ test_registration _______________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_registration(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > WazuhAgent.register_agent(agent_params, wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:67: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ inventory_path = '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml' manager_path = {'ansible_connection': 'ssh', 'ansible_host': 'ec2-44-223-69-111.compute-1.amazonaws.com', 'ansible_port': 2200, 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322', ...} @staticmethod def register_agent(inventory_path, manager_path): with open(manager_path, 'r') as yaml_file: manager_path = yaml.safe_load(yaml_file) host = manager_path.get('ansible_host') internal_ip = HostInformation.get_internal_ip_from_aws_dns(host) if 'amazonaws' in host else host commands = [ f"sed -i 's/
MANAGER_IP<\/address>/
{internal_ip}<\/address>/g' {WAZUH_CONF}", "systemctl restart wazuh-agent" ] Executor.execute_commands(inventory_path, commands) > assert internal_ip in Executor.execute_command(inventory_path, f'cat {WAZUH_CONF}'), logger.error(f'Error configuring the Manager IP ({internal_ip})in: {HostInformation.get_os_name_and_version_from_inventory(inventory_path)} agent') E AssertionError: None modules/testing/tests/helpers/agent.py:106: AssertionError _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent in wazuh_params['agents'].values(): > assert 'active' in GeneralComponentActions.get_component_status(agent, 'wazuh-agent'), logger.error(f'The {HostInformation.get_os_name_and_version_from_inventory(agent)} is not active') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_registration.py:72: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), f'The {agent_names} is not present in the master by command' E AssertionError: The agent-linux-debian-10-amd64 is not present in the master by command E assert 'agent-linux-debian-10-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_registration.py:77: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_registration.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_registration.py:93: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_registration.py::test_registration FAILED modules/testing/tests/test_agent/test_registration.py::test_status - A... FAILED modules/testing/tests/test_agent/test_registration.py::test_connection FAILED modules/testing/tests/test_agent/test_registration.py::test_isActive FAILED modules/testing/tests/test_agent/test_registration.py::test_clientKeys ======================== 5 failed, 2 warnings in 22.35s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:25] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:25] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:37:25] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:25] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:13.509235' end: '2024-04-19 09:37:39.870942' msg: non-zero return code rc: 1 start: '2024-04-19 09:37:26.361707' stderr: |- Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Unit wazuh-agent.service could not be found. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-19 09:37:26] [INFO] TESTER: Checking connection to debian-10[0m [32m[2024-04-19 09:37:28] [INFO] TESTER: Connection established successfully in debian-10[0m [32m[2024-04-19 09:37:29] [INFO] TESTER: Restarting wazuh-agent in debian-10[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-19 09:37:31] [INFO] TESTER: Getting status of debian-10[0m [31m[2024-04-19 09:37:33] [ERROR] TESTER: agent-linux-debian-10-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_connection [31m[2024-04-19 09:37:35] [ERROR] TESTER: agent-linux-debian-10-amd64 is not present in agent_control information[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive [31m[2024-04-19 09:37:37] [ERROR] TESTER: agent-linux-debian-10-amd64 is not active by command[0m FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys [31m[2024-04-19 09:37:39] [ERROR] TESTER: agent-linux-debian-10-amd64 has not ClientKeys file[0m FAILED =================================== FAILURES =================================== _________________________________ test_status __________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_status(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert 'active' in GeneralComponentActions.get_component_status(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert 'active' in '' E + where '' = ('/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.get_component_status modules/testing/tests/test_agent/test_restart.py:71: AssertionError _______________________________ test_connection ________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_connection(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert agent_names in WazuhManager.get_agent_control_info(wazuh_params['master']), logger.error(f'{agent_names} is not present in agent_control information') E AssertionError: None E assert 'agent-linux-debian-10-amd64' in '' E + where '' = ('/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml') E + where = WazuhManager.get_agent_control_info modules/testing/tests/test_agent/test_restart.py:76: AssertionError ________________________________ test_isActive _________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not active by command') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_restart.py:81: AssertionError _______________________________ test_clientKeys ________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_clientKeys(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.hasAgentClientKeys(agent_params), logger.error(f'{agent_names} has not ClientKeys file') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml') E + where = GeneralComponentActions.hasAgentClientKeys modules/testing/tests/test_agent/test_restart.py:86: AssertionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_restart.py::test_status - Assert... FAILED modules/testing/tests/test_agent/test_restart.py::test_connection - As... FAILED modules/testing/tests/test_agent/test_restart.py::test_isActive - Asse... FAILED modules/testing/tests/test_agent/test_restart.py::test_clientKeys - As... =================== 4 failed, 1 passed, 2 warnings in 13.11s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:40] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:40] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:37:40] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:40] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:12.187741' end: '2024-04-19 09:37:53.409440' msg: non-zero return code rc: 1 start: '2024-04-19 09:37:41.221699' stderr: |- Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to restart wazuh-agent.service: Unit wazuh-agent.service not found. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-19 09:37:41] [INFO] TESTER: Checking connection to debian-10[0m [32m[2024-04-19 09:37:42] [INFO] TESTER: Connection established successfully in debian-10[0m FAILED[32m[2024-04-19 09:37:51] [INFO] TESTER: Restarting wazuh-agent in debian-10[0m =================================== FAILURES =================================== __________________________________ test_stop ___________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_stop(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_stop.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_stop.py::test_stop - requests.ex... ======================== 1 failed, 2 warnings in 11.81s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:53] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:37:53] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:37:53] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:53] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ fatal: [localhost]: FAILED! => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:14.265098' end: '2024-04-19 09:38:09.041190' msg: non-zero return code rc: 1 start: '2024-04-19 09:37:54.776092' stderr: |- Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-54-39.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-19 09:37:55] [INFO] TESTER: Checking connection to debian-10[0m [32m[2024-04-19 09:37:56] [INFO] TESTER: Connection established successfully in debian-10[0m [31m[2024-04-19 09:38:00] [ERROR] TESTER: agent-linux-debian-10-amd64 is not Active before the installation[0m FAILED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive FAILED =================================== FAILURES =================================== ________________________________ test_uninstall ________________________________ wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_uninstall(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): > assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent'), logger.error(f'{agent_names} is not Active before the installation') E AssertionError: None E assert False E + where False = ('/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml', 'wazuh-agent') E + where = GeneralComponentActions.isComponentActive modules/testing/tests/test_agent/test_uninstall.py:68: AssertionError ________________________________ test_isActive _________________________________ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: > sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:203: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:85: in create_connection raise err _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('ec2-44-223-69-111.compute-1.amazonaws.com', 55000), timeout = None source_address = None, socket_options = [(6, 1, 1)] def create_connection( address: tuple[str, int], timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, source_address: tuple[str, int] | None = None, socket_options: _TYPE_SOCKET_OPTIONS | None = None, ) -> socket.socket: """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`socket.getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. """ host, port = address if host.startswith("["): host = host.strip("[]") err = None # Using the value from allowed_gai_family() in the context of getaddrinfo lets # us select whether to work with IPv4 DNS records, IPv6 records, or both. # The original create_connection function always returns all records. family = allowed_gai_family() try: host.encode("idna") except UnicodeError: raise LocationParseError(f"'{host}', label empty or too long") from None for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket.socket(af, socktype, proto) # If provided, set socket level options before connecting. _set_socket_options(sock, socket_options) if timeout is not _DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError The above exception was the direct cause of the following exception: self = method = 'POST', url = '/security/user/authenticate', body = None headers = {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-aliv...pplication/json', 'Authorization': 'Basic d2F6dWg6U3FlRyt5alVYRmxvN3pjS3RmS01VazdsdHJXY3VEYj8=', 'Content-Length': '0'} retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) redirect = False, assert_same_host = False timeout = Timeout(connect=None, read=None, total=None), pool_timeout = None release_conn = False, chunked = False, body_pos = None, preload_content = False decode_content = False, response_kw = {} parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/security/user/authenticate', query=None, fragment=None) destination_scheme = None, conn = None, release_this_conn = True http_tunnel_required = False, err = None, clean_exit = False def urlopen( # type: ignore[override] self, method: str, url: str, body: _TYPE_BODY | None = None, headers: typing.Mapping[str, str] | None = None, retries: Retry | bool | int | None = None, redirect: bool = True, assert_same_host: bool = True, timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, pool_timeout: int | None = None, release_conn: bool | None = None, chunked: bool = False, body_pos: _TYPE_BODY_POSITION | None = None, preload_content: bool = True, decode_content: bool = True, **response_kw: typing.Any, ) -> BaseHTTPResponse: """ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param bool preload_content: If True, the response's body will be preloaded into memory. :param bool decode_content: If True, will attempt to decode the body based on the 'content-encoding' header. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``preload_content`` which defaults to ``True``. :param bool chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. """ parsed_url = parse_url(url) destination_scheme = parsed_url.scheme if headers is None: headers = self.headers if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect, default=self.retries) if release_conn is None: release_conn = preload_content # Check host if assert_same_host and not self.is_same_host(url): raise HostChangedError(self, url, retries) # Ensure that the URL we're connecting to is properly encoded if url.startswith("/"): url = to_str(_encode_target(url)) else: url = to_str(parsed_url.url) conn = None # Track whether `conn` needs to be released before # returning/raising/recursing. Update this variable if necessary, and # leave `release_conn` constant throughout the function. That way, if # the function recurses, the original value of `release_conn` will be # passed down into the recursive call, and its value will be respected. # # See issue #651 [1] for details. # # [1] release_this_conn = release_conn http_tunnel_required = connection_requires_http_tunnel( self.proxy, self.proxy_config, destination_scheme ) # Merge the proxy headers. Only done when not using HTTP CONNECT. We # have to copy the headers dict so we can safely change it without those # changes being reflected in anyone else's copy. if not http_tunnel_required: headers = headers.copy() # type: ignore[attr-defined] headers.update(self.proxy_headers) # type: ignore[union-attr] # Must keep the exception bound to a separate variable or else Python 3 # complains about UnboundLocalError. err = None # Keep track of whether we cleanly exited the except block. This # ensures we do proper cleanup in finally. clean_exit = False # Rewind body position, if needed. Record current position # for future rewinds in the event of a redirect/retry. body_pos = set_file_position(body, body_pos) try: # Request a connection from the queue. timeout_obj = self._get_timeout(timeout) conn = self._get_conn(timeout=pool_timeout) conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] # Is this a closed/new connection that requires CONNECT tunnelling? if self.proxy is not None and http_tunnel_required and conn.is_closed: try: self._prepare_proxy(conn) except (BaseSSLError, OSError, SocketTimeout) as e: self._raise_timeout( err=e, url=self.proxy.url, timeout_value=conn.timeout ) raise # If we're going to release the connection in ``finally:``, then # the response doesn't need to know about the connection. Otherwise # it will also try to release it and we'll have a double-release # mess. response_conn = conn if not release_conn else None # Make the request on the HTTPConnection object > response = self._make_request( conn, method, url, timeout=timeout_obj, body=body, headers=headers, chunked=chunked, retries=retries, response_conn=response_conn, preload_content=preload_content, decode_content=decode_content, **response_kw, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:791: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:492: in _make_request raise new_e ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:468: in _make_request self._validate_conn(conn) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:1097: in _validate_conn conn.connect() ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:611: in connect self.sock = sock = self._new_conn() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def _new_conn(self) -> socket.socket: """Establish a socket connection and set nodelay settings on it. :return: New socket connection. """ try: sock = connection.create_connection( (self._dns_host, self.port), self.timeout, source_address=self.source_address, socket_options=self.socket_options, ) except socket.gaierror as e: raise NameResolutionError(self.host, self, e) from e except SocketTimeout as e: raise ConnectTimeoutError( self, f"Connection to {self.host} timed out. (connect timeout={self.timeout})", ) from e except OSError as e: > raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connection.py:218: NewConnectionError The above exception was the direct cause of the following exception: self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: > resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/connectionpool.py:845: in urlopen retries = retries.increment( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Retry(total=0, connect=None, read=False, redirect=None, status=None) method = 'POST', url = '/security/user/authenticate', response = None error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') _pool = _stacktrace = def increment( self, method: str | None = None, url: str | None = None, response: BaseHTTPResponse | None = None, error: Exception | None = None, _pool: ConnectionPool | None = None, _stacktrace: TracebackType | None = None, ) -> Retry: """Return a new Retry object with incremented retry counters. :param response: A response object, or None, if the server did not return a response. :type response: :class:`~urllib3.response.BaseHTTPResponse` :param Exception error: An error encountered during the request, or None if the response was received successfully. :return: A new ``Retry`` object. """ if self.total is False and error: # Disabled, indicate to re-raise the error. raise reraise(type(error), error, _stacktrace) total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect status_count = self.status other = self.other cause = "unknown" status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 elif error and self._is_read_error(error): # Read retry? if read is False or method is None or not self._is_method_retryable(method): raise reraise(type(error), error, _stacktrace) elif read is not None: read -= 1 elif error: # Other retry? if other is not None: other -= 1 elif response and response.get_redirect_location(): # Redirect retry? if redirect is not None: redirect -= 1 cause = "too many redirects" response_redirect_location = response.get_redirect_location() if response_redirect_location: redirect_location = response_redirect_location status = response.status else: # Incrementing because of a server error like a 500 in # status_forcelist and the given method is in the allowed_methods cause = ResponseError.GENERIC_ERROR if response and response.status: if status_count is not None: status_count -= 1 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) status = response.status history = self.history + ( RequestHistory(method, url, error, status, redirect_location), ) new_retry = self.new( total=total, connect=connect, read=read, redirect=redirect, status=status_count, other=other, history=history, ) if new_retry.is_exhausted(): reason = error or ResponseError(cause) > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/urllib3/util/retry.py:515: MaxRetryError During handling of the above exception, another exception occurred: wazuh_params = {'agents': {'agent-linux-debian-10-amd64': '/tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml'}, 'dashboard': '...entory.yaml', 'dependencies': '{}', 'indexers': ['/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml'], ...} def test_isActive(wazuh_params): > wazuh_api = WazuhAPI(wazuh_params['master']) modules/testing/tests/test_agent/test_uninstall.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ modules/testing/tests/helpers/executor.py:58: in __init__ self._authenticate() modules/testing/tests/helpers/executor.py:81: in _authenticate token = json.loads(requests.post(login_url, headers=login_headers, verify=False).content.decode())['data']['token'] ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:115: in post return request("post", url, data=data, json=json, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/api.py:59: in request return session.request(method=method, url=url, **kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:589: in request resp = self.send(prep, **send_kwargs) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/sessions.py:703: in send r = adapter.send(request, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , stream = False timeout = Timeout(connect=None, read=None, total=None), verify = False cert = None, proxies = OrderedDict() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection(request.url, proxies) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) > raise ConnectionError(e, request=request) E requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ec2-44-223-69-111.compute-1.amazonaws.com', port=55000): Max retries exceeded with url: /security/user/authenticate (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ../../../.pyenv/versions/dtt-test/lib/python3.10/site-packages/requests/adapters.py:519: ConnectionError =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED modules/testing/tests/test_agent/test_uninstall.py::test_uninstall - A... FAILED modules/testing/tests/test_agent/test_uninstall.py::test_isActive - re... =================== 2 failed, 1 passed, 2 warnings in 13.89s =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 [2024-04-19 09:38:09] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-debian-10-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 1}, 'dark': {}, 'failures': {'localhost': 1}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {}} [2024-04-19 09:38:09] [INFO] TESTER: Cleaning up [2024-04-19 09:38:09] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:38:09] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:38:20] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:38:20] [INFO] TESTER: Cleaning up [2024-04-19 09:38:20] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:38:20] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:38:31] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:38:31] [INFO] [65615] [ThreadPoolExecutor-0_3] [workflow_engine]: [run-agent-linux-debian-10-amd64-tests] Finished task in 220.76 seconds. [2024-04-19 09:42:49] [DEBUG] [65615] [ThreadPoolExecutor-0_11] [workflow_engine]: Finished task "run-agent-linux-amazon-2-amd64-tests" execution with result: [2024-04-19 09:37:28] [INFO] TESTER: Running tests for ec2-44-223-69-111.compute-1.amazonaws.com [2024-04-19 09:37:28] [INFO] TESTER: Running tests for ec2-54-157-201-172.compute-1.amazonaws.com [2024-04-19 09:37:28] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-54-157-201-172.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-19 09:37:28] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-19 09:37:28] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:28] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-54-157-201-172.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-44-223-69-111.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.004243' end: '2024-04-19 09:37:29.610701' item: ec2-44-223-69-111.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:37:29.606458' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-54-157-201-172.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.004258' end: '2024-04-19 09:37:29.720130' item: ec2-54-157-201-172.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:37:29.715872' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:37:29] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-54-157-201-172.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:37:29] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:37:29] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:37:29] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' - --live=True - -s delta: '0:01:15.415478' end: '2024-04-19 09:38:46.540976' msg: '' rc: 0 start: '2024-04-19 09:37:31.125498' stderr: |- Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 27 9247k 27 2553k 0 0 3152k 0 0:00:02 --:--:-- 0:00:02 3148k100 9247k 100 9247k 0 0 9894k 0 --:--:-- --:--:-- --:--:-- 9889k warning: wazuh-agent-4.7.3-1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 29111145: NOKEY Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Created symlink from /etc/systemd/system/multi-user.target.wants/wazuh-agent.service to /usr/lib/systemd/system/wazuh-agent.service. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Job for wazuh-agent.service failed because the control process exited with error code. See "systemctl status wazuh-agent.service" and "journalctl -xe" for details. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-19 09:37:31] [INFO] TESTER: Checking connection to amazon-2[0m [32m[2024-04-19 09:37:33] [INFO] TESTER: Connection established successfully in amazon-2[0m [32m[2024-04-19 09:37:35] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-19 09:37:37] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-19 09:37:39] [INFO] TESTER: No Firewall to disable on amazon-2[0m [32m[2024-04-19 09:37:41] [INFO] TESTER: Manager is already installed in ubuntu-22.04[0m [32m[2024-04-19 09:37:45] [INFO] TESTER: Generating Snapshot for Checkfile in amazon-2[0m [32m[2024-04-19 09:38:04] [INFO] TESTER: Installing Agent in amazon-2[0m [32m[2024-04-19 09:38:21] [INFO] TESTER: Generating Snapshot for Checkfile in amazon-2[0m [32m[2024-04-19 09:38:35] [INFO] TESTER: Applying filters in checkfiles in amazon-2[0m [32m[2024-04-19 09:38:35] [INFO] TESTER: Pre and post install checkfile comparison in amazon-2: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m PASSED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-19 09:38:38] [INFO] TESTER: Getting status of amazon-2[0m PASSED modules/testing/tests/test_agent/test_install.py::test_version PASSED modules/testing/tests/test_agent/test_install.py::test_revision PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =================== 4 passed, 2 warnings in 75.05s (0:01:15) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:38:46] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:38:46] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:38:46] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:38:46] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:48.934153' end: '2024-04-19 09:39:36.843779' msg: '' rc: 0 start: '2024-04-19 09:38:47.909626' stderr: |- Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-19 09:38:48] [INFO] TESTER: Checking connection to amazon-2[0m [32m[2024-04-19 09:38:49] [INFO] TESTER: Connection established successfully in amazon-2[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-19 09:39:08] [INFO] TESTER: Getting status of amazon-2[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_connection PASSED modules/testing/tests/test_agent/test_registration.py::test_isActive PASSED modules/testing/tests/test_agent/test_registration.py::test_clientKeys PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ======================== 5 passed, 2 warnings in 48.53s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:39:37] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:39:37] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:39:37] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:39:37] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:34.636455' end: '2024-04-19 09:40:12.844486' msg: '' rc: 0 start: '2024-04-19 09:39:38.208031' stderr: |- Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-19 09:39:38] [INFO] TESTER: Checking connection to amazon-2[0m [32m[2024-04-19 09:39:40] [INFO] TESTER: Connection established successfully in amazon-2[0m [32m[2024-04-19 09:39:51] [INFO] TESTER: Restarting wazuh-agent in amazon-2[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-19 09:40:02] [INFO] TESTER: Getting status of amazon-2[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_connection PASSED modules/testing/tests/test_agent/test_restart.py::test_isActive PASSED modules/testing/tests/test_agent/test_restart.py::test_clientKeys PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ======================== 5 passed, 2 warnings in 34.27s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:40:13] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:40:13] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:40:13] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:40:13] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:40.436098' end: '2024-04-19 09:40:54.642618' msg: '' rc: 0 start: '2024-04-19 09:40:14.206520' stderr: |- Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-19 09:40:14] [INFO] TESTER: Checking connection to amazon-2[0m [32m[2024-04-19 09:40:16] [INFO] TESTER: Connection established successfully in amazon-2[0m [32m[2024-04-19 09:40:35] [INFO] TESTER: Stopping wazuh-agent in amazon-2[0m [32m[2024-04-19 09:40:39] [INFO] TESTER: Getting status of amazon-2[0m PASSED[32m[2024-04-19 09:40:44] [INFO] TESTER: Restarting wazuh-agent in amazon-2[0m =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ======================== 1 passed, 2 warnings in 40.06s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:40:54] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:40:54] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:40:54] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:40:54] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' - --live=True - -s delta: '0:01:27.930195' end: '2024-04-19 09:42:23.936369' msg: '' rc: 0 start: '2024-04-19 09:40:56.006174' stderr: |- Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: RPMDB altered outside of yum. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Failed to execute operation: No such file or directory Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-157-201-172.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-19 09:40:56] [INFO] TESTER: Checking connection to amazon-2[0m [32m[2024-04-19 09:40:58] [INFO] TESTER: Connection established successfully in amazon-2[0m [32m[2024-04-19 09:41:17] [INFO] TESTER: Generating Snapshot for Checkfile in amazon-2[0m [32m[2024-04-19 09:41:34] [INFO] TESTER: Uninstalling Agent in amazon-2[0m [32m[2024-04-19 09:41:51] [INFO] TESTER: Generating Snapshot for Checkfile in amazon-2[0m [32m[2024-04-19 09:42:08] [INFO] TESTER: Applying filters in checkfiles in amazon-2[0m [32m[2024-04-19 09:42:08] [INFO] TESTER: Pre and post uninstall checkfile comparison in amazon-2: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m PASSED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =================== 3 passed, 2 warnings in 87.56s (0:01:27) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:42:24] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-amazon-2-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:42:24] [INFO] TESTER: Cleaning up [2024-04-19 09:42:24] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:42:24] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:42:37] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:42:37] [INFO] TESTER: Cleaning up [2024-04-19 09:42:37] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:42:37] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:42:49] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:42:49] [INFO] [65615] [ThreadPoolExecutor-0_11] [workflow_engine]: [run-agent-linux-amazon-2-amd64-tests] Finished task in 321.01 seconds. [2024-04-19 09:43:06] [DEBUG] [65615] [ThreadPoolExecutor-0_5] [workflow_engine]: Finished task "run-agent-linux-ubuntu-22.04-amd64-tests" execution with result: [2024-04-19 09:34:50] [INFO] TESTER: Running tests for ec2-44-223-69-111.compute-1.amazonaws.com [2024-04-19 09:34:50] [INFO] TESTER: Running tests for ec2-54-87-173-239.compute-1.amazonaws.com [2024-04-19 09:34:50] [DEBUG] TESTER: Using extra vars: {'component': 'agent', 'wazuh_version': '4.7.3', 'wazuh_revision': '40714', 'wazuh_branch': None, 'working_dir': '/tmp/tests', 'live': True, 'hosts_ip': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-54-87-173-239.compute-1.amazonaws.com'], 'targets': '{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}', 'dependencies': '{}', 'local_host_path': '/home/marcelo/wazuh/wazuh-qa/deployability', 'current_user': 'marcelo'} [2024-04-19 09:34:50] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/setup.yml [2024-04-19 09:34:50] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:50] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-54-87-173-239.compute-1.amazonaws.com']}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Cleaning old key ssh-keygen registries] ********************************** changed: [localhost] => (item=ec2-44-223-69-111.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.004666' end: '2024-04-19 09:34:52.636552' item: ec2-44-223-69-111.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:52.631886' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: changed: [localhost] => (item=ec2-54-87-173-239.compute-1.amazonaws.com) => changed=true ansible_loop_var: item cmd: - ssh-keygen - -f - /home/marcelo/.ssh/known_hosts - -R - '' delta: '0:00:00.006633' end: '2024-04-19 09:34:52.796720' item: ec2-54-87-173-239.compute-1.amazonaws.com msg: '' rc: 0 start: '2024-04-19 09:34:52.790087' stderr: Host not found in /home/marcelo/.ssh/known_hosts stderr_lines: stdout: '' stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:34:53] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Cleaning old key ssh-keygen registries', 'ansible.builtin.command': {'cmd': "ssh-keygen -f /home/marcelo/.ssh/known_hosts -R ''"}, 'loop': ['ec2-44-223-69-111.compute-1.amazonaws.com', 'ec2-54-87-173-239.compute-1.amazonaws.com']}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:34:53] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:34:53] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:34:53] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test install for agent] ************************************************** changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_install.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:04:36.424750' end: '2024-04-19 09:39:31.486972' msg: '' rc: 0 start: '2024-04-19 09:34:55.062222' stderr: |- Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. --2024-04-19 12:38:54-- https://packages-dev.wazuh.com/pre-release/apt/pool/main/w/wazuh-agent/wazuh-agent_4.7.3-1_amd64.deb Resolving packages-dev.wazuh.com (packages-dev.wazuh.com)... 99.84.208.124, 99.84.208.42, 99.84.208.121, ... Connecting to packages-dev.wazuh.com (packages-dev.wazuh.com)|99.84.208.124|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 9362524 (8.9M) [binary/octet-stream] Saving to: 'wazuh-agent_4.7.3-1_amd64.deb' 0K .......... .......... .......... .......... .......... 0% 863K 11s 50K .......... .......... .......... .......... .......... 1% 852K 11s 100K .......... .......... .......... .......... .......... 1% 852K 11s 150K .......... .......... .......... .......... .......... 2% 35.7M 8s 200K .......... .......... .......... .......... .......... 2% 110M 6s 250K .......... .......... .......... .......... .......... 3% 167M 5s 300K .......... .......... .......... .......... .......... 3% 878K 6s 350K .......... .......... .......... .......... .......... 4% 27.1M 5s 400K .......... .......... .......... .......... .......... 4% 64.4M 5s 450K .......... .......... .......... .......... .......... 5% 40.7M 4s 500K .......... .......... .......... .......... .......... 6% 49.8M 4s 550K .......... .......... .......... .......... .......... 6% 78.4M 3s 600K .......... .......... .......... .......... .......... 7% 919K 4s 650K .......... .......... .......... .......... .......... 7% 148M 4s 700K .......... .......... .......... .......... .......... 8% 33.2M 3s 750K .......... .......... .......... .......... .......... 8% 144M 3s 800K .......... .......... .......... .......... .......... 9% 102M 3s 850K .......... .......... .......... .......... .......... 9% 105M 3s 900K .......... .......... .......... .......... .......... 10% 88.8M 3s 950K .......... .......... .......... .......... .......... 10% 107M 2s 1000K .......... .......... .......... .......... .......... 11% 30.8M 2s 1050K .......... .......... .......... .......... .......... 12% 121M 2s 1100K .......... .......... .......... .......... .......... 12% 58.4M 2s 1150K .......... .......... .......... .......... .......... 13% 26.0M 2s 1200K .......... .......... .......... .......... .......... 13% 56.6M 2s 1250K .......... .......... .......... .......... .......... 14% 30.6M 2s 1300K .......... .......... .......... .......... .......... 14% 1.02M 2s 1350K .......... .......... .......... .......... .......... 15% 173M 2s 1400K .......... .......... .......... .......... .......... 15% 15.5M 2s 1450K .......... .......... .......... .......... .......... 16% 22.5M 2s 1500K .......... .......... .......... .......... .......... 16% 18.1M 2s 1550K .......... .......... .......... .......... .......... 17% 36.8M 2s 1600K .......... .......... .......... .......... .......... 18% 235M 2s 1650K .......... .......... .......... .......... .......... 18% 33.9M 2s 1700K .......... .......... .......... .......... .......... 19% 30.7M 2s 1750K .......... .......... .......... .......... .......... 19% 88.3M 1s 1800K .......... .......... .......... .......... .......... 20% 73.5M 1s 1850K .......... .......... .......... .......... .......... 20% 44.8M 1s 1900K .......... .......... .......... .......... .......... 21% 136M 1s 1950K .......... .......... .......... .......... .......... 21% 39.0M 1s 2000K .......... .......... .......... .......... .......... 22% 67.7M 1s 2050K .......... .......... .......... .......... .......... 22% 36.7M 1s 2100K .......... .......... .......... .......... .......... 23% 200M 1s 2150K .......... .......... .......... .......... .......... 24% 32.0M 1s 2200K .......... .......... .......... .......... .......... 24% 178M 1s 2250K .......... .......... .......... .......... .......... 25% 61.8M 1s 2300K .......... .......... .......... .......... .......... 25% 100M 1s 2350K .......... .......... .......... .......... .......... 26% 22.6M 1s 2400K .......... .......... .......... .......... .......... 26% 43.1M 1s 2450K .......... .......... .......... .......... .......... 27% 17.1M 1s 2500K .......... .......... .......... .......... .......... 27% 156M 1s 2550K .......... .......... .......... .......... .......... 28% 167M 1s 2600K .......... .......... .......... .......... .......... 28% 1.84M 1s 2650K .......... .......... .......... .......... .......... 29% 12.7M 1s 2700K .......... .......... .......... .......... .......... 30% 21.5M 1s 2750K .......... .......... .......... .......... .......... 30% 11.6M 1s 2800K .......... .......... .......... .......... .......... 31% 29.7M 1s 2850K .......... .......... .......... .......... .......... 31% 23.9M 1s 2900K .......... .......... .......... .......... .......... 32% 31.9M 1s 2950K .......... .......... .......... .......... .......... 32% 4.86M 1s 3000K .......... .......... .......... .......... .......... 33% 14.8M 1s 3050K .......... .......... .......... .......... .......... 33% 26.1M 1s 3100K .......... .......... .......... .......... .......... 34% 14.1M 1s 3150K .......... .......... .......... .......... .......... 34% 19.8M 1s 3200K .......... .......... .......... .......... .......... 35% 48.1M 1s 3250K .......... .......... .......... .......... .......... 36% 19.7M 1s 3300K .......... .......... .......... .......... .......... 36% 27.0M 1s 3350K .......... .......... .......... .......... .......... 37% 16.3M 1s 3400K .......... .......... .......... .......... .......... 37% 15.3M 1s 3450K .......... .......... .......... .......... .......... 38% 28.3M 1s 3500K .......... .......... .......... .......... .......... 38% 25.0M 1s 3550K .......... .......... .......... .......... .......... 39% 47.6M 1s 3600K .......... .......... .......... .......... .......... 39% 14.5M 1s 3650K .......... .......... .......... .......... .......... 40% 40.2M 1s 3700K .......... .......... .......... .......... .......... 41% 163M 1s 3750K .......... .......... .......... .......... .......... 41% 22.1M 1s 3800K .......... .......... .......... .......... .......... 42% 11.6M 1s 3850K .......... .......... .......... .......... .......... 42% 21.7M 1s 3900K .......... .......... .......... .......... .......... 43% 104M 1s 3950K .......... .......... .......... .......... .......... 43% 42.5M 1s 4000K .......... .......... .......... .......... .......... 44% 52.0M 1s 4050K .......... .......... .......... .......... .......... 44% 71.2M 1s 4100K .......... .......... .......... .......... .......... 45% 135M 1s 4150K .......... .......... .......... .......... .......... 45% 16.9M 1s 4200K .......... .......... .......... .......... .......... 46% 19.5M 1s 4250K .......... .......... .......... .......... .......... 47% 34.7M 1s 4300K .......... .......... .......... .......... .......... 47% 6.94M 1s 4350K .......... .......... .......... .......... .......... 48% 33.4M 1s 4400K .......... .......... .......... .......... .......... 48% 12.9M 1s 4450K .......... .......... .......... .......... .......... 49% 20.4M 1s 4500K .......... .......... .......... .......... .......... 49% 17.9M 1s 4550K .......... .......... .......... .......... .......... 50% 85.8M 0s 4600K .......... .......... .......... .......... .......... 50% 49.3M 0s 4650K .......... .......... .......... .......... .......... 51% 195M 0s 4700K .......... .......... .......... .......... .......... 51% 41.2M 0s 4750K .......... .......... .......... .......... .......... 52% 83.2M 0s 4800K .......... .......... .......... .......... .......... 53% 131M 0s 4850K .......... .......... .......... .......... .......... 53% 41.0M 0s 4900K .......... .......... .......... .......... .......... 54% 46.1M 0s 4950K .......... .......... .......... .......... .......... 54% 56.8M 0s 5000K .......... .......... .......... .......... .......... 55% 38.1M 0s 5050K .......... .......... .......... .......... .......... 55% 36.3M 0s 5100K .......... .......... .......... .......... .......... 56% 31.9M 0s 5150K .......... .......... .......... .......... .......... 56% 20.0M 0s 5200K .......... .......... .......... .......... .......... 57% 148M 0s 5250K .......... .......... .......... .......... .......... 57% 52.9M 0s 5300K .......... .......... .......... .......... .......... 58% 196M 0s 5350K .......... .......... .......... .......... .......... 59% 73.2M 0s 5400K .......... .......... .......... .......... .......... 59% 134M 0s 5450K .......... .......... .......... .......... .......... 60% 25.4M 0s 5500K .......... .......... .......... .......... .......... 60% 213M 0s 5550K .......... .......... .......... .......... .......... 61% 83.0M 0s 5600K .......... .......... .......... .......... .......... 61% 150M 0s 5650K .......... .......... .......... .......... .......... 62% 211M 0s 5700K .......... .......... .......... .......... .......... 62% 169M 0s 5750K .......... .......... .......... .......... .......... 63% 158M 0s 5800K .......... .......... .......... .......... .......... 63% 20.4M 0s 5850K .......... .......... .......... .......... .......... 64% 196M 0s 5900K .......... .......... .......... .......... .......... 65% 200M 0s 5950K .......... .......... .......... .......... .......... 65% 216M 0s 6000K .......... .......... .......... .......... .......... 66% 180M 0s 6050K .......... .......... .......... .......... .......... 66% 148M 0s 6100K .......... .......... .......... .......... .......... 67% 139M 0s 6150K .......... .......... .......... .......... .......... 67% 223M 0s 6200K .......... .......... .......... .......... .......... 68% 190M 0s 6250K .......... .......... .......... .......... .......... 68% 19.6M 0s 6300K .......... .......... .......... .......... .......... 69% 203M 0s 6350K .......... .......... .......... .......... .......... 69% 178M 0s 6400K .......... .......... .......... .......... .......... 70% 43.9M 0s 6450K .......... .......... .......... .......... .......... 71% 204M 0s 6500K .......... .......... .......... .......... .......... 71% 225M 0s 6550K .......... .......... .......... .......... .......... 72% 229M 0s 6600K .......... .......... .......... .......... .......... 72% 41.7M 0s 6650K .......... .......... .......... .......... .......... 73% 119M 0s 6700K .......... .......... .......... .......... .......... 73% 77.0M 0s 6750K .......... .......... .......... .......... .......... 74% 51.9M 0s 6800K .......... .......... .......... .......... .......... 74% 139M 0s 6850K .......... .......... .......... .......... .......... 75% 41.7M 0s 6900K .......... .......... .......... .......... .......... 76% 208M 0s 6950K .......... .......... .......... .......... .......... 76% 229M 0s 7000K .......... .......... .......... .......... .......... 77% 42.5M 0s 7050K .......... .......... .......... .......... .......... 77% 21.4M 0s 7100K .......... .......... .......... .......... .......... 78% 204M 0s 7150K .......... .......... .......... .......... .......... 78% 218M 0s 7200K .......... .......... .......... .......... .......... 79% 188M 0s 7250K .......... .......... .......... .......... .......... 79% 178M 0s 7300K .......... .......... .......... .......... .......... 80% 219M 0s 7350K .......... .......... .......... .......... .......... 80% 221M 0s 7400K .......... .......... .......... .......... .......... 81% 14.3M 0s 7450K .......... .......... .......... .......... .......... 82% 181M 0s 7500K .......... .......... .......... .......... .......... 82% 218M 0s 7550K .......... .......... .......... .......... .......... 83% 211M 0s 7600K .......... .......... .......... .......... .......... 83% 183M 0s 7650K .......... .......... .......... .......... .......... 84% 46.9M 0s 7700K .......... .......... .......... .......... .......... 84% 194M 0s 7750K .......... .......... .......... .......... .......... 85% 47.7M 0s 7800K .......... .......... .......... .......... .......... 85% 203M 0s 7850K .......... .......... .......... .......... .......... 86% 31.9M 0s 7900K .......... .......... .......... .......... .......... 86% 193M 0s 7950K .......... .......... .......... .......... .......... 87% 192M 0s 8000K .......... .......... .......... .......... .......... 88% 168M 0s 8050K .......... .......... .......... .......... .......... 88% 24.2M 0s 8100K .......... .......... .......... .......... .......... 89% 193M 0s 8150K .......... .......... .......... .......... .......... 89% 208M 0s 8200K .......... .......... .......... .......... .......... 90% 160M 0s 8250K .......... .......... .......... .......... .......... 90% 141M 0s 8300K .......... .......... .......... .......... .......... 91% 48.6M 0s 8350K .......... .......... .......... .......... .......... 91% 139M 0s 8400K .......... .......... .......... .......... .......... 92% 49.8M 0s 8450K .......... .......... .......... .......... .......... 92% 134M 0s 8500K .......... .......... .......... .......... .......... 93% 120M 0s 8550K .......... .......... .......... .......... .......... 94% 219M 0s 8600K .......... .......... .......... .......... .......... 94% 220M 0s 8650K .......... .......... .......... .......... .......... 95% 145M 0s 8700K .......... .......... .......... .......... .......... 95% 21.8M 0s 8750K .......... .......... .......... .......... .......... 96% 52.6M 0s 8800K .......... .......... .......... .......... .......... 96% 194M 0s 8850K .......... .......... .......... .......... .......... 97% 69.3M 0s 8900K .......... .......... .......... .......... .......... 97% 212M 0s 8950K .......... .......... .......... .......... .......... 98% 205M 0s 9000K .......... .......... .......... .......... .......... 98% 221M 0s 9050K .......... .......... .......... .......... .......... 99% 151M 0s 9100K .......... .......... .......... .......... ... 100% 241M=0.6s 2024-04-19 12:38:55 (15.8 MB/s) - 'wazuh-agent_4.7.3-1_amd64.deb' saved [9362524/9362524] Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Created symlink /etc/systemd/system/multi-user.target.wants/wazuh-agent.service → /lib/systemd/system/wazuh-agent.service. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Job for wazuh-agent.service failed because the control process exited with error code. See "systemctl status wazuh-agent.service" and "journalctl -xeu wazuh-agent.service" for details. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 4 items modules/testing/tests/test_agent/test_install.py::test_installation [32m[2024-04-19 09:34:55] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-19 09:34:57] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-19 09:34:59] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-19 09:35:00] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-19 09:35:02] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-19 09:35:06] [INFO] TESTER: No Firewall to disable on ubuntu-22.04[0m [32m[2024-04-19 09:37:02] [INFO] TESTER: Installing Manager in ubuntu-22.04[0m [32m[2024-04-19 09:38:34] [INFO] TESTER: Generating Snapshot for Checkfile in ubuntu-22.04[0m [32m[2024-04-19 09:38:53] [INFO] TESTER: Installing Agent in ubuntu-22.04[0m [32m[2024-04-19 09:39:10] [INFO] TESTER: Generating Snapshot for Checkfile in ubuntu-22.04[0m [32m[2024-04-19 09:39:22] [INFO] TESTER: Applying filters in checkfiles in ubuntu-22.04[0m [32m[2024-04-19 09:39:22] [INFO] TESTER: Pre and post install checkfile comparison in ubuntu-22.04: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m PASSED modules/testing/tests/test_agent/test_install.py::test_status [32m[2024-04-19 09:39:24] [INFO] TESTER: Getting status of ubuntu-22.04[0m PASSED modules/testing/tests/test_agent/test_install.py::test_version PASSED modules/testing/tests/test_agent/test_install.py::test_revision PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ================== 4 passed, 2 warnings in 275.58s (0:04:35) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:39:31] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test install for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_install.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:39:31] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:39:31] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:39:31] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test registration for agent] ********************************************* changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_registration.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:46.385997' end: '2024-04-19 09:40:19.249410' msg: '' rc: 0 start: '2024-04-19 09:39:32.863413' stderr: |- Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_registration.py::test_registration [32m[2024-04-19 09:39:33] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-19 09:39:34] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_status [32m[2024-04-19 09:39:52] [INFO] TESTER: Getting status of ubuntu-22.04[0m PASSED modules/testing/tests/test_agent/test_registration.py::test_connection PASSED modules/testing/tests/test_agent/test_registration.py::test_isActive PASSED modules/testing/tests/test_agent/test_registration.py::test_clientKeys PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ======================== 5 passed, 2 warnings in 45.97s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:40:19] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test registration for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_registration.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:40:19] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:40:19] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:40:19] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test restart for agent] ************************************************** changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_restart.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:31.483038' end: '2024-04-19 09:40:52.101731' msg: '' rc: 0 start: '2024-04-19 09:40:20.618693' stderr: |- Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 5 items modules/testing/tests/test_agent/test_restart.py::test_restart [32m[2024-04-19 09:40:21] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-19 09:40:22] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-19 09:40:31] [INFO] TESTER: Restarting wazuh-agent in ubuntu-22.04[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_status [32m[2024-04-19 09:40:42] [INFO] TESTER: Getting status of ubuntu-22.04[0m PASSED modules/testing/tests/test_agent/test_restart.py::test_connection PASSED modules/testing/tests/test_agent/test_restart.py::test_isActive PASSED modules/testing/tests/test_agent/test_restart.py::test_clientKeys PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ======================== 5 passed, 2 warnings in 31.11s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:40:52] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test restart for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_restart.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:40:52] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:40:52] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:40:52] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test stop for agent] ***************************************************** changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_stop.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:00:37.167410' end: '2024-04-19 09:41:30.631582' msg: '' rc: 0 start: '2024-04-19 09:40:53.464172' stderr: |- Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 1 item modules/testing/tests/test_agent/test_stop.py::test_stop [32m[2024-04-19 09:40:53] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-19 09:40:55] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-19 09:41:11] [INFO] TESTER: Stopping wazuh-agent in ubuntu-22.04[0m [32m[2024-04-19 09:41:15] [INFO] TESTER: Getting status of ubuntu-22.04[0m PASSED[32m[2024-04-19 09:41:20] [INFO] TESTER: Restarting wazuh-agent in ubuntu-22.04[0m =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ======================== 1 passed, 2 warnings in 36.80s ======================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:41:30] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test stop for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_stop.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:41:30] [DEBUG] TESTER: Rendering template /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/test.yml [2024-04-19 09:41:30] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:41:30] [DEBUG] TESTER: Running playbook: [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] No config file found; using defaults PLAY [localhost] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Test uninstall for agent] ************************************************ changed: [localhost] => changed=true cmd: - python3 - -m - pytest - modules/testing/tests/test_agent/test_uninstall.py - -v - --wazuh_version=4.7.3 - --wazuh_revision=40714 - --component=agent - --dependencies={} - '--targets={wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' - --live=True - -s delta: '0:01:11.810506' end: '2024-04-19 09:42:43.807924' msg: '' rc: 0 start: '2024-04-19 09:41:31.997418' stderr: |- Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_TIME = "es_AR.UTF-8", LC_MONETARY = "es_AR.UTF-8", LC_ADDRESS = "es_AR.UTF-8", LC_TELEPHONE = "es_AR.UTF-8", LC_NAME = "es_AR.UTF-8", LC_MEASUREMENT = "es_AR.UTF-8", LC_IDENTIFICATION = "es_AR.UTF-8", LC_NUMERIC = "es_AR.UTF-8", LC_PAPER = "es_AR.UTF-8", LANG = "C.UTF-8" are supported and installed on your system. perl: warning: Falling back to a fallback locale ("C.UTF-8"). locale: Cannot set LC_ALL to default locale: No such file or directory perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_TIME = "es_AR.UTF-8", LC_MONETARY = "es_AR.UTF-8", LC_ADDRESS = "es_AR.UTF-8", LC_TELEPHONE = "es_AR.UTF-8", LC_NAME = "es_AR.UTF-8", LC_MEASUREMENT = "es_AR.UTF-8", LC_IDENTIFICATION = "es_AR.UTF-8", LC_NUMERIC = "es_AR.UTF-8", LC_PAPER = "es_AR.UTF-8", LANG = "C.UTF-8" are supported and installed on your system. perl: warning: Falling back to a fallback locale ("C.UTF-8"). Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Removed /etc/systemd/system/multi-user.target.wants/wazuh-agent.service. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-44-223-69-111.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. Warning: Permanently added '[ec2-54-87-173-239.compute-1.amazonaws.com]:2200' (ED25519) to the list of known hosts. stderr_lines: stdout: |- ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.4.0 -- /home/marcelo/.pyenv/versions/dtt-test/bin/python3 cachedir: .pytest_cache rootdir: /home/marcelo/wazuh/wazuh-qa/deployability/modules collecting ... collected 3 items modules/testing/tests/test_agent/test_uninstall.py::test_uninstall [32m[2024-04-19 09:41:32] [INFO] TESTER: Checking connection to ubuntu-22.04[0m [32m[2024-04-19 09:41:33] [INFO] TESTER: Connection established successfully in ubuntu-22.04[0m [32m[2024-04-19 09:41:50] [INFO] TESTER: Generating Snapshot for Checkfile in ubuntu-22.04[0m [32m[2024-04-19 09:42:04] [INFO] TESTER: Uninstalling Agent in ubuntu-22.04[0m [32m[2024-04-19 09:42:16] [INFO] TESTER: Generating Snapshot for Checkfile in ubuntu-22.04[0m [32m[2024-04-19 09:42:28] [INFO] TESTER: Applying filters in checkfiles in ubuntu-22.04[0m [32m[2024-04-19 09:42:28] [INFO] TESTER: Pre and post uninstall checkfile comparison in ubuntu-22.04: {'/boot': {'added': [], 'removed': [], 'modified': []}, '/usr/bin': {'added': [], 'removed': [], 'modified': []}, '/root': {'added': [], 'removed': [], 'modified': []}, '/usr/sbin': {'added': [], 'removed': [], 'modified': []}}[0m PASSED modules/testing/tests/test_agent/test_uninstall.py::test_agent_uninstalled_directory PASSED modules/testing/tests/test_agent/test_uninstall.py::test_isActive PASSED =============================== warnings summary =============================== modules/provision/models.py:36 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:36: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('dependencies', pre=True) modules/provision/models.py:64 /home/marcelo/wazuh/wazuh-qa/deployability/modules/provision/models.py:64: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ @validator('install', 'uninstall', pre=True) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =================== 3 passed, 2 warnings in 71.44s (0:01:11) =================== stdout_lines: PLAY RECAP ********************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:42:43] [DEBUG] TESTER: Playbook [{'hosts': 'localhost', 'become': True, 'become_user': 'marcelo', 'tasks': [{'name': 'Test uninstall for agent', 'command': "python3 -m pytest modules/testing/tests/test_agent/test_uninstall.py -v --wazuh_version=4.7.3 --wazuh_revision=40714 --component=agent --dependencies='{}' --targets='{wazuh-1: /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/inventory.yaml, agent: /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/inventory.yaml}' --live=True -s", 'args': {'chdir': '/home/marcelo/wazuh/wazuh-qa/deployability'}}]}] finished with status {'skipped': {}, 'ok': {'localhost': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'localhost': 1}, 'changed': {'localhost': 1}} [2024-04-19 09:42:43] [INFO] TESTER: Cleaning up [2024-04-19 09:42:43] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:42:43] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:42:55] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:42:55] [INFO] TESTER: Cleaning up [2024-04-19 09:42:55] [DEBUG] TESTER: Using inventory: {'all': {'hosts': {'ec2-44-223-69-111.compute-1.amazonaws.com': {'ansible_port': 2200, 'ansible_user': 'ubuntu', 'ansible_ssh_private_key_file': '/tmp/wazuh-qa/i-0de14d1fb21f4fe75/ubuntu-22.04-amd64-key-2322'}}}} [2024-04-19 09:42:55] [DEBUG] TESTER: Running playbook: /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml No config file found; using defaults PLAY [all] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [ec2-44-223-69-111.compute-1.amazonaws.com] TASK [Clean test directory] **************************************************** ok: [ec2-44-223-69-111.compute-1.amazonaws.com] => changed=false path: /tmp/tests state: absent PLAY RECAP ********************************************************************* ec2-44-223-69-111.compute-1.amazonaws.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [2024-04-19 09:43:06] [DEBUG] TESTER: Playbook /home/marcelo/wazuh/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml finished with status {'skipped': {}, 'ok': {'ec2-44-223-69-111.compute-1.amazonaws.com': 2}, 'dark': {}, 'failures': {}, 'ignored': {}, 'rescued': {}, 'processed': {'ec2-44-223-69-111.compute-1.amazonaws.com': 1}, 'changed': {}} [2024-04-19 09:43:06] [INFO] [65615] [ThreadPoolExecutor-0_5] [workflow_engine]: [run-agent-linux-ubuntu-22.04-amd64-tests] Finished task in 496.34 seconds. [2024-04-19 09:43:06] [INFO] [65615] [MainThread] [workflow_engine]: Executing Reverse DAG tasks. [2024-04-19 09:43:06] [INFO] [65615] [MainThread] [workflow_engine]: Executing tasks in parallel. [2024-04-19 09:43:06] [INFO] [65615] [ThreadPoolExecutor-1_0] [workflow_engine]: [allocate-agent-linux-ubuntu-18.04-amd64] Starting task. [2024-04-19 09:43:06] [DEBUG] [65615] [ThreadPoolExecutor-1_0] [workflow_engine]: Running task "allocate-agent-linux-ubuntu-18.04-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/track.yaml'] [2024-04-19 09:43:06] [INFO] [65615] [ThreadPoolExecutor-1_1] [workflow_engine]: [allocate-agent-linux-ubuntu-20.04-amd64] Starting task. [2024-04-19 09:43:06] [INFO] [65615] [ThreadPoolExecutor-1_2] [workflow_engine]: [allocate-agent-linux-ubuntu-22.04-amd64] Starting task. [2024-04-19 09:43:06] [DEBUG] [65615] [ThreadPoolExecutor-1_1] [workflow_engine]: Running task "allocate-agent-linux-ubuntu-20.04-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/track.yaml'] [2024-04-19 09:43:06] [INFO] [65615] [ThreadPoolExecutor-1_3] [workflow_engine]: [allocate-agent-linux-debian-10-amd64] Starting task. [2024-04-19 09:43:06] [DEBUG] [65615] [ThreadPoolExecutor-1_2] [workflow_engine]: Running task "allocate-agent-linux-ubuntu-22.04-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/track.yaml'] [2024-04-19 09:43:06] [INFO] [65615] [ThreadPoolExecutor-1_4] [workflow_engine]: [allocate-agent-linux-debian-11-amd64] Starting task. [2024-04-19 09:43:06] [DEBUG] [65615] [ThreadPoolExecutor-1_3] [workflow_engine]: Running task "allocate-agent-linux-debian-10-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-debian-10-amd64/track.yaml'] [2024-04-19 09:43:06] [INFO] [65615] [ThreadPoolExecutor-1_5] [workflow_engine]: [allocate-agent-linux-debian-12-amd64] Starting task. [2024-04-19 09:43:06] [INFO] [65615] [ThreadPoolExecutor-1_6] [workflow_engine]: [allocate-agent-linux-oracle-9-amd64] Starting task. [2024-04-19 09:43:06] [INFO] [65615] [ThreadPoolExecutor-1_7] [workflow_engine]: [allocate-agent-linux-centos-7-amd64] Starting task. [2024-04-19 09:43:06] [DEBUG] [65615] [ThreadPoolExecutor-1_4] [workflow_engine]: Running task "allocate-agent-linux-debian-11-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-debian-11-amd64/track.yaml'] [2024-04-19 09:43:06] [INFO] [65615] [ThreadPoolExecutor-1_8] [workflow_engine]: [allocate-agent-linux-centos-8-amd64] Starting task. [2024-04-19 09:43:06] [INFO] [65615] [ThreadPoolExecutor-1_9] [workflow_engine]: [allocate-agent-linux-redhat-7-amd64] Starting task. [2024-04-19 09:43:06] [INFO] [65615] [ThreadPoolExecutor-1_10] [workflow_engine]: [allocate-agent-linux-redhat-8-amd64] Starting task. [2024-04-19 09:43:06] [DEBUG] [65615] [ThreadPoolExecutor-1_5] [workflow_engine]: Running task "allocate-agent-linux-debian-12-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-debian-12-amd64/track.yaml'] [2024-04-19 09:43:06] [INFO] [65615] [ThreadPoolExecutor-1_11] [workflow_engine]: [allocate-agent-linux-redhat-9-amd64] Starting task. [2024-04-19 09:43:06] [DEBUG] [65615] [ThreadPoolExecutor-1_6] [workflow_engine]: Running task "allocate-agent-linux-oracle-9-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-oracle-9-amd64/track.yaml'] [2024-04-19 09:43:06] [DEBUG] [65615] [ThreadPoolExecutor-1_7] [workflow_engine]: Running task "allocate-agent-linux-centos-7-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-centos-7-amd64/track.yaml'] [2024-04-19 09:43:06] [DEBUG] [65615] [ThreadPoolExecutor-1_8] [workflow_engine]: Running task "allocate-agent-linux-centos-8-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-centos-8-amd64/track.yaml'] [2024-04-19 09:43:06] [DEBUG] [65615] [ThreadPoolExecutor-1_9] [workflow_engine]: Running task "allocate-agent-linux-redhat-7-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-redhat-7-amd64/track.yaml'] [2024-04-19 09:43:06] [DEBUG] [65615] [ThreadPoolExecutor-1_10] [workflow_engine]: Running task "allocate-agent-linux-redhat-8-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-redhat-8-amd64/track.yaml'] [2024-04-19 09:43:06] [DEBUG] [65615] [ThreadPoolExecutor-1_11] [workflow_engine]: Running task "allocate-agent-linux-redhat-9-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-redhat-9-amd64/track.yaml'] [2024-04-19 09:43:40] [DEBUG] [65615] [ThreadPoolExecutor-1_3] [workflow_engine]: Finished task "allocate-agent-linux-debian-10-amd64" execution with result: [2024-04-19 09:43:07] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-debian-10-amd64/track.yaml [2024-04-19 09:43:07] [DEBUG] ALLOCATOR: Deleting credentials: debian-10-amd64-key-2110 [2024-04-19 09:43:40] [INFO] ALLOCATOR: Instance i-0f8940c82765909a1 deleted. [2024-04-19 09:43:40] [INFO] [65615] [ThreadPoolExecutor-1_3] [workflow_engine]: [allocate-agent-linux-debian-10-amd64] Finished task in 33.46 seconds. [2024-04-19 09:43:40] [INFO] [65615] [ThreadPoolExecutor-1_3] [workflow_engine]: [allocate-agent-linux-amazon-2-amd64] Starting task. [2024-04-19 09:43:40] [DEBUG] [65615] [ThreadPoolExecutor-1_3] [workflow_engine]: Running task "allocate-agent-linux-amazon-2-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/agent-linux-amazon-2-amd64/track.yaml'] [2024-04-19 09:43:40] [DEBUG] [65615] [ThreadPoolExecutor-1_8] [workflow_engine]: Finished task "allocate-agent-linux-centos-8-amd64" execution with result: [2024-04-19 09:43:07] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-centos-8-amd64/track.yaml [2024-04-19 09:43:08] [DEBUG] ALLOCATOR: Deleting credentials: centos-8-amd64-key-6075 [2024-04-19 09:43:40] [INFO] ALLOCATOR: Instance i-08244012cd8a3d82d deleted. [2024-04-19 09:43:40] [INFO] [65615] [ThreadPoolExecutor-1_8] [workflow_engine]: [allocate-agent-linux-centos-8-amd64] Finished task in 33.74 seconds. [2024-04-19 09:43:40] [DEBUG] [65615] [ThreadPoolExecutor-1_5] [workflow_engine]: Finished task "allocate-agent-linux-debian-12-amd64" execution with result: [2024-04-19 09:43:07] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-debian-12-amd64/track.yaml [2024-04-19 09:43:08] [DEBUG] ALLOCATOR: Deleting credentials: debian-12-amd64-key-5406 [2024-04-19 09:43:40] [INFO] ALLOCATOR: Instance i-0959f910e2ee00979 deleted. [2024-04-19 09:43:40] [INFO] [65615] [ThreadPoolExecutor-1_5] [workflow_engine]: [allocate-agent-linux-debian-12-amd64] Finished task in 33.81 seconds. [2024-04-19 09:43:55] [DEBUG] [65615] [ThreadPoolExecutor-1_1] [workflow_engine]: Finished task "allocate-agent-linux-ubuntu-20.04-amd64" execution with result: [2024-04-19 09:43:07] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-ubuntu-20.04-amd64/track.yaml [2024-04-19 09:43:07] [DEBUG] ALLOCATOR: Deleting credentials: ubuntu-20.04-amd64-key-3269 [2024-04-19 09:43:55] [INFO] ALLOCATOR: Instance i-0bf8a3758db255e40 deleted. [2024-04-19 09:43:55] [INFO] [65615] [ThreadPoolExecutor-1_1] [workflow_engine]: [allocate-agent-linux-ubuntu-20.04-amd64] Finished task in 48.77 seconds. [2024-04-19 09:43:55] [DEBUG] [65615] [ThreadPoolExecutor-1_2] [workflow_engine]: Finished task "allocate-agent-linux-ubuntu-22.04-amd64" execution with result: [2024-04-19 09:43:07] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-ubuntu-22.04-amd64/track.yaml [2024-04-19 09:43:07] [DEBUG] ALLOCATOR: Deleting credentials: ubuntu-22.04-amd64-key-4159 [2024-04-19 09:43:55] [INFO] ALLOCATOR: Instance i-0788b645be4a7bbdd deleted. [2024-04-19 09:43:55] [INFO] [65615] [ThreadPoolExecutor-1_2] [workflow_engine]: [allocate-agent-linux-ubuntu-22.04-amd64] Finished task in 48.88 seconds. [2024-04-19 09:43:55] [DEBUG] [65615] [ThreadPoolExecutor-1_4] [workflow_engine]: Finished task "allocate-agent-linux-debian-11-amd64" execution with result: [2024-04-19 09:43:07] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-debian-11-amd64/track.yaml [2024-04-19 09:43:07] [DEBUG] ALLOCATOR: Deleting credentials: debian-11-amd64-key-7448 [2024-04-19 09:43:55] [INFO] ALLOCATOR: Instance i-0144986ae8ca905e2 deleted. [2024-04-19 09:43:55] [INFO] [65615] [ThreadPoolExecutor-1_4] [workflow_engine]: [allocate-agent-linux-debian-11-amd64] Finished task in 48.92 seconds. [2024-04-19 09:43:55] [DEBUG] [65615] [ThreadPoolExecutor-1_7] [workflow_engine]: Finished task "allocate-agent-linux-centos-7-amd64" execution with result: [2024-04-19 09:43:07] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-centos-7-amd64/track.yaml [2024-04-19 09:43:08] [DEBUG] ALLOCATOR: Deleting credentials: centos-7-amd64-key-5411 [2024-04-19 09:43:55] [INFO] ALLOCATOR: Instance i-0f785648cab9fa84d deleted. [2024-04-19 09:43:55] [INFO] [65615] [ThreadPoolExecutor-1_7] [workflow_engine]: [allocate-agent-linux-centos-7-amd64] Finished task in 49.00 seconds. [2024-04-19 09:44:11] [DEBUG] [65615] [ThreadPoolExecutor-1_10] [workflow_engine]: Finished task "allocate-agent-linux-redhat-8-amd64" execution with result: [2024-04-19 09:43:07] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-redhat-8-amd64/track.yaml [2024-04-19 09:43:08] [DEBUG] ALLOCATOR: Deleting credentials: redhat-8-amd64-key-2817 [2024-04-19 09:44:11] [INFO] ALLOCATOR: Instance i-030faebf912a54cca deleted. [2024-04-19 09:44:11] [INFO] [65615] [ThreadPoolExecutor-1_10] [workflow_engine]: [allocate-agent-linux-redhat-8-amd64] Finished task in 64.38 seconds. [2024-04-19 09:44:11] [DEBUG] [65615] [ThreadPoolExecutor-1_9] [workflow_engine]: Finished task "allocate-agent-linux-redhat-7-amd64" execution with result: [2024-04-19 09:43:07] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-redhat-7-amd64/track.yaml [2024-04-19 09:43:08] [DEBUG] ALLOCATOR: Deleting credentials: redhat-7-amd64-key-5645 [2024-04-19 09:44:11] [INFO] ALLOCATOR: Instance i-0b638dddb92e18289 deleted. [2024-04-19 09:44:11] [INFO] [65615] [ThreadPoolExecutor-1_9] [workflow_engine]: [allocate-agent-linux-redhat-7-amd64] Finished task in 64.42 seconds. [2024-04-19 09:44:11] [DEBUG] [65615] [ThreadPoolExecutor-1_6] [workflow_engine]: Finished task "allocate-agent-linux-oracle-9-amd64" execution with result: [2024-04-19 09:43:07] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-oracle-9-amd64/track.yaml [2024-04-19 09:43:08] [DEBUG] ALLOCATOR: Deleting credentials: oracle-9-amd64-key-1287 [2024-04-19 09:44:11] [INFO] ALLOCATOR: Instance i-02c9cafb176f8b496 deleted. [2024-04-19 09:44:11] [INFO] [65615] [ThreadPoolExecutor-1_6] [workflow_engine]: [allocate-agent-linux-oracle-9-amd64] Finished task in 64.49 seconds. [2024-04-19 09:44:12] [DEBUG] [65615] [ThreadPoolExecutor-1_11] [workflow_engine]: Finished task "allocate-agent-linux-redhat-9-amd64" execution with result: [2024-04-19 09:43:07] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-redhat-9-amd64/track.yaml [2024-04-19 09:43:08] [DEBUG] ALLOCATOR: Deleting credentials: redhat-9-amd64-key-3563 [2024-04-19 09:44:12] [INFO] ALLOCATOR: Instance i-085a5f30afea3e7a3 deleted. [2024-04-19 09:44:12] [INFO] [65615] [ThreadPoolExecutor-1_11] [workflow_engine]: [allocate-agent-linux-redhat-9-amd64] Finished task in 65.84 seconds. [2024-04-19 09:44:14] [DEBUG] [65615] [ThreadPoolExecutor-1_3] [workflow_engine]: Finished task "allocate-agent-linux-amazon-2-amd64" execution with result: [2024-04-19 09:43:40] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-amazon-2-amd64/track.yaml [2024-04-19 09:43:41] [DEBUG] ALLOCATOR: Deleting credentials: amazon-2-amd64-key-5465 [2024-04-19 09:44:14] [INFO] ALLOCATOR: Instance i-0adb50dba247267ce deleted. [2024-04-19 09:44:14] [INFO] [65615] [ThreadPoolExecutor-1_3] [workflow_engine]: [allocate-agent-linux-amazon-2-amd64] Finished task in 33.96 seconds. [2024-04-19 09:44:26] [DEBUG] [65615] [ThreadPoolExecutor-1_0] [workflow_engine]: Finished task "allocate-agent-linux-ubuntu-18.04-amd64" execution with result: [2024-04-19 09:43:07] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/agent-linux-ubuntu-18.04-amd64/track.yaml [2024-04-19 09:43:07] [DEBUG] ALLOCATOR: Deleting credentials: ubuntu-18.04-amd64-key-1115 [2024-04-19 09:44:26] [INFO] ALLOCATOR: Instance i-09e1903663f8706a7 deleted. [2024-04-19 09:44:26] [INFO] [65615] [ThreadPoolExecutor-1_0] [workflow_engine]: [allocate-agent-linux-ubuntu-18.04-amd64] Finished task in 79.55 seconds. [2024-04-19 09:44:26] [INFO] [65615] [ThreadPoolExecutor-1_8] [workflow_engine]: [allocate-manager-linux-ubuntu-22.04-amd64] Starting task. [2024-04-19 09:44:26] [DEBUG] [65615] [ThreadPoolExecutor-1_8] [workflow_engine]: Running task "allocate-manager-linux-ubuntu-22.04-amd64" with arguments: ['modules/allocation/main.py', '--action=delete', '--track-output=/tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/track.yaml'] [2024-04-19 09:45:46] [DEBUG] [65615] [ThreadPoolExecutor-1_8] [workflow_engine]: Finished task "allocate-manager-linux-ubuntu-22.04-amd64" execution with result: [2024-04-19 09:44:26] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/dtt1-poc/manager-linux-ubuntu-22.04-amd64/track.yaml [2024-04-19 09:44:27] [DEBUG] ALLOCATOR: Deleting credentials: ubuntu-22.04-amd64-key-2322 [2024-04-19 09:45:46] [INFO] ALLOCATOR: Instance i-0de14d1fb21f4fe75 deleted. [2024-04-19 09:45:46] [INFO] [65615] [ThreadPoolExecutor-1_8] [workflow_engine]: [allocate-manager-linux-ubuntu-22.04-amd64] Finished task in 79.86 seconds. (dtt-test) marcelo@marcelo-B460-AORUS-PRO-AC:~/wazuh/wazuh-qa/deployability$