Skip to content

V1 provider compatibility suite#631

Merged
JP-Ellis merged 15 commits intomasterfrom
chore/v1-provider-compatibility-suite
Mar 22, 2024
Merged

V1 provider compatibility suite#631
JP-Ellis merged 15 commits intomasterfrom
chore/v1-provider-compatibility-suite

Conversation

@JP-Ellis
Copy link
Copy Markdown
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 <josh@jpellis.me>
The username and password authentication are passed through other
arguments.

Signed-off-by: JP-Ellis <josh@jpellis.me>
Signed-off-by: JP-Ellis <josh@jpellis.me>
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 <josh@jpellis.me>
Required for the provider state callbacks.

Signed-off-by: JP-Ellis <josh@jpellis.me>
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 <josh@jpellis.me>
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 <josh@jpellis.me>
Signed-off-by: JP-Ellis <josh@jpellis.me>
Signed-off-by: JP-Ellis <josh@jpellis.me>
@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:core Relating to the core Pact Python library type:chore Part of regular code upkeep labels Mar 20, 2024
@JP-Ellis JP-Ellis self-assigned this Mar 20, 2024
Signed-off-by: JP-Ellis <josh@jpellis.me>
Following recommendations from Ron, making the check a no-op.

Ref: pact-foundation/pact-reference#404
Signed-off-by: JP-Ellis <josh@jpellis.me>
@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 <josh@jpellis.me>
@JP-Ellis JP-Ellis force-pushed the chore/v1-provider-compatibility-suite branch from 90f5321 to 4b45588 Compare March 21, 2024 09:02
Signed-off-by: JP-Ellis <josh@jpellis.me>
@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 <josh@jpellis.me>
Signed-off-by: JP-Ellis <josh@jpellis.me>
@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
Copy Markdown
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
@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:core Relating to the core Pact Python library area:tests Relating to the testing 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