Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix and improve examples docker compose file #808

Merged

Conversation

individual-it
Copy link
Contributor

✈️ Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

📝 Summary

This is a fix to the docker-compose file, so that the examples do run correctly with the broker.
There are 3 smaller fixes in the PR, submitted in 3 commits.

🔥 Motivation

I was trying to get the broker tests running and they would always fail because the broker would not start correctly. After this changes all works fine and I can continue to learn about pact-python 🧑‍🎓

🔨 Test Plan

hatch run example
/home/artur/.local/share/hatch/env/virtual/pact-python/wW3DfDZn/pact-python/lib/python3.12/site-packages/pytest_asyncio/plugin.py:208: PytestDeprecationWarning: The configuration option "asyncio_default_fixture_loop_scope" is unset.
The event loop scope for asynchronous fixtures will default to the fixture caching scope. Future versions of pytest-asyncio will default the loop scope for asynchronous fixtures to function scope. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: "function", "class", "module", "package", "session"

  warnings.warn(PytestDeprecationWarning(_DEFAULT_FIXTURE_LOOP_SCOPE_UNSET))
====================================================================== test session starts ======================================================================
platform linux -- Python 3.12.3, pytest-8.3.3, pluggy-1.5.0
rootdir: /home/artur/www/pact-python
configfile: pyproject.toml
plugins: asyncio-0.24.0, anyio-4.6.0, bdd-7.3.0, cov-5.0.0
asyncio: mode=Mode.STRICT, default_loop_scope=None
collected 18 items                                                                                                                                              

examples/tests/test_00_consumer.py ....                                                                                                                   [ 22%]
examples/tests/test_01_provider_fastapi.py .                                                                                                              [ 27%]
examples/tests/test_01_provider_flask.py .                                                                                                                [ 33%]
examples/tests/test_02_message_consumer.py ..                                                                                                             [ 44%]
examples/tests/test_03_message_provider.py .                                                                                                              [ 50%]
examples/tests/v3/test_00_consumer.py ....                                                                                                                [ 72%]
examples/tests/v3/test_01_fastapi_provider.py .                                                                                                           [ 77%]
examples/tests/v3/test_02_message_consumer.py ..                                                                                                          [ 88%]
examples/tests/v3/test_03_message_provider.py .                                                                                                           [ 94%]
examples/tests/v3/test_match.py .                                                                                                                         [100%]

======================================================================= warnings summary ========================================================================
examples/tests/v3/test_01_fastapi_provider.py::test_provider
  /usr/lib/python3.12/multiprocessing/popen_fork.py:66: DeprecationWarning: This process (pid=64021) is multi-threaded, use of fork() may lead to deadlocks in the child.
    self.pid = os.fork()

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================================================== 18 passed, 1 warning in 76.51s (0:01:16) ============================================================

curl is not installed in the container, so the healthcheck could never
succeed with it. Use wget instead as it is available in the container.
localhost:9292 is not reachable inside the container, the own service name
'broker' works correctly
Only the broker needs access to the postgres instance, so there is no need
to publish the ports. One big advantage of this is, that if the user
already runs a postgres instance the service inside docker will not interfere
with it and the broker will start correctly.
Copy link

codecov bot commented Oct 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78%. Comparing base (46160eb) to head (b8c0b3d).
Report is 12 commits behind head on master.

Additional details and impacted files
@@          Coverage Diff          @@
##           master   #808   +/-   ##
=====================================
  Coverage      78%    78%           
=====================================
  Files          29     29           
  Lines        3060   3060           
=====================================
  Hits         2394   2394           
  Misses        666    666           
Flag Coverage Δ
examples 60% <ø> (ø)
tests 74% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JP-Ellis JP-Ellis merged commit 5ec3c90 into pact-foundation:master Oct 7, 2024
31 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants