orchestracities / ngsi-timeseries-api

QuantumLeap: a FIWARE Generic Enabler to support the usage of NGSIv2 (and NGSI-LD experimentally) data in time-series databases
https://quantumleap.rtfd.io/
MIT License
37 stars 49 forks source link

Can't run the tests locally #700

Open rohit-vrrr opened 1 year ago

rohit-vrrr commented 1 year ago

Describe the bug Running the tests locally throws ModuleNotFoundError. Here's the logs that I get.

creating test directory...
=======================================================================
        TRANSLATOR TESTS
=======================================================================
================================================= test session starts ==================================================
platform linux -- Python 3.8.10, pytest-3.10.1, py-1.11.0, pluggy-1.0.0
rootdir: /home/rohit/Projects/ngsi-timeseries-api/src, inifile: pytest.ini
plugins: flask-0.15.1, lovely-pytest-docker-0.3.0, lazy-fixture-0.6.3, cov-2.7.1
collected 0 items / 16 errors

======================================================== ERRORS ========================================================
________________________________ ERROR collecting translators/tests/test_aggregation.py ________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/translators/tests/test_aggregation.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
src/translators/tests/test_aggregation.py:5: in <module>
    from conftest import crate_translator, timescale_translator
E   ModuleNotFoundError: No module named 'conftest'
___________________________________ ERROR collecting translators/tests/test_crate.py ___________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/translators/tests/test_crate.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
src/translators/tests/test_crate.py:1: in <module>
    from translators.sql_translator import METADATA_TABLE_NAME, TYPE_PREFIX
Pulling crate                ... done
Pulling quantumleap          ... done
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/translators/tests/test_crate_auth.Pulling crate                ... pulling from library/crate
ERROR: for timescale  manifest for timescale/timescaledb-postgis:latest not found: manifest unknown: manifest unknown
WARNING: Some service image(s) must be built from source by running:
    docker-compose build quantumleap-db-setupn <module>
ERROR: manifest for timescale/timescaledb-postgis:latest not found: manifest unknown: manifest unknown
E   ModuleNotFoundError: No module named 'utils'
______________________________ ERROR collecting translators/tests/test_crate_geo_query.py ______________________________
Launch services with previous CRATE and QL versionit/Projects/ngsi-timeseries-api/src/translators/tests/test_crate_geo_q
WARNING: The TIMESCALE_VERSION variable is not set. Defaulting to a blank string.
Creating network "tests_default" with the default driverthon names.
ERROR: no such image: timescale/timescaledb-postgis:: invalid reference format
Testing http://localhost:4200ate_geo_query.py:1: in <module>
Waiting for http://localhost:4200ery import from_ngsi_query
Elapsed time: 5undError: No module named 'translators'
Waiting for http://localhost:4200_ ERROR collecting translators/tests/test_delete.py ___________________________________
Elapsed time: 10e importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/translators/tests/test_delete.py'.
Waiting for http://localhost:4200/packages have valid Python names.
Elapsed time: 15
Waiting for http://localhost:4200.py:6: in <module>
Elapsed time: 20t import crate_translator, timescale_translator
Waiting for http://localhost:4200e named 'conftest'
Elapsed time: 25__________________ ERROR collecting translators/tests/test_health.py ___________________________________
Waiting for http://localhost:4200module '/home/rohit/Projects/ngsi-timeseries-api/src/translators/tests/test_health.py'.
Elapsed time: 30your test modules/packages have valid Python names.
Waiting for http://localhost:4200
Elapsed time: 35tests/test_health.py:5: in <module>
timeout while waiting services to be ready timescale_translator
WARNING: The TIMESCALE_VERSION variable is not set. Defaulting to a blank string.
Removing network tests_default____ ERROR collecting translators/tests/test_insert.py ___________________________________
run_tests.sh: 30: exit: Illegal number: -1home/rohit/Projects/ngsi-timeseries-api/src/translators/tests/test_insert.py'.
/home/rohit/Projects/ngsi-timeseries-apies have valid Python names.
=======================================================================
        GEO-CODING TESTSst_insert.py:5: in <module>
=======================================================================
================================================= test session starts ==================================================
platform linux -- Python 3.8.10, pytest-3.10.1, py-1.11.0, pluggy-1.0.0insert_batches.py _______________________________
rootdir: /home/rohit/Projects/ngsi-timeseries-api/src, inifile: pytest.iniies-api/src/translators/tests/test_insert_batc
plugins: flask-0.15.1, lovely-pytest-docker-0.3.0, lazy-fixture-0.6.3, cov-2.7.1
collected 0 items / 10 errors
Traceback:
======================================================== ERRORS ========================================================
______________________________ ERROR collecting geocoding/geojson/tests/test_wktcodec.py _______________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/geocoding/geojson/tests/test_wktcodec.py'._______________________ ERROR collecting translators/tests/test_multientities.py _______________________________
Hint: make sure your test modules/packages have valid Python names.timeseries-api/src/translators/tests/test_multientiti
Traceback:
src/geocoding/geojson/tests/test_wktcodec.py:1: in <module>n names.
    from geocoding.geojson.wktcodec import *
E   ModuleNotFoundError: No module named 'geocoding'module>
________________________________ ERROR collecting geocoding/slf/tests/test_geotypes.py _________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/geocoding/slf/tests/test_geotypes.py'.___________________________ ERROR collecting translators/tests/test_multitenancy.py ________________________________
Hint: make sure your test modules/packages have valid Python names.timeseries-api/src/translators/tests/test_multitenanc
Traceback:
src/geocoding/slf/__init__.py:29: in <module>ve valid Python names.
    from .geotypes import *
src/geocoding/slf/geotypes.py:10: in <module>: in <module>
    from geocoding.centroid import best_effort_centroid2d
E   ModuleNotFoundError: No module named 'geocoding'
________________________________ ERROR collecting geocoding/slf/tests/test_jsoncodec.py ________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/geocoding/slf/tests/test_jsoncodec.py'.'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
src/geocoding/slf/__init__.py:29: in <module>: in <module>
    from .geotypes import *ale import postgres_translator_instance, \
src/geocoding/slf/geotypes.py:10: in <module>nslators'
    from geocoding.centroid import best_effort_centroid2dors/tests/test_pg_conn_data.py ________________________________
E   ModuleNotFoundError: No module named 'geocoding'/Projects/ngsi-timeseries-api/src/translators/tests/test_pg_conn_dat
________________________________ ERROR collecting geocoding/slf/tests/test_locparser.py ________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/geocoding/slf/tests/test_locparser.py'.back:
Hint: make sure your test modules/packages have valid Python names.
Traceback:ranslators.timescale import PostgresConnectionData
src/geocoding/slf/__init__.py:29: in <module>nslators'
    from .geotypes import *____ ERROR collecting translators/tests/test_query_caching.py _______________________________
src/geocoding/slf/geotypes.py:10: in <module>e/rohit/Projects/ngsi-timeseries-api/src/translators/tests/test_query_cachi
    from geocoding.centroid import best_effort_centroid2d
E   ModuleNotFoundError: No module named 'geocoding'd Python names.
_______________________________ ERROR collecting geocoding/slf/tests/test_queryparser.py _______________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/geocoding/slf/tests/test_queryparser.py'.m exceptions.exceptions import AmbiguousNGSIIdError
Hint: make sure your test modules/packages have valid Python names.
Traceback:__________________ ERROR collecting translators/tests/test_timescale_geo_query.py ____________________________
src/geocoding/slf/__init__.py:29: in <module>e/rohit/Projects/ngsi-timeseries-api/src/translators/tests/test_timescale_g
    from .geotypes import *
src/geocoding/slf/geotypes.py:10: in <module>ve valid Python names.
    from geocoding.centroid import best_effort_centroid2d
E   ModuleNotFoundError: No module named 'geocoding' in <module>
________________________________ ERROR collecting geocoding/slf/tests/test_wktcodec.py _________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/geocoding/slf/tests/test_wktcodec.py'._________________________ ERROR collecting translators/tests/test_timescale_insert.py ______________________________
Hint: make sure your test modules/packages have valid Python names.timeseries-api/src/translators/tests/test_timescale_i
Traceback:
src/geocoding/slf/__init__.py:29: in <module>ve valid Python names.
    from .geotypes import *
src/geocoding/slf/geotypes.py:10: in <module>y:7: in <module>
    from geocoding.centroid import best_effort_centroid2dstr
E   ModuleNotFoundError: No module named 'geocoding'
__________________________________ ERROR collecting geocoding/tests/test_centroid.py ___________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/geocoding/tests/test_centroid.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback: sure your test modules/packages have valid Python names.
src/geocoding/tests/test_centroid.py:2: in <module>
    from geocoding.centroid import *r_factory.py:1: in <module>
E   ModuleNotFoundError: No module named 'geocoding'
___________________________________ ERROR collecting geocoding/tests/test_factory.py ___________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/geocoding/tests/test_factory.py'.-
Hint: make sure your test modules/packages have valid Python names.
Traceback:
src/geocoding/tests/test_factory.py:3: in <module>d: 16 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    from conftest import REDIS_HOST, REDIS_PORT 16 error in 0.62 seconds ===============================================
E   ModuleNotFoundError: No module named 'conftest'ators/tests
__________________________________ ERROR collecting geocoding/tests/test_geocoding.py __________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/geocoding/tests/test_geocoding.py'.       REPORTER TESTS
Hint: make sure your test modules/packages have valid Python names.====
Traceback:r while loading conftest '/home/rohit/Projects/ngsi-timeseries-api/src/reporter/tests/conftest.py'.
src/geocoding/tests/test_geocoding.py:5: in <module>
    from conftest import REDIS_HOST, REDIS_PORTstart_embedded_flask
E   ModuleNotFoundError: No module named 'conftest'
__________________________________ ERROR collecting geocoding/tests/test_location.py ___________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/geocoding/tests/test_location.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:mescale            ... error
src/geocoding/tests/test_location.py:2: in <module>
    from geocoding.location import *
E   ModuleNotFoundError: No module named 'geocoding'
------------ generated xml file: /home/rohit/Projects/ngsi-timeseries-api/test-results/junit-geocoding.xml -------------
Pulling redis                ... pulling from library/redis
Step 2/19 : FROM base as builder
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 10 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=============================================== 10 error in 0.41 seconds ===============================================
/home/rohit/Projects/ngsi-timeseries-api/src/geocoding/tests
/home/rohit/Projects/ngsi-timeseries-api
=======================================================================
        CACHE TESTS
=======================================================================
================================================= test session starts ==================================================
platform linux -- Python 3.8.10, pytest-3.10.1, py-1.11.0, pluggy-1.0.0
rootdir: /home/rohit/Projects/ngsi-timeseries-api/src, inifile: pytest.ini
plugins: flask-0.15.1, lovely-pytest-docker-0.3.0, lazy-fixture-0.6.3, cov-2.7.1
collected 0 items / 2 errors
 ---> 1eef82d21ed0
======================================================== ERRORS ========================================================
___________________________________ ERROR collecting cache/tests/test_querycache.py ____________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/cache/tests/test_querycache.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:g cache
src/cache/tests/test_querycache.py:4: in <module>
    from conftest import REDIS_HOST, REDIS_PORT{ pipenv requirements > /requirements.txt; }
E   ModuleNotFoundError: No module named 'conftest'
___________________________________ ERROR collecting cache/tests/test_rediscache.py ____________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/cache/tests/test_rediscache.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:dec7fe4e
src/cache/tests/test_rediscache.py:4: in <module>
    from conftest import REDIS_HOST, REDIS_PORT
E   ModuleNotFoundError: No module named 'conftest'
------------ generated xml file: /home/rohit/Projects/ngsi-timeseries-api/test-results/junit-geocoding.xml -------------
 ---> 0f03316d4a27
Step 13/19 : RUN apk --no-cache add curl
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=============================================== 2 error in 0.30 seconds ================================================
/home/rohit/Projects/ngsi-timeseries-api/src/cache/tests
/home/rohit/Projects/ngsi-timeseries-api
=======================================================================
        SQL TESTS . /src/ngsi-timeseries-api/
=======================================================================
================================================= test session starts ==================================================
platform linux -- Python 3.8.10, pytest-3.10.1, py-1.11.0, pluggy-1.0.0
rootdir: /home/rohit/Projects/ngsi-timeseries-api/src, inifile: pytest.ini
plugins: flask-0.15.1, lovely-pytest-docker-0.3.0, lazy-fixture-0.6.3, cov-2.7.1
collected 0 items / 3 errors
 ---> Running in 796dfafd2de1
======================================================== ERRORS ========================================================
_____________________________________ ERROR collecting sql/ast/test/test_crate.py ______________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/sql/ast/test/test_crate.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:ntermediate container 46d82c646d6d
src/sql/ast/test/test_crate.py:1: in <module>
    from geocoding.slf import *n", "app.py"]
E   ModuleNotFoundError: No module named 'geocoding'
_____________________________________ ERROR collecting sql/ast/test/test_terms.py ______________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/sql/ast/test/test_terms.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:ly tagged orchestracities/quantumleap:latest
src/sql/ast/test/test_terms.py:1: in <module>t set. Defaulting to a blank string.
    from sql.ast.terms import *.
E   ModuleNotFoundError: No module named 'sql'
___________________________________ ERROR collecting sql/ast/test/test_timescale.py ____________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/sql/ast/test/test_timescale.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:antumleap          ...
src/sql/ast/test/test_timescale.py:3: in <module>
    from geocoding.slf import *
E   ModuleNotFoundError: No module named 'geocoding'
--------------- generated xml file: /home/rohit/Projects/ngsi-timeseries-api/test-results/junit-sql.xml ----------------

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=============================================== 3 error in 0.40 seconds ================================================
/home/rohit/Projects/ngsi-timeseries-api/src/sql/tests
/home/rohit/Projects/ngsi-timeseries-api
=======================================================================
        UTILS TESTS
=======================================================================
================================================= test session starts ==================================================
platform linux -- Python 3.8.10, pytest-3.10.1, py-1.11.0, pluggy-1.0.0
rootdir: /home/rohit/Projects/ngsi-timeseries-api/src, inifile: pytest.ini
plugins: flask-0.15.1, lovely-pytest-docker-0.3.0, lazy-fixture-0.6.3, cov-2.7.1
collected 0 items / 10 errors

======================================================== ERRORS ========================================================
_______________________________________ ERROR collecting utils/tests/test_b64.py _______________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/utils/tests/test_b64.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
src/utils/tests/test_b64.py:3: in <module>
    from utils.b64 import *
E   ModuleNotFoundError: No module named 'utils'
____________________________________ ERROR collecting utils/tests/test_cfgreader.py ____________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/utils/tests/test_cfgreader.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
src/utils/tests/test_cfgreader.py:4: in <module>
    from utils.cfgreader import *
E   ModuleNotFoundError: No module named 'utils'
________________________________ ERROR collecting utils/tests/test_itercostsplitter.py _________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/utils/tests/test_itercostsplitter.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
src/utils/tests/test_itercostsplitter.py:4: in <module>
    from utils.itersplit import IterCostSplitter
E   ModuleNotFoundError: No module named 'utils'
____________________________________ ERROR collecting utils/tests/test_jsondict.py _____________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/utils/tests/test_jsondict.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
src/utils/tests/test_jsondict.py:2: in <module>
    from utils.jsondict import *
E   ModuleNotFoundError: No module named 'utils'
_______________________________________ ERROR collecting utils/tests/test_kvt.py _______________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/utils/tests/test_kvt.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
src/utils/tests/test_kvt.py:5: in <module>
    from utils.kvt import node, forest, mforest
E   ModuleNotFoundError: No module named 'utils'
______________________________________ ERROR collecting utils/tests/test_maybe.py ______________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/utils/tests/test_maybe.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
src/utils/tests/test_maybe.py:1: in <module>
    from utils.maybe import *
E   ModuleNotFoundError: No module named 'utils'
_____________________________________ ERROR collecting utils/tests/test_streams.py _____________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/utils/tests/test_streams.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
src/utils/tests/test_streams.py:2: in <module>
    from utils.streams import *
E   ModuleNotFoundError: No module named 'utils'
________________________________ ERROR collecting utils/tests/test_subscription_dsl.py _________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/utils/tests/test_subscription_dsl.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
src/utils/tests/test_subscription_dsl.py:1: in <module>
    from utils.subscription_dsl import throttling
E   ModuleNotFoundError: No module named 'utils'
_____________________________________ ERROR collecting utils/tests/test_thread.py ______________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/utils/tests/test_thread.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
src/utils/tests/test_thread.py:3: in <module>
    from utils.thread import BackgroundRepeater
E   ModuleNotFoundError: No module named 'utils'
_____________________________________ ERROR collecting utils/tests/test_timestr.py _____________________________________
ImportError while importing test module '/home/rohit/Projects/ngsi-timeseries-api/src/utils/tests/test_timestr.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
src/utils/tests/test_timestr.py:3: in <module>
    from utils.timestr import *
E   ModuleNotFoundError: No module named 'utils'
-------------- generated xml file: /home/rohit/Projects/ngsi-timeseries-api/test-results/junit-utils.xml ---------------

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 10 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=============================================== 10 error in 0.40 seconds ===============================================
/home/rohit/Projects/ngsi-timeseries-api/src/utils/tests
/home/rohit/Projects/ngsi-timeseries-api
=======================================================================
        WORK QUEUE TESTS
=======================================================================
ImportError while loading conftest '/home/rohit/Projects/ngsi-timeseries-api/src/wq/tests/conftest.py'.
src/wq/tests/conftest.py:5: in <module>
    from translators.factory import QL_DEFAULT_DB_ENV_VAR, TIMESCALE_BACKEND
E   ModuleNotFoundError: No module named 'translators'
/home/rohit/Projects/ngsi-timeseries-api/src/wq/tests
/home/rohit/Projects/ngsi-timeseries-api

To Reproduce Steps to reproduce the behavior:

  1. In the project root directory run bash run_tests.sh
  2. See errors You'll be getting lot of ModuleNotFoundErrors.

Expected behavior Should be able to see the tests running.

Environment (please complete the following information):

chicco785 commented 1 year ago

did you follow instructions here: https://quantumleap.readthedocs.io/en/latest/user/contributing/ ?

rohit-vrrr commented 1 year ago

Yes, I have followed the instructions there.

When I run source setup_dev_env.sh, I get the following:

alias: Host name lookup failure
ifconfig: `--help' gives usage information.
chicco785 commented 1 year ago

Yes, I have followed the instructions there.

When I run source setup_dev_env.sh, I get the following:

alias: Host name lookup failure
ifconfig: `--help' gives usage information.

probably your operating system is not compatible with this part of the script: https://github.com/orchestracities/ngsi-timeseries-api/blob/master/setup_dev_env.sh#L17

i think this was tested on macosx and ubuntu, on other OSes you are a bit on your own to make it work.

rohit-vrrr commented 1 year ago

I am currently running the project on WSL. OS: Ubuntu 20.04.5 LTS (GNU/Linux 5.10.16.3-microsoft-standard-WSL2 x86_64)

c0c0n3 commented 1 year ago

Hi @rohit-vrrr, unfortunately we don't support Windows/WSL2---in principle it should work, but like you've just shown us, practice is a different story :-)

I suppose you could make it work w/ some tweaks, specifically it looks like the blocker is this line

which aliases 192.0.0.1 to your loopback interface. You should replace that line with a WSL equivalent, see e.g.

Hope this helps!