Repository navigation
test: add novaMock end-to-end test and fix stale unit tests - #11
Merged
Merged
Conversation
…o fix failing tests
tests/integration starts a private Mosquitto broker and tools/novaMock.py, runs the backend against them, and checks that a websocket client gets calibrated engine_data for one GCS and one FAS sensor, both in the connect-time snapshot and in a live broadcast. The test is skipped when Mosquitto isn't installed. CI installs it and sets NOVA_REQUIRE_INTEGRATION=1 so the test fails there instead of silently skipping.
tests/integration starts a private Mosquitto broker and tools/novaMock.py, runs the backend against them, and checks that a websocket client gets calibrated engine_data for one GCS and one FAS sensor, both in the connect-time snapshot and in a live broadcast. The test is skipped when Mosquitto isn't installed. CI installs it and sets NOVA_REQUIRE_INTEGRATION=1 so the test fails there instead of silently skipping.
_config_file checked names with Path, which on Linux doesn't treat \ as a separator, so "..\secret.yaml" passed as a bare file name and the request got a 404 instead of a 400. CI (Linux) failed test_load_and_download_reject_paths_outside_config_dir for this. Check with PureWindowsPath instead, which treats / and \ as separators and C: as a drive on every OS, so Linux and Windows reject the same names.
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.
What and why
Adds an end-to-end integration test (novaMock → real Mosquitto → backend → websocket client) and fixes the stale unit tests, so the whole suite passes and CI runs the integration test on every PR with coverage.
tests/integration/: starts a private Mosquitto on a free localhost port, runstools/novaMock.pyagainst it, and checks that a websocket client receives calibratedengine_datafor one GCS sensor (PGSO, calibrated to psi) and one FAS sensor (PCC, passed through unconverted). It's skipped if Mosquitto isn't installed, unlessNOVA_REQUIRE_INTEGRATIONis set.nodestrings toboard_type/board_id(b686c52):board_type/board_idinstead ofnode.resolved_nodeand sensor-parser expectations now match theboard_idin each test's config (EPB_1,EPB_2).parse_system_commandtests, because that method was removed from the app in b686c52.pytest-cov, setsNOVA_REQUIRE_INTEGRATION=1so the integration test fails rather than silently skipping, and prints coverage forapp/.pytest-covadded to the dev extras, anintegrationpytest marker registered, coverage output gitignored, and CONTRIBUTING.md updated with the new test command and Mosquitto requirement.How was this tested?
python -m pytest -q -rson this branch: 83 passed, 0 skipped. The integration test ran against a local Mosquitto install. The only warning is starlette's existing deprecation notice abouthttpx.Hardware impact
hardware-risklabel; a lead must approve!, link the matching PRs:No app code changes; tests, CI and docs only.
Checklist
dev(ormainfor a release/hotfix, or with a reason given above).envfiles or build output committed