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

Accumulator script used in functional tests not working #1630

Open
ravaga opened this issue Jul 2, 2024 · 5 comments
Open

Accumulator script used in functional tests not working #1630

ravaga opened this issue Jul 2, 2024 · 5 comments
Assignees

Comments

@ravaga
Copy link

ravaga commented Jul 2, 2024

The accumulator Python script that is used in the functional tests fails when trying to run a functional tests that uses it. Therefore, the functional test also fails due to the impossibility of starting the accumulator server.

After inspecting the logs of the test, I found in a StackOverflow post that the problem was related with the Werkzeug dependency version that is included in Flask by default (Werkzeug>=2.2.0), because the accumulator uses version 2.0.3 of Flask, which doesn't support Werkzeug version 3.0.0.

A possible solution is to frozen the version of Werkzeug to the 2.2.2 by adding Werkzeug==2.2.2 in the requirements.txt file. Another solution could be to update the Flask version.

@kzangeli
Copy link
Collaborator

kzangeli commented Jul 2, 2024

ok, interesting.
I have no problems with it myself, nor in github actions, so, are you trying something new?
What exactly is failing?

@kzangeli kzangeli self-assigned this Jul 2, 2024
@ravaga
Copy link
Author

ravaga commented Jul 2, 2024

Actually it's installed the 3.0.3 version of Werkzeug (I guess it's the latest).

I'm using Python 3.8.10 and Ubuntu 20.04 as recommended. The requirements of the accumulator are installed without problems, but when I try to manually run the accumulator-server.py this is the output:

Traceback (most recent call last):
  File "scripts/accumulator-server.py", line 39, in <module>
    from flask import Flask, request, Response
  File "/home/ubuntu/git/context.Orion-LD/.venv/lib/python3.8/site-packages/flask/__init__.py", line 7, in <module>
    from .app import Flask as Flask
  File "/home/ubuntu/git/context.Orion-LD/.venv/lib/python3.8/site-packages/flask/app.py", line 28, in <module>
    from . import cli
  File "/home/ubuntu/git/context.Orion-LD/.venv/lib/python3.8/site-packages/flask/cli.py", line 18, in <module>
    from .helpers import get_debug_flag
  File "/home/ubuntu/git/context.Orion-LD/.venv/lib/python3.8/site-packages/flask/helpers.py", line 16, in <module>
    from werkzeug.urls import url_quote
ImportError: cannot import name 'url_quote' from 'werkzeug.urls' (/home/ubuntu/git/context.Orion-LD/.venv/lib/python3.8/site-packages/werkzeug/urls.py)

Then, an error appears if I try to reinstall the requirements:

Traceback (most recent call last):
  File "/home/ubuntu/git/context.Orion-LD/.venv/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
  File "/home/ubuntu/git/context.Orion-LD/.venv/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/home/ubuntu/git/context.Orion-LD/.venv/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/home/ubuntu/git/context.Orion-LD/.venv/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "/home/ubuntu/git/context.Orion-LD/.venv/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
    from pip._internal.exceptions import CommandError
  File "/home/ubuntu/git/context.Orion-LD/.venv/lib/python3.8/site-packages/pip/_internal/exceptions.py", line 10, in <module>
    from pip._vendor.six import iteritems
  File "/home/ubuntu/git/context.Orion-LD/.venv/lib/python3.8/site-packages/pip/_vendor/__init__.py", line 65, in <module>
    vendored("cachecontrol")
  File "/home/ubuntu/git/context.Orion-LD/.venv/lib/python3.8/site-packages/pip/_vendor/__init__.py", line 36, in vendored
    __import__(modulename, globals(), locals(), level=0)
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl/cachecontrol/__init__.py", line 9, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl/cachecontrol/wrapper.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl/cachecontrol/adapter.py", line 5, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/share/python-wheels/requests-2.22.0-py2.py3-none-any.whl/requests/__init__.py", line 95, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/share/python-wheels/urllib3-1.25.8-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 46, in <module>
  File "/home/ubuntu/git/context.Orion-LD/.venv/lib/python3.8/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/home/ubuntu/git/context.Orion-LD/.venv/lib/python3.8/site-packages/OpenSSL/crypto.py", line 1570, in <module>
    class X509StoreFlags(object):
  File "/home/ubuntu/git/context.Orion-LD/.venv/lib/python3.8/site-packages/OpenSSL/crypto.py", line 1589, in X509StoreFlags
    NOTIFY_POLICY = _lib.X509_V_FLAG_NOTIFY_POLICY
AttributeError: module 'lib' has no attribute 'X509_V_FLAG_NOTIFY_POLICY'

@kzangeli
Copy link
Collaborator

kzangeli commented Jul 3, 2024

ok, fails when started manually.
What about inside the functersts?
Does it fail there too?

@ravaga
Copy link
Author

ravaga commented Jul 3, 2024

Yes, it also fails inside the functests, the reason for manually starting it was to have another proof.

When running, for instance, the ngsild_new_distributed_subscription_creation test, this is the content of the ngsild_new_distributed_subscription_creation.shellInit.stdout file.

{ "dropped" : "ftest", "ok" : 1 }
{ "dropped" : "ftest_cp1", "ok" : 1 }
accumulator running as PID 460233
Unable to start listening application after waiting 30

If I add Werkzeug==2.2.2 in the requirements.txt file, the test is executed successfully.

@kzangeli
Copy link
Collaborator

kzangeli commented Jul 3, 2024

If I add Werkzeug==2.2.2 in the requirements.txt file, the test is executed successfully

Yeah, see if we can figure out how to fix this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants