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

Feat/async message producer #725

Merged

Conversation

valkolovos
Copy link
Contributor

@valkolovos valkolovos commented Jul 8, 2024

✈️ 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

Feature/add support and example messenger consumer using rust engine

🔥 Motivation

Work for Add support and example for verifying a message provider using the Rust engine #379

🔨 Test Plan

Implemented tests for the compatibility suite. Specifically message provider tests for v3 and v4.

🔗 Related issues

@JP-Ellis JP-Ellis force-pushed the feat/async-message-producer branch from 149e29b to e65ba47 Compare July 17, 2024 02:46
@JP-Ellis JP-Ellis marked this pull request as ready for review July 17, 2024 02:46
@JP-Ellis
Copy link
Contributor

Good news! I have got this to work properly 🎉 Thank you so much for the effort @valkolovos.

The tests will fail in CI at the moment as we will need to wait for a new release of the Pact FFI.

valkolovos and others added 9 commits July 18, 2024 08:49
With this PR, async message providers (aka producers) are now (mostly)
working, so that the `pact.v3` module supports both asynchronous message
providers and consumers.
The provider subprocess has an issue whereby logging is not inherited
from the parent Python process. This has been fixed by passing an
additional `log_level` argument which will configure logging (if not
already enabled). This means that the `logger` instance can be used
consistently throughout the codebase.

A few minor log fixes are also included in this commit.

Signed-off-by: JP-Ellis <[email protected]>
Truncating to the first and last 6 bytes/chars was far too little to be
useful. Bumping both up to 128.

Signed-off-by: JP-Ellis <[email protected]>
Signed-off-by: JP-Ellis <[email protected]>
The `InteractionDefinition` class and the way it works with the
`Provider` class during testing has been fairly signifcantly refactored.
This should hopefully make it clearer and easier to maintaing going
forward.

Signed-off-by: JP-Ellis <[email protected]>
The `with_binary_file` FFI function is perhaps poorly named, as it
doesn't just set the (binary) body of an interaction, but it also sets
the matcher to be a content type matcher.

It would be best to have two separate FFI calls (which are now
supported) of `with_binary_body` and `with_matching_rule`.

Signed-off-by: JP-Ellis <[email protected]>
The `__init__` was getting a bit too cluttered, so I have refactored the
entire `InteractionDefinition` class into its own module. I have also
refacted the nested classes to stand alone now.

A minor refactor was also made to avoid assigning custom attributes to
the `Flask` app, and some changes were made to the provider
initialisation to avoid passing a redundant `self.app` in a method call.

Signed-off-by: JP-Ellis <[email protected]>
@JP-Ellis JP-Ellis force-pushed the feat/async-message-producer branch from e65ba47 to c7f6667 Compare July 17, 2024 22:59
@JP-Ellis JP-Ellis merged commit 2c652f0 into pact-foundation:master Jul 18, 2024
28 of 29 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.

Add support and example for verifying a message provider using the Rust engine
2 participants