test: add runtime tests, integration tests, and CI with local MongoDB#1
Open
sis0k0 wants to merge 7 commits into
Open
test: add runtime tests, integration tests, and CI with local MongoDB#1sis0k0 wants to merge 7 commits into
sis0k0 wants to merge 7 commits into
Conversation
- tests/test_integration.py: per-repo pytest tests that connect to a real MongoDB instance and exercise the actual collection schema with CRUD operations - tests/__init__.py: makes tests a package so pytest resolves modules correctly - .github/workflows/ci.yml: adds mongo:latest service container (health-checked, port 27017) and a step that runs pytest tests/test_integration.py with MONGODB_URI pointing at the service container credentials Pattern follows mongodb-developer/mern-stack-example PR #51.
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 a complete testing and CI layer to this repository:
Runtime tests (
tests/test_runtime.py)Unit-level tests that import the app with in-process stubs and verify route registration, startup/shutdown lifecycle, and core handler logic — no network required.
Integration tests (
tests/test_integration.py)Pytest tests that connect to a real MongoDB instance and exercise the actual collection schema:
Tests skip automatically when MongoDB is not reachable.
CI (
github/workflows/ci.yml)mongo:latestservice container with amongoshhealth check (same pattern as mern-stack-example PR #51)MONGODB_URI: mongodb://admin:mongodb@localhost:27017/for integration testspytest tests/test_integration.py -vafter the existing runtime test step