Skip to content

Commit f5249a9

Browse files
authored
Merge pull request #261 from mattjala/chronomcp_tests
Add ChronoLog MCP unit tests
2 parents e9455fb + d87dd74 commit f5249a9

18 files changed

+1824
-169
lines changed

.github/workflows/quality_control.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
pull_request:
77
branches: [ main, dev, integration-cleanup, update-workflow-with-correct-code-security ]
88

9+
# Chronolog MCP tests are handled in dedicated workflow
10+
env:
11+
NO_TEST_MCPS: '["Chronolog"]'
12+
913
jobs:
1014
discover-mcps:
1115
name: Discover MCP Directories
@@ -116,6 +120,7 @@ jobs:
116120
name: Test - ${{ matrix.mcp }}
117121
runs-on: ubuntu-latest
118122
needs: discover-mcps
123+
if: ${{ !contains(fromJson(env.NO_TEST_MCPS), matrix.mcp) }}
119124
strategy:
120125
fail-fast: false
121126
matrix:
@@ -211,6 +216,7 @@ jobs:
211216
name: Python 3.10 - ${{ matrix.mcp }}
212217
runs-on: ubuntu-latest
213218
needs: discover-mcps
219+
if: ${{ !contains(fromJson(env.NO_TEST_MCPS), matrix.mcp) }}
214220
strategy:
215221
fail-fast: false
216222
matrix:
@@ -250,6 +256,7 @@ jobs:
250256
name: Python 3.11 - ${{ matrix.mcp }}
251257
runs-on: ubuntu-latest
252258
needs: discover-mcps
259+
if: ${{ !contains(fromJson(env.NO_TEST_MCPS), matrix.mcp) }}
253260
strategy:
254261
fail-fast: false
255262
matrix:
@@ -289,6 +296,7 @@ jobs:
289296
name: Python 3.12 - ${{ matrix.mcp }}
290297
runs-on: ubuntu-latest
291298
needs: discover-mcps
299+
if: ${{ !contains(fromJson(env.NO_TEST_MCPS), matrix.mcp) }}
292300
strategy:
293301
fail-fast: false
294302
matrix:
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
2+
name: Test ChronoLog MCP
3+
4+
on:
5+
push:
6+
branches: [ main, dev ]
7+
8+
pull_request:
9+
branches: [ main, dev ]
10+
11+
workflow_dispatch:
12+
13+
jobs:
14+
test-chronomcp:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: '3.12'
25+
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v3
28+
29+
- name: Install gcc13 at runner level
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install -y gcc-13 g++-13 gfortran-13
33+
34+
- name: Get spack
35+
run: |
36+
git clone --branch v0.21.2 https://github.com/spack/spack.git
37+
source spack/share/spack/setup-env.sh
38+
echo "SPACK_ROOT=$PWD/spack" >> $GITHUB_ENV
39+
echo "$PWD/spack/bin" >> $GITHUB_PATH
40+
# Prevent spack from auto-detecting system compilers (including gcc14)
41+
spack compiler remove --all || true
42+
43+
- name: Clone ChronoLog repository
44+
run: |
45+
git clone https://github.com/grc-iit/ChronoLog.git
46+
cd ChronoLog
47+
git switch develop
48+
49+
- name: Cache Spack Dependencies
50+
uses: actions/cache@v4
51+
id: spack-cache
52+
with:
53+
path: |
54+
${{ env.SPACK_ROOT }}/opt
55+
${{ env.SPACK_ROOT }}/var/spack/cache
56+
~/.spack
57+
${{ github.workspace }}/ChronoLog/.spack-env
58+
key: chronolog-spack-${{ runner.os }}-${{ hashFiles('ChronoLog/spack.yaml') }}
59+
restore-keys: |
60+
chronolog-spack-${{ runner.os }}-
61+
62+
- name: Install ChronoLog dependencies
63+
if: steps.spack-cache.outputs.cache-hit != 'true'
64+
working-directory: ${{ github.workspace }}/ChronoLog
65+
run: |
66+
source $SPACK_ROOT/share/spack/setup-env.sh
67+
spack env activate -p .
68+
# Register gcc-13 with Spack and remove any gcc-14 to avoid libffi incompatibility
69+
spack compiler find /usr/bin
70+
spack compiler remove gcc@14 --all || true
71+
spack concretize --force
72+
spack install -j4 -v
73+
74+
- name: Setup Spack Environment (Cache Hit)
75+
if: steps.spack-cache.outputs.cache-hit == 'true'
76+
working-directory: ${{ github.workspace }}/ChronoLog
77+
run: |
78+
source $SPACK_ROOT/share/spack/setup-env.sh
79+
spack env activate -p .
80+
81+
- name: Build ChronoLog
82+
working-directory: ${{ github.workspace }}/ChronoLog
83+
run: |
84+
source $SPACK_ROOT/share/spack/setup-env.sh
85+
spack env activate -p .
86+
./deploy/local_single_user_deploy.sh --build --build-type Debug --install-dir $GITHUB_WORKSPACE/ChronoLog/install
87+
88+
- name: Install ChronoLog
89+
working-directory: ${{ github.workspace }}/ChronoLog
90+
run: |
91+
source $SPACK_ROOT/share/spack/setup-env.sh
92+
spack env activate -p .
93+
./deploy/local_single_user_deploy.sh --install --work-dir $GITHUB_WORKSPACE/ChronoLog/install/Debug
94+
echo "PYTHONPATH=$PYTHONPATH:$GITHUB_WORKSPACE/ChronoLog/install/Debug/lib" >> $GITHUB_ENV
95+
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/ChronoLog/install/Debug/lib" >> $GITHUB_ENV
96+
97+
- name: Create Python client symlink
98+
working-directory: ${{ github.workspace }}/ChronoLog/install/Debug/lib
99+
run: |
100+
rm -f py_chronolog_client.so
101+
ln -s py_chronolog_client.cpython-312-x86_64-linux-gnu.so py_chronolog_client.so
102+
103+
- name: Start ChronoLog service
104+
working-directory: ${{ github.workspace }}/ChronoLog
105+
run: |
106+
source $SPACK_ROOT/share/spack/setup-env.sh
107+
spack env activate -p .
108+
./deploy/local_single_user_deploy.sh -d -k 5 -r 2 --work-dir $GITHUB_WORKSPACE/ChronoLog/install/Debug
109+
110+
- name: Install ChronoLog MCP dependencies
111+
working-directory: ${{ github.workspace }}/mcps/Chronolog
112+
run: |
113+
uv venv
114+
uv sync --python 3.11
115+
uv pip install -e .
116+
117+
- name: Run ChronoLog MCP tests
118+
working-directory: ${{ github.workspace }}/mcps/Chronolog
119+
run: uv run pytest -v

.github/workflows/test-mcps.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ jobs:
1717
path: "mcps/Adios"
1818
- name: "Arxiv"
1919
path: "mcps/Arxiv"
20-
- name: "Chronolog"
21-
path: "mcps/Chronolog"
2220
- name: "Compression"
2321
path: "mcps/Compression"
2422
- name: "Darshan"

mcps/Chronolog/pyproject.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ dependencies = [
2929
"fastmcp",
3030
"python-dotenv",
3131
"google-genai",
32-
"h5py"
32+
"h5py",
33+
"pytest",
34+
"pytest-asyncio",
35+
"h11>=0.16.0",
36+
"requests>=2.32.4",
37+
"starlette>=0.47.2",
38+
"urllib3>=2.5.0"
3339
]
3440

3541
[project.scripts]

mcps/Chronolog/src/chronomcp/capabilities/record_handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# capabilities/record_interaction.py
2-
import utils.config as config
2+
3+
from chronomcp.utils import config
34

45

56
async def record_interaction(user_message: str, assistant_message: str) -> str:

mcps/Chronolog/src/chronomcp/capabilities/retrieve_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# capabilities/retrieve_interaction.py
2-
import utils.config as config
3-
import utils.helpers as helpers
2+
43
import re
54
from datetime import datetime
5+
from chronomcp.utils import config, helpers
66

77

88
async def retrieve_interaction(

mcps/Chronolog/src/chronomcp/capabilities/start_handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# capabilities/start_chronolog.py
2-
import utils.config as config
2+
3+
from chronomcp.utils import config
34

45

56
async def start_chronolog(

mcps/Chronolog/src/chronomcp/capabilities/stop_handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# capabilities/stop_chronolog.py
2-
import utils.config as config
2+
3+
from chronomcp.utils import config
34

45

56
async def stop_chronolog() -> str:

mcps/Chronolog/src/chronomcp/utils/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@
3636
mcp: FastMCP = FastMCP("chronologMCP")
3737

3838
# session state
39-
_active_chronicle = None
40-
_active_story = None
39+
_active_chronicle = ""
40+
_active_story = ""
4141
_story_handle = None

mcps/Chronolog/tests/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)