Skip to content

Add CI tests for toolbox, mcp and langchain #32

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

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Run Integration tests

on:
push:
branches:
- main
pull_request:

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11.0

- name: Start Memgraph container
run: |
docker run -d -p 7687:7687 --name memgraph memgraph/memgraph-mage:latest --schema-info-enabled=True --telemetry-enabled=false
sleep 5 # Wait for Memgraph to start

- name: Install uv
run: python -m pip install uv

- name: Create virtual environment for memgraph-toolbox
working-directory: memgraph-toolbox
run: uv venv

- name: Install dependencies for core package
working-directory: memgraph-toolbox
run: |
uv pip install -e .[test]

- name: Run tests for core package
working-directory: memgraph-toolbox
run: uv run pytest .

- name: Create virtual environment for mcp package
working-directory: integrations/mcp-memgraph
run: uv venv

- name: Install dependencies for mcp package
working-directory: integrations/mcp-memgraph
run: |
uv pip install -e .[test]

- name: Run tests for mcp package
working-directory: integrations/mcp-memgraph
run: uv run pytest .

- name: Create virtual environment for langchain package
working-directory: integrations/langchain-memgraph
run: uv venv

- name: Install dependencies for langchain package
working-directory: integrations/langchain-memgraph
run: |
uv pip install -e .[test]

- name: Run tests for langchain package
working-directory: integrations/langchain-memgraph
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: uv run pytest .
4 changes: 4 additions & 0 deletions integrations/mcp-memgraph/src/mcp_memgraph/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
get_triggers,
get_betweenness_centrality,
get_page_rank,
mcp,
logger,
)

__all__ = [
Expand All @@ -20,4 +22,6 @@
"get_triggers",
"get_betweenness_centrality",
"get_page_rank",
"mcp",
"logger",
]
4 changes: 1 addition & 3 deletions integrations/mcp-memgraph/src/mcp_memgraph/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

import os
from .server import mcp, logger

from mcp_memgraph.server import mcp, logger


def main():
Expand Down
4 changes: 2 additions & 2 deletions integrations/mcp-memgraph/tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async def connect_to_server(self, server_script_path: str):
@pytest.mark.asyncio
async def test_mcp_client():
"""Test the MCP client connection to the server."""
server_script_path = "integrations/mcp-memgraph/src/mcp_memgraph/server.py"
server_script_path = "src/mcp_memgraph/main.py"
client = MCPClient()
try:
await client.connect_to_server(server_script_path)
Expand Down Expand Up @@ -93,7 +93,7 @@ async def test_get_schema():
@pytest.mark.asyncio
async def test_tools_and_resources():
"""Test that all tools and resources are present in the MCP server."""
server_script_path = "integrations/mcp-memgraph/src/mcp_memgraph/server.py"
server_script_path = "src/mcp_memgraph/main.py"
client = MCPClient()
try:
await client.connect_to_server(server_script_path)
Expand Down
20 changes: 15 additions & 5 deletions integrations/mcp-memgraph/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions memgraph-toolbox/src/memgraph_toolbox/tests/test_toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def test_memgraph_toolkit():
"""Test the Memgraph Toolkit."""

url = "bolt://localhost:7687"
user = "memgraph"
password = "memgraph"
user = ""
password = ""

memgraph_client = Memgraph(url=url, username=user, password=password)

Expand Down
36 changes: 18 additions & 18 deletions memgraph-toolbox/src/memgraph_toolbox/tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def test_show_schema_info_tool():
"""Test the ShowSchemaInfo tool."""

url = "bolt://localhost:7687"
user = "memgraph"
password = "memgraph"
user = ""
password = ""

memgraph_client = Memgraph(url=url, username=user, password=password)

Expand All @@ -37,8 +37,8 @@ def test_show_config_tool():
"""Test the ShowConfig tool."""

url = "bolt://localhost:7687"
user = "memgraph"
password = "memgraph"
user = ""
password = ""

memgraph_client = Memgraph(url=url, username=user, password=password)

Expand All @@ -53,8 +53,8 @@ def test_index_tool():
"""Test the ShowIndexInfo tool."""

url = "bolt://localhost:7687"
user = "memgraph"
password = "memgraph"
user = ""
password = ""

memgraph_client = Memgraph(url=url, username=user, password=password)

Expand All @@ -77,8 +77,8 @@ def test_storage_tool():
"""Test the ShowStorageInfo tool."""

url = "bolt://localhost:7687"
user = "memgraph"
password = "memgraph"
user = ""
password = ""

memgraph_client = Memgraph(url=url, username=user, password=password)

Expand All @@ -93,8 +93,8 @@ def test_storage_tool():
def test_show_constraint_info_tool():
"""Test the ShowConstraintInfo tool."""
url = "bolt://localhost:7687"
user = "memgraph"
password = "memgraph"
user = ""
password = ""
memgraph_client = Memgraph(url=url, username=user, password=password)
# Create a sample constraint
memgraph_client.query("CREATE CONSTRAINT ON (n:Person) ASSERT n.id IS UNIQUE")
Expand All @@ -112,8 +112,8 @@ def test_show_triggers_tool():
"""Test the ShowTriggers tool."""

url = "bolt://localhost:7687"
user = "memgraph"
password = "memgraph"
user = ""
password = ""
memgraph_client = Memgraph(url=url, username=user, password=password)

memgraph_client.query(
Expand All @@ -137,8 +137,8 @@ def test_page_rank():
"""Test the PageRank tool."""

url = "bolt://localhost:7687"
user = "memgraph"
password = "memgraph"
user = ""
password = ""
memgraph_client = Memgraph(url=url, username=user, password=password)

# Create a sample graph for testing
Expand All @@ -159,8 +159,8 @@ def test_cypher():
"""Test the Cypher tool."""

url = "bolt://localhost:7687"
user = "memgraph"
password = "memgraph"
user = ""
password = ""
memgraph_client = Memgraph(url=url, username=user, password=password)

cypher_tool = CypherTool(db=memgraph_client)
Expand All @@ -173,8 +173,8 @@ def test_betweenness_centrality_tool():
"""Test the RunBetweennessCentralityTool."""

url = "bolt://localhost:7687"
user = "memgraph"
password = "memgraph"
user = ""
password = ""
memgraph_client = Memgraph(url=url, username=user, password=password)

memgraph_client.query(
Expand Down
2 changes: 1 addition & 1 deletion memgraph-toolbox/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.