test: add standalone instrument tests and is_valid_path negative tests#98
Merged
Conversation
TEST-4: Add tests/instruments/test_{cors,healthchecks,prometheus,swagger}_instrument.py
covering is_ready() across valid/invalid configurations,
not_ready_message content, render_health_check_data output shape,
config defaults, and check_dependencies. These instruments were
previously only covered transitively via bootstrapper integration
tests, which made regressions noisier to diagnose.
TEST-7: Add tests/test_path.py with parametrized cases for
helpers.path.is_valid_path — both valid forms (default paths used by
the prometheus/swagger/healthchecks instruments) and invalid forms
(empty, no leading slash, spaces, special chars, empty segments).
Closes TEST-4 and TEST-7 from the audit. Pure additions; no production
code changed.
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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
Pure test additions; no production code changes.
tests/instruments/test_cors_instrument.py—is_readymatrix (origins-only, regex-only, both, neither),not_ready_message, config defaults,check_dependencies.tests/instruments/test_healthchecks_instrument.py— enabled/disabled,render_health_check_dataoutput shape, defaults.tests/instruments/test_prometheus_instrument.py— valid/invalid/empty paths, defaults.tests/instruments/test_swagger_instrument.py— instantiation, defaults.tests/test_path.py— parametrized cases foris_valid_pathcovering 8 valid forms (/metrics,/health/, multi-segment, special chars in the allowed set) and 9 invalid forms (empty, no leading slash, spaces,?/#, empty segments).38 new tests; full suite goes from 89 → 127.
Closes TEST-4 and TEST-7 from an internal audit.
Test plan
just test— 127/127.just lint— clean.test_path.pymatches the intended contract. The regex DOES accept/..because.is in the allowed charset — pre-existing design decision; not tested as a "valid" or "invalid" case in this PR.🤖 Generated with Claude Code