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

Feature: PactV3 / VerifierV3 / MessageProvider interface (powered by pact_ffi) #367

Closed
wants to merge 177 commits into from

Conversation

YOU54F
Copy link
Member

@YOU54F YOU54F commented Aug 2, 2023

Following on from the awesome work from @elliottmurray and @mikegeeves

Work done so far

  • Loading of shared binaries for the following platform
OS Architecture
OSX x86_64
Linux x86_64
OSX arm64
Linux arm64
Windows x86_64

Logging

Docs

TODO

  • Message metadata content-type currently hard coded to application/json
  • Plugin tests when they fail, dont appear to return the failures or successes to the log buffer
  • Log level gets globally applied, and isn't able to be changed, which interferes with the unit tests, and probably external tests within the same process. I think this is due to pact-reference using a global logging tracer.
  • update migration guide
  • bump to alpha version
    • 3.0.0b0
  • MessageConsumerV3
  • Created class, needs to call rust core rather than pact core
  • MessageConsumerV4
  • PactV4
    • Created basic example using NativeMockServer
    • Needs Consumer DSL
  • Create a proper native_mock_server interface that doesn't have any logic in it
    • I've just imported required methods at the moment.
    • Should native_mock_server should be a direct bridge to the FFI
    • PactV3 currently uses NativeMockServer but it quite aware of the logic requirements of the FFI
  • Error handling on the native interop side
    • Generally decent through python's cffi module with somewhat descriptive messages and print out of the objects it was trying to marshall.
  • pactffi_string_deletes
    • Free anything that needs to be freed
  • matcher/generators
    • Matchers in body
    • Matchers in path
    • Matchers in queries
    • Matchers in headers
  • consumer side lifecycle
    • run mock_server_matched in users tests after they have issued the request and before they start doing their unit test assertions
    • allow them to then call a finalise to write the pact file to disk only after these assertions are complete
    • Currently this is all in one with the existing signature provider.verify which also tears down the mock server for that interaction

V2 -> V3 notes

  1. http_proxy returns {contents: message} but required to be message in rust core

## How can I test it?

  1. Clone the repo and follow the setup instructions.

or add the following to pull from my latest beta branch

'pact-python @ git+https://github.com/you54f/[email protected]'

Ronald Holshausen and others added 30 commits May 29, 2020 13:51
…e changes to docker37 which I will need to do to all
…e changes to docker37 which I will need to do to all
YOU54F and others added 23 commits August 3, 2023 16:39
fails on windows ci, server started but fails to connect for state
change url
skip running grpc on 3.6 due to protobuf error
3.6 passing locally on macos and on cirrus cli linux
Click failing due to LANG being set to ASCII
enable for macos / windows
try ubuntu-latest for 3.6
works for cirrus ci 3.6 with LANG=C.UTF-8
3.6 is passing so we could do a final release
with the rust core and bump to 3.7 or later
across windows and macos with pytest-flask
@YOU54F
Copy link
Member Author

YOU54F commented Aug 17, 2023

Bit of recap.

I've started testing this out by importing into other projects in the wild.

  1. I've got issues with top level imports, pact.ffi.x isn't exposed in the pact import and I'm not sure if I want to expose the ffi modules to the end user.

It works on my machine, and when pip installed from another repo, but not when downloaded from a release tarball.

  1. Content-type header must be explicitly set on req/res body. I am using format [{"name":"content-type","value":"application/json"}]
  • It's verbose
  • It doesn't match a python Headers object, which some of the examples in the wild I found.

@YOU54F
Copy link
Member Author

YOU54F commented Oct 3, 2023

Closing and new work will be tracked under #396 🎉

@YOU54F YOU54F closed this Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment