bhklab / ORCESTRA-api

https://bhklab.github.io/ORCESTRA-api/
2 stars 0 forks source link

add tests, and local mongo #49

Closed jjjermiah closed 4 weeks ago

jjjermiah commented 1 month ago

1) I added testing using pytest start by running

pixi run serve-api

then in a seperate terminal:

pixi run coverage

which will run the tests, and then display coverage like:

✨ Pixi task (coverage in dev): coverage report --rcfile=config/coverage.toml --show-missing: (Generate a coverage report after running the test suite)
Name                                               Stmts   Miss  Cover   Missing
--------------------------------------------------------------------------------
src/orcestrator/__init__.py                            3      0   100%
src/orcestrator/api/v1/pipeline.py                    79     11    86%   86-87, 101-111, 127
src/orcestrator/common/__init__.py                     2      0   100%
src/orcestrator/common/config/__init__.py              2      0   100%
src/orcestrator/common/config/settings.py              3      0   100%
src/orcestrator/common/logging/__init__.py             2      0   100%
src/orcestrator/common/logging/logging_config.py      24      0   100%
src/orcestrator/crud/crud_pipeline.py                 38     14    63%   62-77, 88-93
src/orcestrator/db.py                                 29      8    72%   16, 19, 28, 32-34, 40-41
src/orcestrator/main.py                               31      0   100%
src/orcestrator/models/Pipeline.py                    22      0   100%
src/orcestrator/models/common.py                       3      0   100%
--------------------------------------------------------------------------------
TOTAL                                                238     33    86%

This describes how much of the codebase is covered by the tests. Missing lines means that the tests dont ever touch those points in the code which means that any refactoring to missing lines that break the project might not be caught in testing.

2) docker compose now spins up a local mongoDB instance instead of using a real one when developing.

image

feel free to change the environment variables in the docker compose file to a real database if you want to test using that

included a dump of the old mongo testing database I was using yesterday for reference