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

Improvements to pact verification #1

Merged
merged 4 commits into from
Jun 11, 2024
Merged

Improvements to pact verification #1

merged 4 commits into from
Jun 11, 2024

Conversation

SiimMardus
Copy link
Collaborator

@SiimMardus SiimMardus commented May 27, 2024

Description

Changes:

  • Modified add_pathz input in the pact_escript module to use the correct path.
  • Added logging of the Output from pact verification
  • Added the ability to pass custom auth tokens

Further details in commit messages.

Fixes: greyorange-labs#39 greyorange-labs#32

Checklist:

  • I have ensured that all new code is covered by tests
  • I have run make format to format the code according to guidelines
  • I have documented any new functions introduced
  • I have updated the changelog in accordance with https://keepachangelog.com/en/1.1.0/
  • I have updated the README, if required

Siim Mardus added 2 commits May 27, 2024 15:16
Previously the path to ebin did not work properly when a different
folder structure was used. This makes sure that it targets the correct
folder.

(In future commits, this could even be a parameter, for better configurability)
OutputLog contains useful information about what happens with Pact
verification.
@SiimMardus SiimMardus changed the title Small Improvements Improvements May 29, 2024
This is useful if the provider wants to use real authentication
flow for the contract tests.

Disclaimer:
`pactffi_verifier_add_custom_header` function unfortunately is not
able to override an existing header, so using this requires the pact
to not include the authorization header in the first place. This can
either be done by simply not using it on the consumer-side test or
removing it somehow before publishing the pact.

Although I worked through the following issues:
- pact-foundation/pact-net#460
- pact-foundation/pact-reference#275
from which the latter is actually marked as closed, and the fix is
allegedly included in the pact-ffi version that we use, it still did
not override an existing header. I tried bumping to a higher version
as well but without any luck. I will create an issue to pact-foundation
to try to get clarity on this.
@SiimMardus
Copy link
Collaborator Author

Created an issue to pact about the header overwriting problem pact-foundation/pact-reference#430

@SiimMardus SiimMardus changed the title Improvements Improvements to pact verification May 30, 2024
This reverts commit d75d6ba.

Reason:

I actually found anther way of replacing the authorization header:
- Use `fromProviderState` Matcher function on consumer side for auth
header. Match `Bearer ${authToken}`, use JWT regex
- On provider side, in state change URL endpoint, generate the token
and return it in the callback under `authToken`
- The provider-generated auth token will be used in the request.

I am leaving this as commit + revert for future reference purposes.
@SiimMardus SiimMardus merged commit 8fe2d31 into master Jun 11, 2024
1 check passed
@SiimMardus SiimMardus deleted the improvements branch June 11, 2024 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Print out the output from pact verification
2 participants