Repository navigation
fix(docker): make the compose test path and the examples run - #47
Merged
Merged
Conversation
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.
make test(the compose test service,pytest -v --cov=.) gave 27 failed on Python 3.10 and 29 on 3.14 on master. It gives 0 failed here. The compose example service andexamples/advanced_appnow start.uv.lockis gitignored in this repo (git ls-files uv.lockprints nothing), but the Dockerfile ranuv sync --extra dev --frozenandcompose.ymlbind-mounted./uv.lock. On a clean clone the build failed withUnable to find lockfileand, once the file was missing, Docker created a directory calleduv.lockon the host and the mount failed withnot a directory. I copied the guard-core pattern:uv sync --extra devwithout--frozenand nouv.lockmount.SecurityConfigdefaults toenable_redis=Trueandredis_url=redis://localhost:6379. Tests that build a config without aredis_urltherefore connect tolocalhost:6379inside the test container, where no Redis listens, and the middleware answers 503. Tests that hardcoded the URL now readREDIS_URLthe way the conftest does, and a session fixture intests/conftest.pypoints the engine default atREDIS_URLwhen it is set (it does nothing whenREDIS_URLis unset, so the CI service container on localhost still works). Files:tests/test_decorators/test_extension_integration.py,tests/conftest.py.compose.ymlstarted the example withgunicorn examples.main:app, a module that does not exist. It isgunicorn examples.simple_app.main:appnow.examples/advanced_appdied at boot withValueError: return_pattern rule with pattern '404' requires reading the response body, but behavior_scan_response_body is False. The example config uses a body pattern, soapp/security.pynow setsbehavior_scan_response_body=True, the same settingexamples/simple_app/main.pyhas. The library is untouched.test_honeypot_form_detectionandtest_honeypot_json_detectionbuilt the request as aMagicMock. The engine checks the request against a runtime-checkable protocol (_BoundedBodyReader), which on 3.12 and later looks attributes up statically and does not see lazily created mock attributes, so the validator returnedNone. The tests now assignread_body_prefixas a real attribute.Verification, the compose test service run as the Makefile runs it, own compose project, Redis without a host port, master vs this branch:
uv.lock, because master does not build without one.compose.yml:healthy,GET /200,uid=10001.examples/advanced_appwith nginx on a high host port, the real app: apphealthythrough the Dockerfile HEALTHCHECK, nginxGET /health200,uid=10001.Not verified: Python versions other than 3.10 and 3.14, and the CI result (see the checks on this PR).