From 01632988fe4811af29e929a68d0c68c4717d94a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Mili=C4=87evi=C4=87?= <85933103+siillee@users.noreply.github.com> Date: Thu, 9 Oct 2025 12:39:18 +0200 Subject: [PATCH] test: replace neo4j usages in cicd with reusable local instances (#1507) ## Description Changed from remote to local Neo4j instance in tests because CI was failing due to multiple tests using the remote instance in parallel. ## Type of Change - [ ] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [x] Code refactoring - [ ] Performance improvement - [ ] Other (please specify): ## Screenshots/Videos (if applicable) ## Pre-submission Checklist - [x] **I have tested my changes thoroughly before submitting this PR** - [x] **This PR contains minimal changes necessary to address the issue/feature** - [ ] My code follows the project's coding standards and style guidelines - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have added necessary documentation (if applicable) - [ ] All new and existing tests pass - [ ] I have searched existing PRs to ensure this change hasn't been submitted already - [ ] I have linked any relevant issues in the description - [ ] My commits have clear and descriptive messages ## DCO Affirmation I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin. --------- Co-authored-by: Andrej Milicevic Co-authored-by: Igor Ilic <30923996+dexters1@users.noreply.github.com> --- .github/workflows/db_examples_tests.yml | 10 ++-- .github/workflows/graph_db_tests.yml | 10 ++-- .../relational_db_migration_tests.yml | 10 ++-- .github/workflows/search_db_tests.yml | 47 ++++++------------- .github/workflows/temporal_graph_tests.yml | 24 +++------- .github/workflows/weighted_edges_tests.yml | 7 +++ 6 files changed, 49 insertions(+), 59 deletions(-) diff --git a/.github/workflows/db_examples_tests.yml b/.github/workflows/db_examples_tests.yml index a1a81b4d4..51ac9a82a 100644 --- a/.github/workflows/db_examples_tests.yml +++ b/.github/workflows/db_examples_tests.yml @@ -54,6 +54,10 @@ jobs: with: python-version: ${{ inputs.python-version }} + - name: Setup Neo4j with GDS + uses: ./.github/actions/setup_neo4j + id: neo4j + - name: Run Neo4j Example env: ENV: dev @@ -66,9 +70,9 @@ jobs: EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }} EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }} GRAPH_DATABASE_PROVIDER: "neo4j" - GRAPH_DATABASE_URL: ${{ secrets.NEO4J_API_URL }} - GRAPH_DATABASE_USERNAME: "neo4j" - GRAPH_DATABASE_PASSWORD: ${{ secrets.NEO4J_API_KEY }} + GRAPH_DATABASE_URL: ${{ steps.neo4j.outputs.neo4j-url }} + GRAPH_DATABASE_USERNAME: ${{ steps.neo4j.outputs.neo4j-username }} + GRAPH_DATABASE_PASSWORD: ${{ steps.neo4j.outputs.neo4j-password }} run: | uv run python examples/database_examples/neo4j_example.py diff --git a/.github/workflows/graph_db_tests.yml b/.github/workflows/graph_db_tests.yml index e7e5a11b8..b07f6232f 100644 --- a/.github/workflows/graph_db_tests.yml +++ b/.github/workflows/graph_db_tests.yml @@ -71,6 +71,10 @@ jobs: with: python-version: ${{ inputs.python-version }} + - name: Setup Neo4j with GDS + uses: ./.github/actions/setup_neo4j + id: neo4j + - name: Run default Neo4j env: ENV: 'dev' @@ -83,9 +87,9 @@ jobs: EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }} EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }} GRAPH_DATABASE_PROVIDER: "neo4j" - GRAPH_DATABASE_URL: ${{ secrets.NEO4J_API_URL }} - GRAPH_DATABASE_PASSWORD: ${{ secrets.NEO4J_API_KEY }} - GRAPH_DATABASE_USERNAME: "neo4j" + GRAPH_DATABASE_URL: ${{ steps.neo4j.outputs.neo4j-url }} + GRAPH_DATABASE_USERNAME: ${{ steps.neo4j.outputs.neo4j-username }} + GRAPH_DATABASE_PASSWORD: ${{ steps.neo4j.outputs.neo4j-password }} run: uv run python ./cognee/tests/test_neo4j.py - name: Run Weighted Edges Tests with Neo4j diff --git a/.github/workflows/relational_db_migration_tests.yml b/.github/workflows/relational_db_migration_tests.yml index 26fd7e150..6a37e308e 100644 --- a/.github/workflows/relational_db_migration_tests.yml +++ b/.github/workflows/relational_db_migration_tests.yml @@ -186,6 +186,10 @@ jobs: python-version: '3.11.x' extra-dependencies: "postgres" + - name: Setup Neo4j with GDS + uses: ./.github/actions/setup_neo4j + id: neo4j + - name: Install specific db dependency run: echo "Dependencies already installed in setup" @@ -206,9 +210,9 @@ jobs: env: ENV: 'dev' GRAPH_DATABASE_PROVIDER: "neo4j" - GRAPH_DATABASE_URL: ${{ secrets.NEO4J_API_URL }} - GRAPH_DATABASE_PASSWORD: ${{ secrets.NEO4J_API_KEY }} - GRAPH_DATABASE_USERNAME: "neo4j" + GRAPH_DATABASE_URL: ${{ steps.neo4j.outputs.neo4j-url }} + GRAPH_DATABASE_USERNAME: ${{ steps.neo4j.outputs.neo4j-username }} + GRAPH_DATABASE_PASSWORD: ${{ steps.neo4j.outputs.neo4j-password }} LLM_PROVIDER: openai LLM_MODEL: ${{ secrets.LLM_MODEL }} diff --git a/.github/workflows/search_db_tests.yml b/.github/workflows/search_db_tests.yml index 0b749526d..e3e46dd97 100644 --- a/.github/workflows/search_db_tests.yml +++ b/.github/workflows/search_db_tests.yml @@ -51,20 +51,6 @@ jobs: name: Search test for Neo4j/LanceDB/Sqlite runs-on: ubuntu-22.04 if: ${{ inputs.databases == 'all' || contains(inputs.databases, 'neo4j/lance/sqlite') }} - services: - neo4j: - image: neo4j:5.11 - env: - NEO4J_AUTH: neo4j/pleaseletmein - NEO4J_PLUGINS: '["apoc","graph-data-science"]' - ports: - - 7474:7474 - - 7687:7687 - options: >- - --health-cmd="cypher-shell -u neo4j -p pleaseletmein 'RETURN 1'" - --health-interval=10s - --health-timeout=5s - --health-retries=5 steps: - name: Check out @@ -77,6 +63,10 @@ jobs: with: python-version: ${{ inputs.python-version }} + - name: Setup Neo4j with GDS + uses: ./.github/actions/setup_neo4j + id: neo4j + - name: Dependencies already installed run: echo "Dependencies already installed in setup" @@ -94,9 +84,9 @@ jobs: GRAPH_DATABASE_PROVIDER: 'neo4j' VECTOR_DB_PROVIDER: 'lancedb' DB_PROVIDER: 'sqlite' - GRAPH_DATABASE_URL: bolt://localhost:7687 - GRAPH_DATABASE_USERNAME: neo4j - GRAPH_DATABASE_PASSWORD: pleaseletmein + GRAPH_DATABASE_URL: ${{ steps.neo4j.outputs.neo4j-url }} + GRAPH_DATABASE_USERNAME: ${{ steps.neo4j.outputs.neo4j-username }} + GRAPH_DATABASE_PASSWORD: ${{ steps.neo4j.outputs.neo4j-password }} run: uv run python ./cognee/tests/test_search_db.py run-kuzu-pgvector-postgres-search-tests: @@ -158,19 +148,6 @@ jobs: runs-on: ubuntu-22.04 if: ${{ inputs.databases == 'all' || contains(inputs.databases, 'neo4j/pgvector/postgres') }} services: - neo4j: - image: neo4j:5.11 - env: - NEO4J_AUTH: neo4j/pleaseletmein - NEO4J_PLUGINS: '["apoc","graph-data-science"]' - ports: - - 7474:7474 - - 7687:7687 - options: >- - --health-cmd="cypher-shell -u neo4j -p pleaseletmein 'RETURN 1'" - --health-interval=10s - --health-timeout=5s - --health-retries=5 postgres: image: pgvector/pgvector:pg17 env: @@ -196,6 +173,10 @@ jobs: python-version: ${{ inputs.python-version }} extra-dependencies: "postgres" + - name: Setup Neo4j with GDS + uses: ./.github/actions/setup_neo4j + id: neo4j + - name: Dependencies already installed run: echo "Dependencies already installed in setup" @@ -213,9 +194,9 @@ jobs: GRAPH_DATABASE_PROVIDER: 'neo4j' VECTOR_DB_PROVIDER: 'pgvector' DB_PROVIDER: 'postgres' - GRAPH_DATABASE_URL: bolt://localhost:7687 - GRAPH_DATABASE_USERNAME: neo4j - GRAPH_DATABASE_PASSWORD: pleaseletmein + GRAPH_DATABASE_URL: ${{ steps.neo4j.outputs.neo4j-url }} + GRAPH_DATABASE_USERNAME: ${{ steps.neo4j.outputs.neo4j-username }} + GRAPH_DATABASE_PASSWORD: ${{ steps.neo4j.outputs.neo4j-password }} DB_NAME: cognee_db DB_HOST: 127.0.0.1 DB_PORT: 5432 diff --git a/.github/workflows/temporal_graph_tests.yml b/.github/workflows/temporal_graph_tests.yml index 4156dffff..66f7d60ee 100644 --- a/.github/workflows/temporal_graph_tests.yml +++ b/.github/workflows/temporal_graph_tests.yml @@ -51,20 +51,6 @@ jobs: name: Temporal Graph test Neo4j (lancedb + sqlite) runs-on: ubuntu-22.04 if: ${{ inputs.databases == 'all' || contains(inputs.databases, 'neo4j/lance/sqlite') }} - services: - neo4j: - image: neo4j:5.11 - env: - NEO4J_AUTH: neo4j/pleaseletmein - NEO4J_PLUGINS: '["apoc","graph-data-science"]' - ports: - - 7474:7474 - - 7687:7687 - options: >- - --health-cmd="cypher-shell -u neo4j -p pleaseletmein 'RETURN 1'" - --health-interval=10s - --health-timeout=5s - --health-retries=5 steps: - name: Check out @@ -77,6 +63,10 @@ jobs: with: python-version: ${{ inputs.python-version }} + - name: Setup Neo4j with GDS + uses: ./.github/actions/setup_neo4j + id: neo4j + - name: Dependencies already installed run: echo "Dependencies already installed in setup" @@ -94,9 +84,9 @@ jobs: GRAPH_DATABASE_PROVIDER: 'neo4j' VECTOR_DB_PROVIDER: 'lancedb' DB_PROVIDER: 'sqlite' - GRAPH_DATABASE_URL: bolt://localhost:7687 - GRAPH_DATABASE_USERNAME: neo4j - GRAPH_DATABASE_PASSWORD: pleaseletmein + GRAPH_DATABASE_URL: ${{ steps.neo4j.outputs.neo4j-url }} + GRAPH_DATABASE_USERNAME: ${{ steps.neo4j.outputs.neo4j-username }} + GRAPH_DATABASE_PASSWORD: ${{ steps.neo4j.outputs.neo4j-password }} run: uv run python ./cognee/tests/test_temporal_graph.py run_temporal_graph_kuzu_postgres_pgvector: diff --git a/.github/workflows/weighted_edges_tests.yml b/.github/workflows/weighted_edges_tests.yml index df5e048f2..874ef6ea4 100644 --- a/.github/workflows/weighted_edges_tests.yml +++ b/.github/workflows/weighted_edges_tests.yml @@ -86,12 +86,19 @@ jobs: with: python-version: '3.11' + - name: Setup Neo4j with GDS + uses: ./.github/actions/setup_neo4j + id: neo4j + - name: Dependencies already installed run: echo "Dependencies already installed in setup" - name: Run Weighted Edges Tests env: GRAPH_DATABASE_PROVIDER: ${{ matrix.graph_db_provider }} + GRAPH_DATABASE_URL: ${{ matrix.graph_db_provider == 'neo4j' && steps.neo4j.outputs.neo4j-url || '' }} + GRAPH_DATABASE_USERNAME: ${{ matrix.graph_db_provider == 'neo4j' && steps.neo4j.outputs.neo4j-username || '' }} + GRAPH_DATABASE_PASSWORD: ${{ matrix.graph_db_provider == 'neo4j' && steps.neo4j.outputs.neo4j-password || '' }} run: | uv run pytest cognee/tests/unit/interfaces/graph/test_weighted_edges.py -v --tb=short