chore: add unit tests for pure functions + CI test job #11

Merged
jcabillot merged 7 commits from chore/add-tests into main 2026-06-12 08:50:32 -04:00
Owner

Ajout d'une batterie de tests unitaires + intégration dans la CI.

Tests ajoutés

Fonction Cas testés
normalize_email_address() email simple, display name, vide, whitespace/case, fallback
payload_matches_participant() sender match, receiver match, sender_raw, display name, case insensitive, pas de match, payload vide
format_search_result() payload complet, payload vide, champs manquants

CI

Nouveau job test qui s'exécute avant le build Docker :

  • Checkout + setup-python 3.13
  • pip install -r requirements.txt pytest
  • pytest tests/ -v

Si les tests échouent, le build ne part pas.

Fichiers

  • tests/test_server.py — 9 tests, 3 classes
  • pytest.ini — config pythonpath pour l'import de src/
  • .gitea/workflows/docker-build.yaml — ajout du job test
Ajout d'une batterie de tests unitaires + intégration dans la CI. ## Tests ajoutés | Fonction | Cas testés | |----------|------------| | `normalize_email_address()` | email simple, display name, vide, whitespace/case, fallback | | `payload_matches_participant()` | sender match, receiver match, sender_raw, display name, case insensitive, pas de match, payload vide | | `format_search_result()` | payload complet, payload vide, champs manquants | ## CI Nouveau job `test` qui s'exécute **avant** le build Docker : - Checkout + setup-python 3.13 - `pip install -r requirements.txt pytest` - `pytest tests/ -v` Si les tests échouent, le build ne part pas. ## Fichiers - `tests/test_server.py` — 9 tests, 3 classes - `pytest.ini` — config pythonpath pour l'import de `src/` - `.gitea/workflows/docker-build.yaml` — ajout du job test
cloudix_mcp_server added 1 commit 2026-06-11 08:18:35 -04:00
chore: add unit tests for pure functions + CI test job
Docker Build and Push / test (pull_request) Failing after 1m35s
Docker Build and Push / build (pull_request) Has been skipped
1700877918
- Unit tests for normalize_email_address, payload_matches_participant,
  format_search_result (9 test cases across 3 test classes)
- New 'test' job in CI workflow (runs before build)
- pytest.ini for pythonpath config
opencodecabilloteu added 1 commit 2026-06-11 08:24:56 -04:00
fix: set QDRANT_URL/COLLECTION_NAME env vars for test import
Docker Build and Push / test (pull_request) Successful in 1m30s
Docker Build and Push / build (pull_request) Successful in 1m11s
78ce84f4ff
opencodecabilloteu added 1 commit 2026-06-11 08:31:05 -04:00
chore: add integration tests with real Qdrant instance
Docker Build and Push / test (pull_request) Successful in 13s
Docker Build and Push / integration-test (pull_request) Failing after 8s
Docker Build and Push / build (pull_request) Has been skipped
07e7de2811
- Integration tests for search_emails and read_email against live Qdrant
- Indexes 3 test emails, tests search by content/participant/date
- CI: new 'integration-test' job with qdrant service, runs before build
- Unit test job ignores integration test file
cloudix_mcp_server added 1 commit 2026-06-12 08:08:24 -04:00
The Gitea Actions runner v1.0.8 fails to start the Qdrant service container
with 'exec: ./entrypoint.sh: no such file or directory'. This is a runner bug
with how it handles service container entrypoints/CMD.

Bypass the service container mechanism by starting Qdrant manually with
docker run -d and a health check wait loop.
cloudix_mcp_server added 1 commit 2026-06-12 08:11:00 -04:00
fix: replace Gitea services container with manual docker run for Qdrant
Docker Build and Push / test (pull_request) Successful in 1m33s
Docker Build and Push / integration-test (pull_request) Failing after 2m23s
Docker Build and Push / build (pull_request) Has been skipped
14650619ad
The Gitea Actions runner v1.0.8 fails to start the Qdrant service container
with 'exec: ./entrypoint.sh: no such file or directory'. This is a runner bug
with how it handles service container entrypoints/CMD.

Bypass the service container mechanism by starting Qdrant manually with
docker run -d and a health check wait loop.
cloudix_mcp_server added 1 commit 2026-06-12 08:14:41 -04:00
fix: share job container network with Qdrant
Docker Build and Push / test (pull_request) Successful in 13s
Docker Build and Push / integration-test (pull_request) Failing after 1m49s
Docker Build and Push / build (pull_request) Has been skipped
d784cd9fba
docker run -d publishes ports to the Docker bridge network, but the
job container runs on a different Gitea Actions network. This causes
Connection refused when tests try http://localhost:6333.

Use --network container:$(hostname) so Qdrant shares the job container's
network stack, making localhost reachable.
cloudix_mcp_server added 1 commit 2026-06-12 08:25:57 -04:00
fix: correct integration test assertions for semantic search
Docker Build and Push / test (pull_request) Successful in 14s
Docker Build and Push / integration-test (pull_request) Successful in 1m44s
Docker Build and Push / build (pull_request) Successful in 1m12s
30ac4ae9ca
- test_search_by_content: format_search_result() does not include
  body_text, so check for the expected message_id instead.
- test_search_no_results: vector cosine similarity always returns
  nearest neighbors; use a date filter far in the future to
  guarantee zero results instead.
jcabillot merged commit 482e97fd2d into main 2026-06-12 08:50:32 -04:00
jcabillot deleted branch chore/add-tests 2026-06-12 08:50:32 -04:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: perso/mcp-maildir#11