Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wazuh-DB integration tests won't run due to an old dependency #5280

Open
vikman90 opened this issue Apr 22, 2024 · 0 comments
Open

Wazuh-DB integration tests won't run due to an old dependency #5280

vikman90 opened this issue Apr 22, 2024 · 0 comments
Labels
dependencies Add remove or update any dependency level/task Task issue test/integration type/bug

Comments

@vikman90
Copy link
Member

vikman90 commented Apr 22, 2024

Branch Offending dependency Sample test
4.8.0 py < 3.11.0 test_agent_database_version

We've run into some trouble launching the Wazuh-DB integration tests.

Environment

Python OS Environment
3.11.6 Ubuntu 23.10 @ aarch64 VM @ macOS 14.4 @ Apple M3

Current behavior

Setup

apt install python3-venv

cd wazuh-qa
python3 -m venv venv

source venv/bin/activate

pip3 install -r requirements.txt
cd deps/wazuh_testing
python3 setup.py install

cd ../..

Command

python3 -m pytest -vvvs tests/integration/test_wazuh_db/test_agent_database_version.py
Output
Traceback (most recent call last):
  File "/root/wazuh-qa/venv/lib/python3.11/site-packages/py/_vendored_packages/apipkg/__init__.py", line 145, in __makeattr
    modpath, attrname = self.__map__[name]
                        ~~~~~~~~~~~~^^^^^^
KeyError: '__spec__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 189, in _run_module_as_main
  File "<frozen runpy>", line 148, in _get_module_details
  File "<frozen runpy>", line 112, in _get_module_details
  File "/root/wazuh-qa/venv/lib/python3.11/site-packages/pytest/__init__.py", line 5, in <module>
    from _pytest._code import ExceptionInfo
  File "/root/wazuh-qa/venv/lib/python3.11/site-packages/_pytest/_code/__init__.py", line 2, in <module>
    from .code import Code
  File "/root/wazuh-qa/venv/lib/python3.11/site-packages/_pytest/_code/code.py", line 43, in <module>
    from _pytest._io import TerminalWriter
  File "/root/wazuh-qa/venv/lib/python3.11/site-packages/_pytest/_io/__init__.py", line 1, in <module>
    from .terminalwriter import get_terminal_width
  File "/root/wazuh-qa/venv/lib/python3.11/site-packages/_pytest/_io/terminalwriter.py", line 10, in <module>
    from _pytest.compat import final
  File "/root/wazuh-qa/venv/lib/python3.11/site-packages/_pytest/compat.py", line 35, in <module>
    LEGACY_PATH = py.path. local
                  ^^^^^^^^^^^^^^
  File "/root/wazuh-qa/venv/lib/python3.11/site-packages/py/_vendored_packages/apipkg/__init__.py", line 152, in __makeattr
    result = importobj(modpath, attrname)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/wazuh-qa/venv/lib/python3.11/site-packages/py/_vendored_packages/apipkg/__init__.py", line 72, in importobj
    module = __import__(modpath, None, None, ['__doc__'])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1136, in _find_and_load_unlocked
  File "/root/wazuh-qa/venv/lib/python3.11/site-packages/py/_vendored_packages/apipkg/__init__.py", line 150, in __makeattr
    raise AttributeError(name)
AttributeError: __spec__

Fixing the issue

@juliamagan found out that this problem is caused by an old version of py. We need py ≥ 3.11.0.

pip3 install py==1.11.0
python3 -m pytest -vvvs tests/integration/test_wazuh_db/test_agent_database_version.py
Output
============================= test session starts ==============================
platform linux -- Python 3.11.6, pytest-7.1.2, pluggy-1.5.0 -- /root/wazuh-qa/venv/bin/python3
cachedir: .pytest_cache
metadata: {'Python': '3.11.6', 'Platform': 'Linux-6.5.0-28-generic-aarch64-with-glibc2.38', 'Packages': {'pytest': '7.1.2', 'pluggy': '1.5.0'}, 'Plugins': {'testinfra': '5.0.0', 'html': '3.1.1', 'metadata': '3.1.1'}}
rootdir: /root/wazuh-qa/tests/integration, configfile: pytest.ini
plugins: testinfra-5.0.0, html-3.1.1, metadata-3.1.1
collected 1 item

tests/integration/test_wazuh_db/test_agent_database_version.py::test_agent_database_version PASSED

============================== 1 passed in 33.42s ==============================
@vikman90 vikman90 added level/task Task issue type/bug test/integration dependencies Add remove or update any dependency labels Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Add remove or update any dependency level/task Task issue test/integration type/bug
Projects
None yet
Development

No branches or pull requests

1 participant