test: add unit + integration test infrastructure for kernel components - #553
Open
RyamL1221 wants to merge 13 commits into
Open
test: add unit + integration test infrastructure for kernel components#553RyamL1221 wants to merge 13 commits into
RyamL1221 wants to merge 13 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds CI test infrastructure covering components that previously had zero automated coverage, and wires up two new GitHub Actions workflows to run them.
New workflows:
test-unit.yml— fast (~2-3 min), no external services, runs on every PR/push tomaintest-memory-integration.yml— spins up Ollama + ChromaDB, runs real Mem0 provider and cross-agent shared-memory integration tests (~10-15 min)New test coverage (123 tests):
MemoryFormatter— 27 tests, all formatting branches (profile/task_context/conversation, generic fallback, malformed input, exception path)IntentRouter— 35 tests, keyword classification scoring, confidence thresholds, LLM fallback (mocked, no network calls)ConversationExtractor— 12 tests, metadata construction, user_id fallback, error handlingFIFOScheduler— 17 tests,_execute_syscalland_execute_batch_syscallsexecution paths, including failure handlingSyscallExecutor— 21 tests, request dispatch, syscall factory, write-barrier stamping (mocked against realMemoryWriteBarrierviaspec=)launch.py) — 11 tests, request validation,/status,/query,/user/selectrouting, all with mocked kernel components (no real LLM/memory backend, verified with all provider API keys unset)New integration test:
test_shared_memory_e2e.py— full write → retrieve → inject → format pipeline across two writer agents and one reader agent, against real Ollama + ChromaDB. Skips gracefully (pytest.skip) if Ollama is unreachable, verified via a test-onlyOLLAMA_SKIPenv var that exercises the real reachability-check code path.Infrastructure:
pytest.ini+tests/conftest.pyregister anintegrationmarker sopytest -m "not integration"/-m integrationcleanly separate the two test tiersscripts/patch_config_for_memory_tests.py— small script to configureconfig.yamlfor the mem0/Ollama/ChromaDB test setup, reused by both the workflow and the E2E testKnown pre-existing issues (found, not introduced, by this PR)
These are excluded via
--ignoreintest-unit.ymland documented in the README so they don't block CI or confuse future contributors:tests/modules/llm/openai/test_concurrent.pytests/modules/llm/openai/test_single.pytests/modules/memory/test_memory.pytests/modules/memory/test_memory_user_identity_isolation.pyConfigManagersingleton state pollution from earlier testsNone of these are caused by this PR; they were discovered while wiring up the unit workflow and are called out explicitly rather than silently worked around.
Testing
test_shared_memory_e2e.pyverified locally against real Ollama + ChromaDB (pass) and withOLLAMA_SKIP=1(skip)yaml.safe_load)cancel-workflow.ymlconfirmed to already cover the two new workflows (workflow_id: all, no update needed)test-unit.yml/test-memory-integration.ymlagainst GitHub's actual runners — opening this PR specifically to validate them in the real CI environment before mergeDocumentation
No
docs/changes — this PR adds test infrastructure and coverage only, no new features or behavior changes to document.