Feat/adding unittests for k8s prereq module - #53
Conversation
1149441 to
eda70d8
Compare
NotTheEvilOne
left a comment
There was a problem hiding this comment.
pytest is required for unit testing. pyproject.toml contains configuration to make it work as expected which unittest to not support (even by command line argument). Later is at least true for 3.12.3 of Python at the time of writing.
load_modules() is not mockable at the moment as it scans through the rookify.modules directory to identify modules to be loaded.
|
forgot to merge this, now have to repair conflicts :) |
79fbc90 to
b758793
Compare
fix: adding 'object' to module path in order to use correct class definition, allows to remove ignore comments for mypy Signed-off-by: Rafael te Boekhorst <boekhorst@b1-systems.de>
b758793 to
0d69561
Compare
…ordingly Signed-off-by: Boekhorst <boekhorst@b1-systems.de>
296aafd to
85503cc
Compare
…r_all_namespaces() Signed-off-by: Boekhorst <boekhorst@b1-systems.de>
3bea674 to
28f5dfd
Compare
|
ok repaired it and added another small unittest |
c728caa to
3a848d2
Compare
Signed-off-by: Boekhorst <boekhorst@b1-systems.de>
3a848d2 to
4b7a6e9
Compare
|
Ok I noted an issue: there seems to be some discrepancy between the local pre-comit and the pre-commit run in github actions. I now ran git commit --no-verify to avoid the local pre-commit throwing an error: github actions seems to run through everything fine though |
Signed-off-by: Boekhorst <boekhorst@b1-systems.de>
Signed-off-by: Boekhorst <boekhorst@b1-systems.de>
Signed-off-by: Boekhorst <boekhorst@b1-systems.de>
Signed-off-by: Boekhorst <boekhorst@b1-systems.de>
cf71ded to
eb5ae42
Compare
Signed-off-by: Boekhorst <boekhorst@b1-systems.de>
Signed-off-by: Boekhorst <boekhorst@b1-systems.de>
51a5aff to
dad25ec
Compare
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
51f33b4 to
ac7d089
Compare
Signed-off-by: Tobias Wolf <wolf@b1-systems.de>
Modules may only implement either `preflight()` or `execute()` as well. Remove the `@abstractmethod` decorator therefore. Signed-off-by: Tobias Wolf <wolf@b1-systems.de>
4912566 to
5c3852f
Compare
Signed-off-by: Tobias Wolf <wolf@b1-systems.de>
Signed-off-by: Tobias Wolf <wolf@b1-systems.de>
5c3852f to
dde5d60
Compare
.venv/bin/python -m pytest tests/modules/test_k8s_prerequisites_check.py/app/rookify/.venv/bin/python -m unittest /app/rookify/src/tests/modules/test_k8s_prerequisites_check.py, also note that these import errors do not occure when testingExampleHandlermodule, yet import is done in the same way. Try:/app/rookify/.venv/bin/python -m unittest /app/rookify/src/tests/modules/test_example.pyTestK8sPrerequisitesCheckHandleritself, thereby keping the code for preflight method the same... maybe you know another way to mock the ModuleHandler before it gets loaded?