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

V1 provider compatibility suite #631

Merged
merged 15 commits into from
Mar 22, 2024
Merged

Conversation

JP-Ellis
Copy link
Contributor

📝 Summary

Implement the V1/http_provider compatibility suite.

The majority of the changes are restricted to the tests folder, though a couple of fixes to the v3 module have been introduced (see individual commits).

🚨 Breaking Changes

🔥 Motivation

Ensure consistency with other Pact implementations.

🔨 Test Plan

Through CI

🔗 Related issues/PRs

Most of the publish option arguments are optional, but the initial
implementation had these as compulsory.

Signed-off-by: JP-Ellis <[email protected]>
The username and password authentication are passed through other
arguments.

Signed-off-by: JP-Ellis <[email protected]>
These functions do not really belong to the class, and there's now a
need for them to be called directly.

Signed-off-by: JP-Ellis <[email protected]>
Required for the provider state callbacks.

Signed-off-by: JP-Ellis <[email protected]>
This introduces a few important changes to the interaction definition:

- Addition of `response_headers`
- Support for the response status code through either the `response` or
  `status` kwargs
- Combining the response content type and body to reflect the same logic
  as with the request body and content type.
- A new `add_to_flask` method (akin to `add_to_pact`) which defines the
  interaction for a Flask app.

Signed-off-by: JP-Ellis <[email protected]>
This is a utility function which is required in order to pass certain
arguments between the test suite, and the Flask app running in a
separate process.

Signed-off-by: JP-Ellis <[email protected]>
@JP-Ellis JP-Ellis added difficulty:hard A task requiring a lot of work and an in-depth understanding of the codebase area:tests Relating to the testing area:v3 Relating to the pact.v3 module type:chore Part of regular code upkeep labels Mar 20, 2024
@JP-Ellis JP-Ellis self-assigned this Mar 20, 2024
Following recommendations from Ron, making the check a no-op.

Ref: pact-foundation/pact-reference#404
Signed-off-by: JP-Ellis <[email protected]>
@JP-Ellis JP-Ellis force-pushed the chore/v1-provider-compatibility-suite branch 2 times, most recently from 47c86a7 to 90f5321 Compare March 21, 2024 08:38
As the provider is launched in its own Python process, logging is not
configured. So instead of using various `logging` methods, directly
write to `stderr`.

Signed-off-by: JP-Ellis <[email protected]>
@JP-Ellis JP-Ellis force-pushed the chore/v1-provider-compatibility-suite branch from 90f5321 to 4b45588 Compare March 21, 2024 09:02
@JP-Ellis JP-Ellis force-pushed the chore/v1-provider-compatibility-suite branch 3 times, most recently from a67d66c to d46243c Compare March 22, 2024 01:13
The initial implementation of the compatibility suite spun up and down
the Pact Broker for each scenario, which also resulting in flaky tests
in CI.

This refactor uses a session pytest fixture which will spin up the
broker once, and keep re-using it. Functionality to 'reset' the broker
between tests has also been added.

Signed-off-by: JP-Ellis <[email protected]>
@JP-Ellis JP-Ellis force-pushed the chore/v1-provider-compatibility-suite branch from d46243c to 5addbc1 Compare March 22, 2024 01:27
@JP-Ellis
Copy link
Contributor Author

Some tests are failing. I can identify two causes:

I am merging this, knowing that the tests are currently failing.

@JP-Ellis JP-Ellis merged commit 01307c6 into master Mar 22, 2024
15 of 27 checks passed
@JP-Ellis JP-Ellis deleted the chore/v1-provider-compatibility-suite branch March 22, 2024 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:tests Relating to the testing area:v3 Relating to the pact.v3 module difficulty:hard A task requiring a lot of work and an in-depth understanding of the codebase type:chore Part of regular code upkeep
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v1/http_provider.feature
1 participant