From d307a11bd2de050a99c0f59a56487d94d01a9444 Mon Sep 17 00:00:00 2001 From: Renan Souza Date: Mon, 9 Dec 2024 16:53:37 -0500 Subject: [PATCH] Fix gh actions --- .github/workflows/run-tests-simple.yml | 11 ++++++++--- .github/workflows/run-tests.yml | 12 +++++++++--- Makefile | 2 +- src/flowcept/configs.py | 14 ++++++++------ 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/.github/workflows/run-tests-simple.yml b/.github/workflows/run-tests-simple.yml index 0c0fcf97..2af6baf5 100644 --- a/.github/workflows/run-tests-simple.yml +++ b/.github/workflows/run-tests-simple.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest env: MONGO_ENABLED: false - timeout-minutes: 40 + timeout-minutes: 60 if: "!contains(github.event.head_commit.message, 'CI Bot')" steps: @@ -33,9 +33,14 @@ jobs: - name: Upgrade pip run: python -m pip install --upgrade pip - - name: Install default dependencies and run simple test + - name: Install basic deps + run: pip install . + + - name: Check dbs utilization + run: python -c "from flowcept.configs import MONGO_ENABLED, LMDB_ENABLED; print('MONGO?', MONGO_ENABLED); print('LMDB?', LMDB_ENABLED)" + + - name: Run simple test run: | - pip install . python examples/simple_instrumented_script.py | tee output.log cat output.log grep -q "ERROR" output.log && exit 1 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 7f47f1dd..84f96406 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -11,7 +11,7 @@ jobs: env: MONGO_ENABLED: true LMDB_ENABLED: false - timeout-minutes: 40 + timeout-minutes: 60 if: "!contains(github.event.head_commit.message, 'CI Bot')" steps: @@ -34,13 +34,19 @@ jobs: - name: Upgrade pip run: python -m pip install --upgrade pip - - name: Install default dependencies and run simple test + - name: Install basic deps + run: pip install .[mongo] + + - name: Check dbs utilization + run: python -c "from flowcept.configs import MONGO_ENABLED, LMDB_ENABLED; print('MONGO?', MONGO_ENABLED); print('LMDB?', LMDB_ENABLED)" + + - name: Run simple test run: | - pip install .[mongo] python examples/simple_instrumented_script.py | tee output.log cat output.log grep -q "ERROR" output.log && exit 1 rm output.log + - name: Install Dask dependencies alone and run a simple Dask test run: | diff --git a/Makefile b/Makefile index 58e9038d..d3420c1f 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,7 @@ tests-in-container-mongo: docker run --rm -v $(shell pwd):/flowcept -e KVDB_HOST=flowcept_redis -e MQ_HOST=flowcept_redis -e MONGO_HOST=flowcept_mongo --network flowcept_default flowcept /opt/conda/envs/flowcept/bin/pytest --ignore=tests/decorator_tests/ml_tests tests-in-container: - docker run --rm -v $(shell pwd):/flowcept -e KVDB_HOST=flowcept_redis -e MQ_HOST=flowcept_redis -e MONGO_ENABLED=false --network flowcept_default flowcept /opt/conda/envs/flowcept/bin/pytest --ignore=tests/decorator_tests/ml_tests + docker run --rm -v $(shell pwd):/flowcept -e KVDB_HOST=flowcept_redis -e MQ_HOST=flowcept_redis -e MONGO_ENABLED=false -e LMDB_ENABLED=true --network flowcept_default flowcept /opt/conda/envs/flowcept/bin/pytest --ignore=tests/decorator_tests/ml_tests # This command can be removed once we have our CLI liveness: diff --git a/src/flowcept/configs.py b/src/flowcept/configs.py index 3d1b5575..6336223f 100644 --- a/src/flowcept/configs.py +++ b/src/flowcept/configs.py @@ -83,9 +83,10 @@ _mongo_settings = DATABASES.get("mongodb", None) MONGO_ENABLED = False if _mongo_settings: - MONGO_ENABLED = ( - os.environ.get("MONGO_ENABLED", "false").lower() == "true" - ) or _mongo_settings.get("enabled") + if "MONGO_ENABLED" in os.environ: + MONGO_ENABLED = (os.environ.get("MONGO_ENABLED").lower() == "true") + else: + MONGO_ENABLED = _mongo_settings.get("enabled", False) MONGO_URI = os.environ.get("MONGO_URI") or _mongo_settings.get("uri") MONGO_HOST = os.environ.get("MONGO_HOST") or _mongo_settings.get("host", "localhost") MONGO_PORT = int(os.environ.get("MONGO_PORT") or _mongo_settings.get("port", 27017)) @@ -98,9 +99,10 @@ _lmdb_settings = DATABASES.get("lmdb", None) LMDB_ENABLED = False if _lmdb_settings: - LMDB_ENABLED = ( - os.environ.get("LMDB_ENABLED", "false").lower() == "true" - ) or _lmdb_settings.get("enabled", False) + if "LMDB_ENABLED" in os.environ: + LMDB_ENABLED = (os.environ.get("LMDB_ENABLED").lower() == "true") + else: + LMDB_ENABLED = _lmdb_settings.get("enabled", False) ########################## # Buffer Settings #