Skip to main content

Β· 14 min read

Pact Almanac 2024​

Grab your hoverboard, and get prepared for another trip back to the future, with our round up of this years Pactivities in our seasonal Pact Almanac.

image

This year we've seen the migration to the Pact Rust core, featuring V4 spec good including combined interactions and plugins, begin to take fruition in most of the major client libraries, and improvements and consistencies across of tooling, documentation and examples. We know there is much more to do, as always, and we've been pleased to see an increasing amount of contributions, across a wide array of repositories in the pact-foundation. We've seen an RFC process created, to help democratise large scale decisions which affect the Pact eco-system, and I would invite you all to get involved in some way, shape or form.

If you haven't read our monthly blog posts, you can read a round-up of the most significant changes from each month in there. Check out the side-bar to the left to view the older posts.

I've mainly focused on community heroes this time round, where you can find multiple advocates of Pact, spreading the word of not just how to do contract testing, but the why. You'll hear about the worlds first dedicated book to contract-testing. I hope you'll enjoy them, be sure to like and comment on the videos, whether it's to show your appreciation or you just fancy a debate.

I'll also pull out a stand-out change from each month either by the team or one of our many contributors.

Anyhow, let see what each month has in store for us.

Jan​

πŸ§‘β€πŸ’» Tien Vo started by year by continuing and productionising the migration of Pact-PHP over to the Rust core. We saw the first community created pact_compatibility_suite examples land this month, and Tien has worked diligently all year, in implementing not only new features to Pact-PHP, but contributions to the Pact ecosystem as a whole, from an RFC for form-urlencoded matching ability, to several changes in the Pact-Rust core and Pact-Plugin ecosystem. It has seen great feedback from users, including Steve Taylor.

Not an issue as such, just want to say I love it. (I'm using 10-alpha3)

It's so much faster and simpler, and I'm looking forward to using some of the newer Pact specification features.

My API tests came across easily without much fuss.

Pact-PHP v10, was made generally available in September, in this release.

Well done Tien! Your hard work has paid off and is very much appreciated by the community.

Feb​

  • πŸ§‘β€πŸ’» February saw more libraries progress towards the Rust core and Pact V4 Spec goodness.
  • πŸ§‘β€πŸ’» A plan was set out to provide better platform support for Linux, in terms of distro compatibility, musl and arm64.

Community hero of the month: Stanislav Vodetskyi for all the improvements in the Pact-Go project, and learning Rust on the fly to aid himself and the Pact community by proxy.

Mar​

  • πŸ§‘β€πŸ’» Multi-arch images were finally produced for Docker, enabling arm64 users on Linux, or most likely with new Apple silicon based Macs

Community hero of the month: Dany Marques for his tenacity in tracking down an obscure bug in the npm ecosystem, and creating upstream fixes, as well as resolving his issue in the interim in the pact-js project.

Apr​

  • πŸ§‘β€πŸ’» Josh Ellis was thrilled to announce the release of Pact Python v2.2, a significant milestone that not only improves upon the existing features but also offers an exclusive preview into the future of contract testing with Python. He posted about it over at pact-pythons new doc site, in its inaugural blog post from maintainer Josh Ellis.

We've often wondered when a book dedicated to contract testing would appear on the scene. We even had this statement on the books section of our site

We're not aware of any books currently dedicated to contract testing, but here are some that talk about Pact and contract testing as part of a broader microservices development and testing strategy

However good news everybody 🎺 the first one was announced back in April.

contract testing in action

Community hero(es) of the month: Marie Cruz and Lewis Prescott, for being awesome but also releasing Contract Testing in Action πŸ“• under the MEAP (Manning Early Access Program), the first book dedicated to contract testing.

May​

  • πŸ§‘β€πŸ’» Alpine was finally supported for CLI's and the FFI shared library, and alongside it, changes were made to reduce the size of the Pact libraries, so whilst I began to add Alpine support into the client libraries, existing users got the benefits of quicker downloads. You can read about it here
  • πŸ§‘β€πŸ’» Ron started a redesign/rewrite for a V2 version of the Pact Reference Mock Server

Community hero of the month: Praveen Erode Mohanasundaram - A Long time Pact advocate and community contributor who spoke at Devoxx UK about Contract Testing: The Key to Unlocking E2E Testing Bottlenecks in CI/CD pipeline, you can catch the video on YouTube πŸ“Ί

June​

  • πŸ§‘β€πŸ’» The Pact reference project saw the closure of a couple of long-standing issues which affected cross-platform compatibility and repeated test runs, these unblocked the Pact-Net V5 released, and drove additional changes in Pact-JS. Read more here
  • πŸ§‘β€πŸ’» Pact-JS saw the splitting of the ruby cli, from the main package, and the birth of the new @pact-foundation/pact-cli package. This meant we could deliver native Alpine support to the Pact JS project, including the shared libraries in the project, and due to the package size reductions, the resultant package which contained a pre-built binary for every supported platforms, is now smaller than previously, despite the addition of musl x86_64/arm64 shared libs.

Community hero of the month: Mark Bradley who announced he would be speaking GopherConUK 2024 in August. He his topic will be "Using Pact to deploy Microservice with confidence". He has previously posted videos and guides on how to get started with Pact in PHP and Go.

July​

As you may be aware, there are multiple places where one can get help or request changes to the Pact ecosystem, either across the whole ecosystem, or for an individual repositories. Canny, our public roadmap, GitHub project boards on individual repositories, Slack to name a few.

Some of Pact's maintainers also work together, and as such conversations, discussions and agreements can be made but not consistently communicated, leaving users, for example who don't frequent Slack, or one of our maintainer sessions, to feel excluded from conversations.

As such we decided to deprecate our Canny roadmap and have migrated the issues to GitHub, in our Roadmap repo, to keep issues close to where the code is.

To try and counter some of the concerns around the decision-making process, we felt a RFC (Request for comments) process would be beneficial to allow for a record of proposed changes and decisions, and provide a central place to users, contributors and maintainers to go.

  • You can read about the accepted process here

You can get involved via GitHub, but we also catch once every two weeks in our Maintainer meets.

  • 10am-10:45am UTC (11am GMT / 8pm AEST)

You can download a calender invite from our repo

A google document holds our agenda which is openly editable and where anyone can table ideas for discussion.

  • πŸ§‘β€πŸ’» Pact Mock Server v2.0 is here \o/

We mentioned in April, that Ron was redesigning Pact Mock Server, as the existing mock server implementation was written in 2017-2019, and contained some esoteric TLS code that was more complex to upgrade to Hyper 1.0 than to rewrite it using newer Hyper 1.0 constructs.

Upgrading to Hyper 1.0 also brought us the following benefits:

  • Supports both HTTP 1 and 2 with the same server implementation
  • Supports protocol upgrades (leading to supporting things like Web Sockets)
  • Middleware support
  • No more need for the custom TLS code

Check out the release log to find out what went into the rewrite, and watch out for the updated mock server making it's way through the Pact ecosystem shortly.

  • πŸ§‘β€πŸ’» It's been nearly 2 years since we introduce the Pact Plugin framework to the world.

We've seen 2 plugins created by Pact maintainers (pact-protobuf-plugin, pact-csv-plugin), 2 created by non-maintainers (pact-avro-plugin, in-house json-rpc plugin) and provided a course to guide you on how to build your own plugin (pact-matt-plugin).

We know there are some rough edges, and we have been mulling over what the future of Pact-Plugins could look like. We want to start gathering feedback from users, maintainers and plugin authors, even if you tried it out and got stuck. We will see an RFC (request for comments) ticket being raised in the Roadmap soon and we would like to hold some group sessions to discuss, where participants will get to earn some swag for their time, as well as the satisfaction of being able to shape Pact Plugins destiny, whatever that may be!

Community hero of the month: Val Kolovos for continuing adding features to pact-python's v3 interface with the rust core, such as async messaging and matchers. Read about it here

Aug​

  • πŸ§‘β€πŸ’» The RFC process is approved. Bring on the changes.
  • πŸ§‘β€πŸ’» Bas Djistrka from OnTestAutomation launched a new course, Practical contract testing with Pact
  • πŸ§‘β€πŸ’» Pact compatibility suite, I've mentioned it a couple of times, so what actually is it?

A Set of BDD style tests to check compatibility between Pact implementations has been created in the pact-compatibility-suite

Current examples

In order to validate pact-go, pact-js & pact-ruby and it's adherence to the pact-specification, it would be good to begin to implement the following tickets.

Anyone is welcome to start implementing these, we are beginning to see contributors to pact-pythons v3/v4 implementation, so why not join in?

Community hero of the month: Augusto Colombelli for his blog post Contract Tests β€” APIs Guided by Consumers, which you can read over on Medium here.

Sept​

Community hero of the month: Murat K Ozcan has recently been taking an adventure in the world of Pact, after picking up Marie & Lewis' Contract testing in Action book. He has written 3 posts which are well worth a read.

Oct​

  • πŸ§‘β€πŸ’» Pact-Net V5 is launched! Read about it here
  • πŸ§‘β€πŸ’» A suite of message pact workshops were created to help users get started. See it here
  • πŸŽ‰ Pact Slack now has over 6 thousand members!

We were really proud to say we have just crossed the 6k mark, with 6005 members in our general channel in Pact Slack.

We appreciate many users journeys through Slack are transient, either whilst they are getting started with the Pact ecosystem, or after some help, and encounters may be all but fleeting. It is worth noting that not an insignificant amount of us have had the good fortune of meeting new friends, both in person, and virtually, making professional relationships and providing springboards to new opportunities. Some of the interactions have had positive life-changing impacts, your authors journey included.

We are proud to be able to foster a safe environment, where people are welcome to discuss contract testing with a captive audience, and for every engineer who finds that eureka moment where contract testing, just clicks, we know it is improving the API delivery landscape massively and has a net benefit to many interactions we have in our day-to-day life with systems.

If you are proud about the positive impacts Pact has had in your place of work, why not share it with the world? We can provide you a platform, and sharing your engineering mistakes and successes, is a great way to build transparency and trust with your customers, and promote a healthy learning based culture in your organisation.

Community hero of the month: Lewis Prescott for taking to the stage at CypressConf to teach users about the fundamentals of contract testing as well as how to implement consumer-driven contract testing with Cypress + Pactflow.

Nov​

  • πŸ§‘β€πŸ’» We've saw a few improvements in the pact-ruby project
    • V3 & V4 Generators thanks to Steve Taylor
    • Pact-provider-verifier now works with Rack 3, after we decided to fork rack-reverse-proxy in order to provide backwards compat with Rack 2 but allow for forwards compat with Rack 3+
    • Tweaks to Pact contract generation and verification, after ruby json 2.8.0 changes the way that JSON.pretty_generate renders empty collections such as arrays or objects. This allowed us to ensure that contracts generated with pre and post json 2.8.x behave in the same way.

I mentioned back in August, about the sbmt-pact project, which afforded users the ability to leverage the Pact V3 & V4 specification in Ruby.

I've spent a bit of time with the project, to see what changes I would need to make, to allow the functionality to slot into Pact-Ruby and allow for the minimum changeset, for existing pact-ruby users. I'm pleased to say that I've got pretty far and have documented in this issue TODO: link to sbmt-pact issue.

I've tested this out in real-world Ruby projects.

  • Pact-Broker:
    • sbmt-pact can verify existing v2 pacts generated by the Pact-Ruby core, and v2/v3/v4 pacts generated by the Pact-Rust core.
  • Pact_Broker-client
    • sbmt-pact can create v2/v3/v4 pacts

Community hero of the month: Ben Brugman & Ashley Gautama - For reaching Pact Nirvana, at their organisation, across many many teams. Read his celebratory post here

Dec​

  • πŸ§‘β€πŸ’» A set of new proposals for discussion in the Pact Plugin ecosystem. Wondering what plugins are? Read the quick start
ProposalStateDiscussion
V2 Plugin InterfaceDrafthttps://github.com/pact-foundation/pact-plugins/discussions/83
Support script language pluginsDrafthttps://github.com/pact-foundation/pact-plugins/discussions/84
Support WASM pluginsDrafthttps://github.com/pact-foundation/pact-plugins/discussions/85

Community hero of the month: Ruth - A long time pact-jvm user, Ruth has been in contact with the team over several issues in her Pact setup, and has provided some of the best reproducible examples I've come across. Glad to see Pact doing so well for you in your organisation, maybe next year we can get you to do a guest blog post. No pressure, but that also applies to my readers. It could be you here, in our wrap up for 2025!

See you next year folks​

Thanks for everyone's efforts in using, promoting, and preaching about Pact to everyone you know, now its our time to repay the favour.

If you've done something great, and want to share it, get it listed - the site is open source and you can edit any page, we want to give you a platform to help amplify your voice!

Maybe there is time to get one last video/blog or PR in before crimbo! No, only joking, that’s a wrap for this year's Pact Open Source Almanac, pop your feet up, enjoy your puds and hope to see your name in the book next year.

Β· 6 min read

πŸ•ΈοΈ Welcome to the October Pact Blog - hope you've got your πŸŽƒ ready for carving, but for now, sit back and relax as we take you through all the updates in the Pact ecosystem along with events & material you've been sharing across the web this month.

Pact OSS Updates​

Pact Slack now has over 6 thousand members​

We are really proud to say we have just crossed the 6k mark, with 6005 members in our general channel in Pact Slack.

We appreciate many users journeys through Slack are transient, either whilst they are getting started with the Pact ecosystem, or after some help, and encounters may be all but fleeting. It is worth noting that not an insignificant amount of us have had the good fortune of meeting new friends, both in person, and virtually, making professional relationships and providing springboards to new opportunities. Some of the interactions have had positive life-changing impacts, your authors journey included.

We are proud to be able to foster a safe environment, where people are welcome to discuss contract testing with a captive audience, and for every engineer who finds that eureka moment where contract testing, just clicks, we know it is improving the API delivery landscape massively and has a net benefit to many interactions we have in our day-to-day life with systems.

If you are proud about the positive impacts Pact has had in your place of work, why not share it with the world? We can provide you a platform, and sharing your engineering mistakes and successes, is a great way to build transparency and trust with your customers, and promote a healthy learning based culture in your organisation.

Pact Message Workshops​

We've recently been working on a suite of Pact Message based examples, to show you how to test asynchronous systems with Pact, by concentrating on the messages sent between systems, rather than the underlying queuing system that transmits them.

We've taken PactFlow's kafka e2e example (consumer/provider), based on our common Product domain example and built out a suite of examples, in various Pact client DSL's.

You can find the new workshop over on GitHub pact-foundation/pact-workshop-message where you can see the Pact message concepts demonstrated in the following flavours.

  • Pact-JS
  • Pact-JVM
  • Pact-Net
  • Pact-Go
  • Pact-Python
  • Pact-Rust

We hope to build out a tutorial on the website, and further enhance it by adding synchronous message examples as well in the near future.

Pact RFCs​

We still have two RFC's currently awaiting review, why not take a look and add your review in the spirit of collaboration and open-source. The proposers would really appreciate and value your input.

  1. rfc: configuration and shared files proposed by @JP-Ellis
  2. rfc: Define matching rules for form-urlencoded body by @tienvx

Pact-Plugins​

Have you written a Pact plugin, or used one yet? We've seen a few community members create some, here are some that I've found.

If you haven't and want to try it out, why not follow our Pact Plugin course, where you will learn the basics and get to build you own Plugin with templates we've provided to help you out.

If you fancy building one in a different language, I've created a suite of examples which you could use as a basis for your own project. Check them out here in my Pluginopedia.

Pact-Plugins - Slack​

Chat with us in: #pact-plugins.

Pact-JS​

James Gauld has been working on a couple of fixes in the Pact-JS lifecycle hooks.

Pact-JS - Slack​

Chat with us in: #pact-js

Pact-Python​

Pact-Python 2.2.2 was released, which included initial support for matchers in the Pact V3 interface.

Check out the example test, for sample usage.

Pact-Python - Slack​

Chat to us in: #pact-python.

Pact-PHP​

Tien has been reworking some of the examples in the Pact-PHP repo, and adding more features, with more Pact generators, as defined in the V3/V4 Spec, including supporting the fromProviderState generator for advanced use-cases.

Why not try them out?

Pact-PHP - Slack​

Chat to us in: #pact-php.

Pact Broker​

  • Stanislav provided another PR to the Pact Broker ecosystem, this time adding the --ignore <PACTICIPANT> flag to the pact-broker cli's can-i-merge command in this PR

  • Want to run a Pact Broker in Azure? Ian Crowl provided this addition to the docs, which still requires a bit of work,but might be enough to get you started!

Pact-Broker - Slack​

Chat to us in: #pact-broker.

Pact Net​

Pact-Net V5 has now been released. It contains several fixes and features, including leveraging the latest pact ffi 0.4.23

If you want to leverage the Pact V4 Specification, which will allow you to have multiple interaction types in a single Pact file, you should upgrade now, and a great place to start is the upgrade guide.

If you prefer learning by example, the workshops have been updated to use the latest Pact V5 release.

As well as the E2E examples

You can check out the PR history, to see the delta for the migration from Pact-Net V4->V5.

Pact-Net - Slack​

Chat to us in: #pact-net.

Community Events​

Are you talking about Pact or contract-testing this year at an event? Why not let us know and get yourself featured!

Lewis Prescott - Reliable End to End Testing with API Contracts using Cypress & PactFlow​

Lewis recently took to the stage at CypressConf to teach users about the fundamentals of contract testing as well as how to implement consumer-driven contract testing with Cypress + Pactflow.

Lewis Prescott - E2E Testing with Cypress/PactFlow

Murat K Ozcan - A triple whammy of contract testing posts​

Murat penned another post, this time looking at Pact Message. It's backed by examples in GitHub and well worth a read/look.

Thats a wrap​

Want to carry on the conversation? Sign up here to join our Slack community, where you will be amongst over 6k other users. It's a safe place to ask questions, and a great place to share the awesome work you are doing in the Pact ecosystem.

Whatever you are up to, let us know, and we can look to get you featured in the Pact post.

See you next month folks!

Cheers, Saf

Β· 10 min read

πŸ‘‹πŸ½ Welcome to the September Pact Blog, where we'll be covering all the updates in the Pact ecosystem along with events & material you've been sharing across the web.

Pact OSS Updates​

Pact RFCs​

We have two RFC's currently awaiting review, why not take a look and add your review in the spirit of collaboration and open-source. The proposers would really appreciate and value your input.

  1. rfc: configuration and shared files proposed by @JP-Ellis
  2. rfc: Define matching rules for form-urlencoded body by @tienvx

Pact-Plugins​

Back in March, we mentioned an issue when leveraging the Pact-Plugin framework with Pact-Go.

I'm pleased to say that the fix in the pact-plugins repo, was accepted and merged, to change the loading mechanism for plugins, from Tokio tasks, to System threads.

Pact-Plugins - Slack​

Chat with us in: #pact-plugins.

Pact-JS​

Pact-JS-CLI is now smaller, and leaner, with os/arch specific npm packages created for all supported platforms, thanks to this PR. The resolution for packages should be invisible to the end user, resulting in smaller downloads, and less disk-space being used by redundant files.

Available from V16.x - See the release notes for more detail

TL;DR
$ npx --package=@pact-foundation/pact-cli -c 'pact-broker version'
1.76.1

Want to see the same change in pact-js-core? Why not let us know!

Pact-JS - Slack​

Chat with us in: #pact-js

Pact-Go​

The pact-plugin update to switch from tokio tasks, to system threads was accepted, which allowed us to add the change to Pact-Go, hopefully fixing random panics during plugin based tests, highlighted in this issue.

Initial feedback is really positive. If you had this issue before, and it now appears to be resolved, why not let us know?

CGO or not to CGO? - In an infamous post by Dave Cheney, he mentions cgo is not go, and the mandatory requirement of cgo, in pact-go v2 has caused some users issues in initial setup. We have the potential to mitigate this requirement, by leveraging a project called ebitengine/purego, which describes itself as a library for calling C functions from Go, without Cgo. You can track the issue and associated pull request, to find out more.

Alpine Linux - We've been trying to get Pact working across alpine, natively, for all of our supported client languages, GoLang included. Follow the progress here. We are blocked at the moment due to some segfaults during the verification process and would appreciate any extra eyes, if this feature enhancement would be useful to you.

Pact-Go - Slack​

Chat with us in: #pact-go.

Pact-Python​

Some examples using the Pact-Python V3 interface, have now been included in the repo, thanks to Amit S in this PR.

Val Kolovos is also working on a Matcher proof of concept here in order to try and complete this open issue to Implement a Matcher interface, it has just been merged, but is awaiting the release of Python 3.14 (which has been delayed by a few days), before it will be released, however you can build the project locally to try out Val's changes today.

Pact-Python - Slack​

Chat to us in: #pact-python.

Pact-PHP​

Tien has began some incremental improvements in Pact-PHP V10, now that that v10 is now GA.

Two notable additions include

These changes are currently on the master branch and unreleased, so will require to use the dev-master version if you want to pick them up.

Pact-PHP - Slack​

Chat to us in: #pact-php.

Pact Ruby​

@trammel submitted a PR to remove webrick from a dependency to a dev-dep over in pact-ruby, however it will need pact_mock-service to be updated to use an alternative over webrick, and to be able to drop it as a runtime dependency completely. If anyone fancies attempting this, please let us know.

Webrick suffered a round of CVE's recently, so the Pact ruby ecosystem has been updated (pact-ruby-cli, pact-ruby-standalone, pact-broker).

Sbmt-Pact - Pact V3/V4 & Plugin Support​

The Kuper development team recently announced an open-source ruby gem, called sbmt-pact, which builds on the pact-ffi ruby wrapper gem I created.

Yuri, a Senior developer at Cooper, has created a comprehensive blog post (note: written in Russian, so you may need to use your favourite translator) which covers lots of points

  1. general principle of operation of contract tests;
  2. about the problems we encountered when implementing contract testing and how we solved them;
  3. how we developed our solution for contract testing of Ruby applications;
  4. about setting up CI/CD to automate contract tests.

I would wholly recommend reading the article especially as it also explains why sbmt-pact came to be

  1. the official ruby ​​gem only supported V1/V2 specifications, which only allow testing of http interactions;
  2. the grpc/kafka interactions we need are supported in the V3/V4 specifications;
  3. a little earlier, in the process of evolution and support of V3/V4 specifications, pact-foundation decided to rework the architecture and switched to shared rust-core , which assumes that test libraries for different stacks use FFI (foreign-function interface) as a single interface for interacting with the core in rust;
  4. the official ruby ​​gem remained in limbo for a long time and was not developed, in parallel pact-ruby-ffi was created , providing a low-level interface to pact-core;
  5. and only recently plans have emerged to develop an official ruby ​​gem and support V3/V4 - see Pact V3 Tracking Issue and Pact V4 Tracking Issue .

I particularly like these two quotes from the summary

Pact turned out to be not just a framework, but an entire ecosystem ready for any challenges of modern microservice architecture. With support for various languages ​​and protocols, it becomes an indispensable ally in the fight for code quality.

and

Ruby developers are especially pleased: even when official support lags behind, the community will always find a way out. Our experience with sbmt-pact is a vivid confirmation of this. This once again proves that there are no unsolvable problems in the open-source world.

I totally agree with you Yuri. πŸ™Œ

Why not try out sbmt-pact, and give the authors some feedback?

Pact-Ruby - Slack​

Chat to us in: #pact-ruby.

Pact Broker​

Deprecation notices

The Pact Broker image was updated to leverage Ruby 3.3.5 in v2.122.0.

Pact Broker Chart​

Shane Hull added the ability to set svc annotations, check out his PR here. It was merged and released this month.

Pact-Broker - Slack​

Chat to us in: #pact-broker.

Pact Net​

Pact-Net V5 Beta 3 has now been released. It contains several fixes and features, including leveraging the latest pact ffi 0.4.23

V5 of pact-net is considered to be pretty stable, and is being used in a few production workflows and we expect it to become GA very soon. If you want to leverage the Pact V4 Specification, which will allow you to have multiple interaction types in a single Pact file, you should upgrade now!

Pact-Net - Slack​

Chat to us in: #pact-net.

Community Events​

Are you talking about Pact or contract-testing this year at an event? Why not let us know and get yourself featured!

Murat K Ozcan - A triple whammy of contract testing posts​

Murat has recently been taking an adventure in the world of Pact, after picking up Marie & Lewis' Contract testing in Action book. He has written 3 posts which are well worth a read.

Pact & AI​

Generative AI, has become a dining room table topic and you may be wondering how it may impact the world of contract testing.

Both Matt and I take you through a 3-part journey, where we explore the importance of contract testing, the potential of Generative AI, and how PactFlow have turned a concept into reality, harnessing the power of GenAI, Pact best practice, and up to date knowledge of our consumer DSL's in order to allow you to unlock the value potential of contract testing sooner.

Pact & AsyncAPI​

The PactFlow team support a tool, called swagger-mock-validator, which allows you to compare a Pact file containing HTTP interactions, against an OpenAPI document. Originally created by Atlassian, it opened up broader use-cases than the traditional consumer driven approach with Pact, of replaying the interactions against a running provider, however does not offer as strong a guarantee, as it is reliant on the actual implemented provider, not drifting from the api description that is presented to consumers.

Whilst provider drift, is something that the industry has not fully addressed, (the ability to ensure a provider implementation completely honours its API description), the demand for static comparison tools to compare Pact files, is still there.

There is potential to couple both approaches, using API design documents as central points of truth. Using Pacts powerful DSL to generate consumer contracts. Using static comparison tools to ensure they honour the API description. If they differ, a proposal must be made in the documentation to reflect this. Pact plays a role in the verification of the provider, by replaying the Pact interactions, it mitigates provider drift from the consumer contract perspective, which with a static comparison tool, has been proven to adhere to the API description, eliminating provider drift for the known consumed endpoints in use.

Maybe in the future, we will see Pact being API description aware, in order to verify the implementation adheres to the API description.

However in the interim, one of the most requested comparison features, was Pact vs AsyncAPI.

AsyncAPI, for those who are unaware, is an API description format that covers event-driven systems, which consume or send messages, with a particular content format. The messages themselves may be transmitted over any number of different protocols, described as bindings in the AsyncAPI.

Message Pact, allows for the contract testing of service messages, without being interested in how the messages themselves are transmitted.

A recent introduction to the Pact ecosystem, exposed a plugin mechanism, which allows users to create their own custom content-type matcher & transport capabilities, which allows Pact users to consider content-types and transport capabilities not currently available in Pact, but leveraged in AsyncAPI based descriptions.

In order to try and progress momentum in providing a way to users to leverage AsyncAPI in their Pact journeys, I have created pact-asyncapi-comparator.

npx pact-asyncapi-comparator <Pact File Location> <AsyncAPI File Location>

It will allow for the comparison of application/json message content, in a V3 or V4 specification Pact file, against a valid AsyncAPI 2.x/3.x document.

I'd love for message pact users, to give it a go, and if it doesn't cover your use case, let me know in the issues section.

Thats a wrap​

Want to carry on the conversation? Sign up here to join our Slack community, where you will be amongst over 5.8K other users. It's a safe place to ask questions, and a great place to share the awesome work you are doing in the Pact ecosystem.

Whatever you are up to, let us know, and we can look to get you featured in the Pact post.

See you next month folks!

Cheers, Saf

Β· 6 min read

πŸ‘‹πŸ½ Welcome to the August Pact Blog, where we'll be covering all the updates in the Pact ecosystem along with events & material you've been sharing across the web.

Pact OSS Updates​

General Updates​

Pact RFC Process​

We mentioned an RFC process being introduced into the Pact ecosystem, last month, I'm pleased to say the PR has been merged, so I would invite users to begin to raise new RFC's where appropriate as we would love users to participate and help shape the future of Pact you want to see.

Specific language updates​

Pact-Reference​

Max Campman dropped a PR here to allow non-object matchers for array-contains.

Whilst Ron performed few fixes and incorporated the v2 Pact mock server into the Pact reference libraries

If you are a user of the Pact FFI library, we're hoping to see a new version released very soon with all of the above changes included.

Pact Mock Server​

v2.0.1 was released, which defaults the Pact spec version to the version from the Pact if not overridden.

Pact-Reference - Slack​

Chat with us in: #pact-rust.

Pact-Plugins​

v0.5.0 of the pact-protobuf-plugin was released and contains the following features:

  • Supports injecting provider state values into message fields and gRPC metadata

    • An example of usage is provided here
  • Better use of package names in resolving messages (Thanks to @stan-is-hate for this mammoth effect and offer thanks to Eric Muller who also took time to review.).

    Compatibility note

    The plugin is backwards compatible (with a caveat for message provider), but not forwards compatible, therefore it is advised that users update usage to the 0.5.0 or greater

v0.5.1 of the pact-protobuf-plugin was released and fixes handling of google.Structs correctly as raised in this issue.

An example of usage is provided here

v0.5.2 of the pact-protobuf-plugin was released and fixes fixes HTTP Protobuf interactions can have a message defined for both the request and response parts.

Ron also added some examples in both JVM and Rust, for tests which use HTTP and gRPC transports in the same test. You can find them here

Pact-Plugins - Slack​

Have you tried out Pact Plugins yet? What's stopping you?

Chat with us in: #pact-plugins.

Pact-Go​

Pact-Go v2.0.7 has been released which updates libpact_ffi to 0.4.22 & adds Windows CI coverage.

Pact-Go - Slack​

Chat with us in: #pact-go.

Pact-Python​

Val Kolovos has continued adding features for pact-python, after the blog post announcing async message support in pact-python using the new rust core, he is now working on introducing matchers.

If you want to get involved, don't forget, we have a Pact Compatibility suite which is a set of BDD style tests to check compatibility between Pact implementations. There are full implementations in JVM, and Rust, with Tien over in Pact-PHP using it to guide and validate his Pact Rust core based implementation of Pact-PHP.

Pact-Python - Slack​

Chat to us in: #pact-python.

Pact-PHP​

Artur Neumann dropped in a documentation PR, to help users test multiple interactions, in a single test, thanks!

Pact-PHP - Slack​

Chat to us in: #pact-php.

Pact Ruby​

Want to see V3 & V4 Pact Specification support in Pact-Ruby?

So do we!

There are two ways we can achieve this.

  1. Utilise the Pact Rust FFI
  2. Implement V3 & V4 spec support in Ruby

The latter option is less preferable, as by reusing the Rust FFI across all of our Pact client libraries, we aim to provide a consistent set of functions and experiences for users. However this may present a paradigm change to existing Ruby users, who had the benefit of using the Pact Core built in Ruby natively, whereas other language users relied on the Pact Ruby Gems being distributed in a standalone mechanism.

We are tracking work across three tickets

Please feel free to have the issues and see if you can help!

Chat to us in: #pact-ruby.

Pact-Compatibility-Suite​

A Set of BDD style tests to check compatibility between Pact implementations has been created in the pact-compatibility-suite

Current examples

In order to validate pact-go, pact-js & pact-ruby and it's adherence to the pact-specification, it would be good to begin to implement the following tickets.

Anyone is welcome to start implementing these, we are beginning to see contributors to pact-pythons v3/v4 implementation, so why not join in?

Community Events​

Are you talking about Pact or contract-testing this year at an event? Why not let us know and get yourself featured!

Mark Bradley - GopherConUK 2024 (Talk)​

Mark Bradley spoke at GopherConUK 2024 about "Using Pact to deploy Microservice with confidence". Thanks Mark, we will be reaching out to send you some swag!

Mark at GopherConUK

Augusto Colombelli - Contract Tests β€” APIs Guided by Consumers (Blog)​

Augusto Colombelli dropped in a PR to list his latest blog Contract Tests β€” APIs Guided by Consumers, which you can read over on Medium here.

Bas Djistrka - Practical contract testing with Pact (Course)​

Bas Djistraka from OnTestAutomation has just published details on his newest course, Practical contract testing with Pact. I'll let Bas describe it in his own words.

Contract testing is an approach that addresses the challenges of large-scale integration and E2E testing in distributed systems. It is not a new technique, in fact, it has been around for several years now, but unfortunately there aren't many good introductions, examples and use cases that clearly show the added value of contract testing, and how it can help speed up integration testing.

This course is designed to change that. Through hours of videos, quizzes and hands-on programming exercises, you will learn everything you need to know about contract testing, Pact and the tools in the Pact ecosystem.

You can take a look at the https://ontestautomation.teachable.com/p/practical-contract-testing-with-pact to find out more and sign up.

Discounts inside

Bas has kindly provided a discount code PACTFLOW-IO which will take 15% off the price, it's valid until the end of the year, so what are you waiting for?

Thats a wrap​

Want to carry on the conversation? Sign up here to join our Slack community, where you will be amongst over 5.8K other users. It's a safe place to ask questions, and a great place to share the awesome work you are doing in the Pact ecosystem.

Whatever you are up to, let us know, and we can look to get you featured in the Pact post.

See you next month folks!

Cheers, Saf

Β· 8 min read

πŸ‘‹ Hey all, 2024 is racing ahead ⏳, we are now 212 days into the year 😲, as I write this July Pact Post. As usual, I'll be keeping you up to date with all the latest happenings across the Pact Ecosystem.

Pact OSS Updates​

General Updates​

Pact RFC Process​

As you may be aware, there are multiple places where one can get help or request changes to the Pact ecosystem, either across the whole ecosystem, or for an individual repositories. Canny, our public roadmap, GitHub project boards on individual repositories, Slack to name a few.

Some of Pact's maintainers also work together, and as such conversations, discussions and agreements can be made but not consistently communicated, leaving users, for example who don't frequent Slack, or one of our maintainer sessions, to feel excluded from conversations.

As such we've decided to deprecate our Canny roadmap and have migrated 95% of the issues to GitHub, in our new Roadmap repo, to keep issues close to where the code is.

To try and counter some of the concerns around the decision-making process, we felt a RFC (Request for comments) process would be beneficial to allow for a record of proposed changes and decisions, and provide a central place to users, contributors and maintainers to go.

You can view the first pass at what the RFC process may look like in this proposed PR.

We would love users to participate and help shape the future of Pact you want to see.

Specific language updates​

Pact-Reference​

Pact FFI​

Another month, another release for libpact_ffi, this time 0.4.22

It includes some QoL fixes, including correcting pact-plugin shutdown behaviour on Windows, and users being unable to find pacts #67, when using a Pact Broker URL which is hosted on a sub path #420

For a full list, check out the release notes.

info

Pact FFI consists of multiple individual Pact rust crates.

Click on the Upgrade pact_* to x.y.z link in the release notes, to take you to the associated changelog.

Click here a diagrammatic view of the Pact Rust ecosystem, over on our docs site.

Pact Mock Server v2.0 is here \o/​

We mentioned in April, that Ron was redesigning Pact Mock Server, as the existing mock server implementation was written in 2017-2019, and contained some esoteric TLS code that was more complex to upgrade to Hyper 1.0 than to rewrite it using newer Hyper 1.0 constructs.

Upgrading to Hyper 1.0 also brought us the following benefits:

  • Supports both HTTP 1 and 2 with the same server implementation
  • Supports protocol upgrades (leading to supporting things like Web Sockets)
  • Middleware support
  • No more need for the custom TLS code

Check out the release log to find out what went into the rewrite, and watch out for the updated mock server making it's way through the Pact ecosystem shortly.

Pact-Reference - Slack​

Chat with us in: #pact-rust.

Pact-Plugins​

It's been nearly 2 years since we introduce the Pact Plugin framework to the world.

We've seen 2 plugins created by Pact maintainers (pact-protobuf-plugin, pact-csv-plugin), 2 created by non-maintainers (pact-avro-plugin, in-house json-rpc plugin) and provided a course to guide you on how to build your own plugin (pact-matt-plugin).

We know there are some rough edges, and we have been mulling over what the future of Pact-Plugins could look like. We want to start gathering feedback from users, maintainers and plugin authors, even if you tried it out and got stuck. We will see an RFC (request for comments) ticket being raised in the Roadmap soon and we would like to hold some group sessions to discuss, where participants will get to earn some swag for their time, as well as the satisfaction of being able to shape Pact Plugins destiny, whatever that may be!

Pact-Plugins - Slack​

Have you tried out Pact Plugins yet? What's stopping you?

Chat with us in: #pact-plugins.

Pact-Go​

Pact-Go v2.0.6 has been released which updates libpact_ffi to 0.4.21, go deps, and you'll find an updated Dockerfile which is tested in CI, along with newly added MacOS CI runners (both x86_64 & arm64). Windows CI will be added soon, the pact-plugin shutdown fix came out of issues in executing plugins in this PR. Oh and you might have found that if you are using plugins in pact-go, that they aren't shutting down cleanly, fixed that for you.

I've also been trying to track down a pesky intermittent bug on MacOS/Linux systems whilst using plugins. Some workarounds were applied directly to pact-go in the above release, however I believe the proper solution is in the pact-plugin driver. I've added a pull request which I hope to get merged soon, and pulled in pact-go.

Pact-Go - Slack​

Chat with us in: #pact-go.

Pact-JS​

Pact-JS-Core v15.1.1 has been released which updates libpact_ffi to 0.4.21.

Pact-JS v13.1.1 has been released which fixes #1229 - MatchersV3.reify doesn't extract payload from MatchersV3.nullValue()

Pact-JS-CLI is doing well, we are seeing lots of users switching over going by the ~23.5k downloads since we released it last month. I've put in a PR for review, which aims to leverage npm's optional dependencies, to support packaging and releasing of os/arch specific npm packages, which are consumed in the main project. This has the benefits of ensuring that only the required binaries for the platform you are running on, are downloaded.

Pact-JS - Slack​

Chat with us in: #pact-js.

Pact-Python​

Val Kolovos has continued adding features for pact-python.

Check out the PR here: Feat/async message provider and keep a lookout on the pact-python blog for a dedicated post soon

Thanks Val πŸ’›!

If you want to get involved, don't forget, we have a Pact Compatibility suite which is a set of BDD style tests to check compatibility between Pact implementations. There are full implementations in JVM, and Rust, with Tien over in Pact-PHP using it to guide and validate his Pact Rust core based implementation of Pact-PHP.

Pact-Python - Slack​

Chat to us in: #pact-python.

Pact-PHP​

Tien has been enjoying the summer, and a well deserved break after the epic work bringing the pact rust core to pact-php, so put down that 🍸 and give it a try!

Anyone can start testing pact-php with pact_ffi code by updating their composer.json

"pact-foundation/pact-php": "10.0.0-beta2"

This brings a raft of features to the Pact-PHP ecosystem including V4 Pact Specification support, access to the Pact Plugin ecosystem and huge speed benefits over the 9.x Ruby based release.

You can see a full range of examples here

Pact-PHP - Slack​

Chat to us in: #pact-php.

Pact-Net​

Want to see Pact Plugin support in .NET?

There is an open RFC where you can add your input, and possibly contribute to bringing the capabilities to pact-net.

To help nudge this along, I've created a suite of .NET examples exercising many of the known pact plugins in the ecosystem, along with the raw pact_ffi calls required to utilise them.

You can check it out here - https://github.com/YOU54F/pact-dotnet-ffi-plugins

In order to get this into Pact-Net, one would need to propose some API designs in the RFC, and then can leverage the examples I've created (probably adding your own .NET developer flair to them), to leverage Pact-Nets idiomatic API design, and use plugins in their current V1 form.

We appreciate there are some rough edges, and will be opening the floor to a discussions around the existing framework to ascertain where improvements need to be made or if a V2 design is warranted and what that may look like.

However we shouldn't let the future dictate what we can achieve now, so forth and plug pact-net into the pact-plugin ecosystem!

Pact-Net - Slack​

Chat with us in: #pact-net.

Community Events​

Are you talking about Pact or contract-testing this year at an event? Why not let us know and get yourself featured!

Holistic Testing with Microservices - Lewis Prescott​

Agile testing evangelists Lisa Crispin & Janet Gregory had Lewis Prescott on talk about how to use holistic testing with microservices and contract testing. Don't miss it over on YouTube here

Thats a wrap​

Want to carry on the conversation? Sign up here to join our Slack community, where you will be amongst over 5.7K other users. It's a safe place to ask questions, and a great place to share the awesome work you are doing in the Pact ecosystem.

Whatever you are up to, let us know, and we can look to get you featured in the Pact post.

See you next month folks!

Cheers, Saf

Β· 7 min read

πŸ‘‹ It's June, we've just passed the Summer Solstice, and some of you may be engrossed in footie-fever supporting your favourite team at the Euros ⚽. Good luck!

In this month's update, we will showcase what has been happening across the Pact OSS Ecosystem, letting you know how we got on at GitHub's Merge festival in Berlin, and sharing some of the latest community events coming up this year.

Pact OSS Updates​

General Updates​

Specific language updates​

Pact-Reference​

The Pact Rust core saw a good set of enhancements and fixes this month, with the latest release of pact_ffi 0.4.21.

This is mostly being driven by an increase of usage of the FFI interface, across client libraries which is resulting in issues being raised and fixed. Some of the key highlights include:

Check out the release notes here

If you've spotted something, once you've raised an issue, sometimes the best way to try and sort it, is yourself. We are happy to guide through the process, so don't be shy, get involved!

Pact-Reference - Slack​

Chat with us in: #pact-rust.

Pact-Plugins​

Ali Ustek helped with some maintenance work and updated the pact-plugin JVM driver to Gradle 8. It was a decent bit of work and it's much appreciated as it saves the core maintainers time to focus on other areas.

Pact-Plugins - Slack​

Have you tried out Pact Plugins yet? What's stopping you?

Chat with us in: #pact-plugins.

Pact-Go​

Back in April, GoLang recently introduced v1.22.x which has affected some of our users, and was raised: Runtime error occurs with golang 1.22.x.

It transpires the error was actually at our end, and was solved by the issues original poster fix: use the same signature for the same function (#402).

There was some impressive debugging done by the GoLang team which makes for an interesting read. Check it out here.

I'm going to use some of that new found knowledge to help me with my own debugging in the future.

Pact-Go has also been updated to v0.4.21 of the pact_ffi library, bringing smaller binaries, improved content-type detection, and the next pact-go release will be the first to offer native alpine support. Subscribe or star the repo for notifications, otherwise I'll update the post to let you know when it's released.

How are you finding Pact-Go? Let us know in the Slack channel.

Pact-Go - Slack​

Chat with us in: #pact-go.

Pact-JS​

Few bits of big news for Pact-JS this month:

  • Pact CLI tools (ruby based) have now been moved from @pact-foundation/pact-core to @pact-foundation/pact-cli. This is to make it easier for users to find the CLI tools, and to make it easier to maintain the codebase. You can find the new CLI tools here and read the migration guide here.
    • This dropped the package size from 353 MB to 164 MB
  • Alpine Support is here! Pact-JS now supports Alpine Linux, which is a lightweight Linux distribution that is commonly used in containerized environments. This is a big win for users who are using Alpine Linux in their environments previously having to port applications to a glibc (debian etc) based distro.
  • Package sizes are now smaller, the pact rust core binaries have been made smaller, so despite adding 2 new platform/arch combos, the package size has further been reduced to 116 MB.
  • Content-Type detection is improved via a fix in the pact rust core.
    • Related pact-js-core issue here
info
  • Add @pact-foundation/pact-cli into your package.json if you rely on the CLI tools in your project.
  • Check your project for any references to @pact-foundation/pact-core and update them to @pact-foundation/pact-cli.

Let us know how you get on!

Pact-JS - Slack​

Chat with us in: #pact-js.

Pact-Python​

We spoke last month where Val Kolovos assigned himself to one of the tasks: Add support and example for a message consumer test using Rust engine and we wished him luck!

We are pleased to say that we now have a V3 and V4 async message consumer test example in the Pact-Python codebase. This is a great step forward for the Pact-Python ecosystem, and we are excited to see how this will help users in the future.

Check out the PR here: Feat/async message consumer

Thanks Val πŸ’›!

If you want to get involved, don't forget, we have a Pact Compatibility suite which is a set of BDD style tests to check compatibility between Pact implementations. There are full implementations in JVM, and Rust, with Tien over in Pact-PHP using it to guide and validate his Pact Rust core based implementation of Pact-PHP.

Pact-Python - Slack​

Chat to us in: #pact-python.

Pact-PHP​

The v10 Beta2 release is here, which includes the new pact_ffi 0.4.21 release and all the fixes that came along with it.

Check out the release notes here

Anyone can start testing pact-php with pact_ffi code by updating their composer.json

"pact-foundation/pact-php": "10.0.0-beta2"

This brings a raft of features to the Pact-PHP ecosystem including V4 Pact Specification support, access to the Pact Plugin ecosystem and huge speed benefits over the 9.x Ruby based release.

You can see a full range of examples here

Pact-PHP - Slack​

Chat to us in: #pact-php.

Community Events​

Are you talking about Pact or contract-testing this year at an event? Why not let us know and get yourself featured!

GitHub Merge Festival - Berlin​

We had a great time at GitHub's Merge festival in Berlin), where we had the opportunity to meet some of you in person. It was great to see the community come together and share their experiences with Pact. We also had the opportunity to listen to some of the GitHub team and other event members, and discuss how we can continue to work together to make the developer experience even better.

If you are close to Berlin but didn't get to this event, don't miss the WeAreDevelopers World Congress on 17-19 July 2024. We won't be there unfortunately, but it's a great event to attend if you are in the area.

IMG_5893 (1)

It got pretty busy :)

IMG_0025

Brighton Java User Group​

Bas Dijkstra is continuing his contract testing tour, this time in Brighton on the 25th July, with the topic 'Solving the integration testing puzzle with contract testing'. If you are in the area, make sure to check it out.

GopherConUK 2024​

Mark Bradley will be speaking at GopherConUK 2024, 14th-16th of August. He his topic will be "Using Pact to deploy Microservice with confidence". If you are attending, make sure to check out his talk.

image

You can also check out some of his previous material on the topic of Pact, on his blog site here: https://mark-bradley.net/tag/pact/.

Community Videos​

Made some cool video content showcasing Pact? Let us know to get featured!

What is contract testing?​

Check out Daniel Knott providing an introduction to contract testing, along with further reading to help aid your journey. Check it out on YouTube here. He covers many different testing topics, so this along with it others are certainly worthy of your time.

Thats a wrap​

Want to carry on the conversation? Sign up here to join our Slack community, where you will be amongst over 5.5k other users. It's a safe place to ask questions, and a great place to share the awesome work you are doing in the Pact ecosystem.

Whatever you are up to, let us know, and we can look to get you featured in the Pact post.

See you next month folks!

Cheers, Saf

Β· 12 min read

πŸ‘‹ It's May, and time is flying as we move into the 2nd half of the year. I'll be bringing you the usual updates from the world of Pact in the last month.

Pact OSS Updates​

General Updates​

  • Alpine is now supported in the pact-reference core
  • The builds are static, and therefore the single binary works across musl or glibc based distros (excluding ffi)
  • pact_ffi library comes in both static *.a & shared *.so variants for musl, depending on the consuming client libraries requirements for ffi interop
libraryalpine supportversion
pact_ffiβœ…- x86_64 .a from 0.2.4
- aarch64 .a from 0.4.15
- .so from 0.4.17
pact_mock_server_cliβœ…- 1.0.5
pact_verifier_cliβœ…- 1.1.1
pact-stub-serverβœ…- 0.6.0
pact-plugin-cliβœ…- 0.1.2
pact-protobuf-pluginβœ…- 0.3.15
pact-csv-pluginβœ…- 0.0.6

Specific language updates​

PHP​

Pact-PHP V10 Beta Release​

The v10 Beta release has landed due to an epic amount of work from Tien Vo Xuan and Lewis Cowles

Check out the release notes here

Anyone can start testing pact-php with pact_ffi code by updating their composer.json

"pact-foundation/pact-php": "10.0.0-beta1"

This bring a raft of features to the Pact-PHP ecosystem including V4 Pact Specification support, access to the Pact Plugin ecosystem and huge speed benefits over the 9.x Ruby based release.

You can see a full range of examples here

Pact-PHP Alpine Support​

You'll also be pleased to know, that the 10.0.0-beta1 is the first of the client libraries to support Alpine! πŸŽ‰

Pact-PHP - Slack​

Chat to us in: #pact-php.

Pact-Reference​

Pact-Reference - Pact FFI​

0.4.20 of libpact_ffi was released

This release allows optional query parameter values, as well as fixing a pesky warning that was cluttering users consoles. It also pins our shared library to glibc 2.23 for linux gnu targets (non-musl). This allows users of RHEL8 and other older supported distros to still utilise the pact_ffi library, as well as those on later distributions.

Pact-Reference - Pact Mock Server​

Ron has started a redesign/rewrite for a V2 version of the Pact Reference Mock Server, and would find it easier to support multiple versions with branches it the crate is not in a mono-repo (pact-reference).

Therefore the action was taken to move it from its home in pact-reference to its own repository

You can find it here https://github.com/pact-foundation/pact-core-mock-server

  • The pact_mock_server code resides here
  • The pact_mock_server_cli code resides here

Pact-Reference - Pact Stub Server​

A couple of features dropped to

Pact-Reference - Pact Stub Server - Docker​

Pact-Reference - Pact Stub Server - Docker - Supported Platforms​

Multi-platform images are available, and can be used cross-platform by setting the platform flag.

  • --platform=linux/amd64
  • --platform=linux/arm64
  docker run --platform=linux/arm64 -t -p 8080:8080 -v "$(pwd)/pacts/:/app/pacts" pactfoundation/pact-stub-server -p 8080 -d pacts
Pact-Reference - Pact Stub Server - Docker - Supported Registries​

Docker images are published to multiple registries

Pact-Reference - Pact Stub Server - Supported Platforms​

OSArchitectureSupportedPact Stub Server Version
OSXx86_64βœ…All
Linuxx86_64βœ…All
Windowsx86_64βœ…All
OSXarm64βœ…>=0.5.2
Linuxarm64βœ…>=0.5.2
Windowsarm64βœ…>=0.6.0
Alpinex86_64βœ…>=0.6.0
Alpinearm64βœ…>=0.6.0

Note: From v0.6.0, Linux executables are statically built with musl and as designed to work against glibc (eg, Debian) and musl (eg, Alpine) based distos.

Pact-Reference - Slack​

Chat with us in: #pact-rust.

Pact-Plugins​

A couple of features dropped to

Pact-Plugin-CLI - Supported Platforms​

OSArchitectureSupportedPact Plugin CLI Version
OSXx86_64βœ…All
Linuxx86_64βœ…All
Windowsx86_64βœ…All
OSXarm64βœ…All
Linuxarm64βœ…>=0.0.4
Windowsarm64βœ…>=0.1.2
Alpinex86_64βœ…>=0.1.2
Alpinearm64βœ…>=0.1.2

Note: From v0.1.2, Linux executables are statically built with musl and as designed to work against glibc (eg, Debian) and musl (eg, Alpine) based distos.

Pact-CSV-Plugin - Supported Platforms​

OSArchitectureSupportedPact CSV Plugin Version
OSXx86_64βœ…All
Linuxx86_64βœ…All
Windowsx86_64βœ…All
OSXarm64βœ…>=0.0.1
Linuxarm64βœ…>=0.0.4
Windowsarm64βœ…>=0.0.6
Alpinex86_64βœ…>=0.0.6
Alpinearm64βœ…>=0.0.6

Note: From v0.0.6, Linux executables are statically built with musl and as designed to work against glibc (eg, Debian) and musl (eg, Alpine) based distos.

Pact-Protobuf-Plugin​

A couple of features dropped to

And we saw a community fix from new contributor Eric Muller in this PR

Pact-Protobuf-Plugin - Supported Platforms​

OSArchitectureSupportedPact Protobuf Plugin Version
OSXx86_64βœ…All
Linuxx86_64βœ…All
Windowsx86_64βœ…All
OSXarm64βœ…All
Linuxarm64βœ…>=0.1.11
Windowsarm64βœ…>=0.3.15
Alpinex86_64βœ…>=0.1.9
Alpinearm64βœ…>=0.3.15

Note: From v0.3.15, All Linux executables are statically built with musl and are designed to work against glibc (eg, Debian) and musl (eg, Alpine) based distos.

Pact-Protobuf-Plugin - Slack​

Have you tried out Pact Plugins yet? What's stopping you?

Chat with us in: #pact-plugins.

Golang​

Pact-go:

v2.0.5 is out which includes Janez Justin's change we spoke about last month and updates several dependencies in the project.

Chat with us in: #pact-go.

Pact-JS​

Pact JS Core saw a few new fixes, which thanks to npm's package resolution and our use of a caret in our dependency of @pact-foundation/pact-core in @pact-foundation/pact, means you will pull in the latest fixes, without a new release of @pact-foundation/pact

Pact-JS - Alpine support​

A pull request has gone in to bring alpine/musl support to pact-js-core and pact-js. It will close this open RFC.

Please feel free to take a look, drop a review, or a comment to say that this is a feature you would like!

If you'd rather wait until its released, please try it out in your projects and let us know how you get on.

Pact-JS - Slack​

Chat with us in: #pact-js.

Python​

Pact-Python:

Pact Pythons core maintainer has been enjoying a well-earned holiday for the last month, and in true open-source style, 2 new contributors arrived, wanting to get involved in extending the Pact Rust FFI support in Pact-Python.

Shout outs go to David Rettie & Val Kolovos, who are getting involved. It all started with a question

hello! I'm interested in putting some time into helping out with the pact V3/ffi tasks. I've been familiarising myself with the codebase and work done so far, I'm wondering if any other contributors or maintainers would like to have a call to help me get on the right track ?

Val dove in head first and naturally came up against a few blockers, questions are always welcome, especially as the help often paves the way for others.

I'm currently working to implement the v3 message_consumer.feature test. I've made pretty good progress, but I just got stuck on generators. I haven't been able to find anything in any of the other languages, so I was hoping someone here might be able to point me in the right direction.

Val has currently assigned himself to one of the tasks: Add support and example for a message consumer test using Rust engine and we wish him luck!

If you want to get involved, don't forget, we have a Pact Compatibility suite which is a set of BDD style tests to check compatibility between Pact implementations. There are full implementations in JVM, and Rust, with Tien over in Pact-PHP using it to guide and validate his Pact Rust core based implementation of Pact-PHP.

Chat to us in: #pact-python.

Community Events​

Praveen Erode Mohanasundaram - Contract Testing: The Key to Unlocking E2E Testing Bottlenecks in CI/CD pipelines​

Long time Pact advocate and community contributor Praveen Erode Mohanasundaram spoke at Devoxx UK about Contract Testing: The Key to Unlocking E2E Testing Bottlenecks in CI/CD pipelines.

I'll let Praveen give an overview of his talk

As organisations embrace microservices architecture to achieve rapid, independent deployments, they often encounter obstacles that impede these benefits. A common challenge is an overreliance on traditional end-to-end testing strategies, which, while providing confidence, can slow deployment, create dependencies, and limit team autonomy.

Drawing from the transformative journey at Discover Financial Services, where we navigated the challenges of modernising systems into a microservices architecture, this presentation will delve into the hurdles encountered, the pivotal role of contract testing in overcoming these challenges, various contract testing strategies and open source tools, and our evolutionary path towards embracing contract testing. Join me to discover how this approach became the catalyst for removing bottlenecks in our CI/CD pipeline, unlocking the true potential of microservices for unparalleled agility and success

Interested? Well lucky for you, you can catch the video on YouTube πŸ“Ί

TestGuild - Getting the Most Out of Open Source with Yousaf Nabi​

TestGuild Yousaf Podcast

I recently spoke with Joe Colantonio about all things open-source, you can check it out via multiple mediums via the links on the TestGuild site, whether you prefer watching a video or listening to a podcast, Joe has got you covered.

Pact Showcasing at the GitHub Open Source Fair @ The Merge - Berlin​

OpenSource Fair

THE MERGE is a developer experience conference brought to you by GitButler, a dev tool company founded by the co-founder of GitHub. They are bringing together technical founders and execs from companies such as GitHub, Sentry, Heroku, and Tauri to discuss all things developer tools and the communities they built around them.

There will also be an Open Source Fair where 24 selected projects will get the chance to showcase!

We are proud to announce that Pact was selected, so we will be there spreading the Pact love far and wide.

If your in Berlin, June 13th-14th, why not come and talk to us!

Book updates - Contract Testing in Action​

Contract Testing In Action book cover

Another 4 chapters have just dropped for the book Contract Testing in Action on Manning, written by Marie Cruz and Lewis Prescott.

If you are new to Pact, be sure to check it out! πŸŽ‰

info

πŸ₯· Don't forget!

You can use CTA45 between April 29 to July 30 to save 45% πŸ€‘

πŸŽ₯ If you want to give the book some promotion, or offer a quote, reach out to Marie, Lewis or myself

Thats a wrap​

Want to carry on the conversation? Sign up here to join our Slack community, where you will be amongst over 5.5k other users. It's a safe place to ask questions, and a great place to share the awesome work you are doing in the Pact ecosystem.

Whatever you are up to, let us know, and we can look to get you featured in the Pact post.

See you next month folks!

Cheers, Saf

Β· 9 min read

πŸ‘‹ Hello and welcome to the April update from the world of Pact. We've got a varied selection as always, but my personal favorite is all about a πŸ“–.

Read on to find out, as I'm not going to spoil the surprise. πŸ™Š

Pact OSS Updates​

General Updates​

GitHub Actions recently switched macos-latest runners to macos-14 which is MacOS Sonoma running on an arm64 (apple silicon) processor over its predecessor x86_64 (intel).

Hopefully that hasn't given you much grief, but it certainly has had an impact on some of our workflows which we've needed to rectify.

macos-11 will be deprecated some time in June, and users should prepare for a time where only arm64 macos machines are available on GitHub actions, and ensure use of Rosetta for any x86_64 invocations.

Specific language updates​

PHP​

Pact-PHP:

Tien Vo has been continuing the trend with many more pull requests against the Pact-PHP project, preparing for the launch of Pact-PHP v10.x

Pact-PHP v10.x is now mainlined on the master branch, and Pact-PHP v9.x has moved to the release/9.x branch.

We've just synced the latest docs from the repo, to the website, so you can find Pact-PHP's new docs here

You can find the full list of April's merged pull-requests here. I've elected not to list them, as the current number is 37! πŸš€

Why not help us make it 38!

Chat to us in: #pact-php.

Pact-Reference​

Pact-Reference:

We've seen a raft of features and fixes land this month in Pact-Reference. Mainly driven by Tien Vo (Pact-PHP) & Josh Ellis (Pact-Python) during their work in implementing the pact-ffi in their respective languages, and trying to implement the full Pact compatibility suite. We also as usual have users working with the pact-reference project raising issues and proposing fixes via PR's. We are grateful for all the feedback, and contributions to the project.

Features & Fixes:

Chat with us in: #pact-rust.

Pact-Plugins​

Pact-Plugins:

Pact Plugin Driver​

  • Ron found an issue in the Rust plugin driver, which was causing slow-down issues on Windows machines. The upshot of his findings, is that plugin based tests on Windows should run quicker. You can check out the commit here. If you are using the Pact-FFI, I think you'll need to wait for a release beyond libpact_ffi-v0.4.19 to be cable to consume these.

Pact-Protobuf-Plugin​

  • A range of fixes were released in v0.3.14 of the pact-protobuf-plugin off the back of this raised issue. For the full list of changes, see the changelog

Have you tried out Pact Plugins yet? What's stopping you?

Chat with us in: #pact-plugins.

.NET​

Pact-net:

  • Last month we spoke about releasing musl variants on the Pact FFI library. We saw our first community contribution, in consuming these in a Pact client project, in this issue and respective PR. This is exciting to see. I'd love to see linux Aarch64 support for musl and non-musl variants. Fancy dropping in a PR?
  • The Road to Pact Plugins.
    • If you are waiting eagerly for access to the Pact Plugin framework within Pact-Net, why not comment on the open RFC where you can register your interest in using it, or potentially contributing to it's implementation.
  • The Road to Pact-Net V5.
    • Are you using Pact-Net V5 Beta? Drop us some feedback and let us know how you are getting on. It's really invaluable in helping us decide when to promote from a beta to a release-candidate.

Chat with us in: #pact-net.

Golang​

Pact-go:

GoLang recently introduced v1.22.x which seems to have introduced some defects for the GoLang community, causing segfaults on linux x86_64 machines. This affected some of our users, and was raised here

TL;DR​

Linux x86_64 users

  • Using GoLang 1.22.x ?
    • Resolution: disable -race
  • Need to use -race?
    • Resolution: downgrade to 1.21.x

Features:

  • Janez Justin removed go-getter in this PR in favour of utilising the stdlib's net/http and compress/gzip to download the pact_ffi dependencies for the project. This helped him resolve an indirect vulnnerablity in Pact-Go and has the additional benefit of greatly reducing the size of the dependency tree. Thanks Janez!
  • Still stuck on Pact-Go v1.x? You can now publish pacts with the branch property set, thanks to this PR
    • Note: If you are using Pact-Go v2.x, you will utilise the pact-cli tools for publishing pacts, which already supports the branch parameter.

Fixes:

  • The main Pact documentation website has been updated to include the new Pact-Go V2 package and documentation. It seems we missed our doc's sync job when promoting V2 from it's beta state. Not to fear though, thanks to a community report for identifying, it has now been rectified and you can find the new documentation here.

Chat with us in: #pact-go.

Pact-JS​

Features:

Fixes:

Chat with us in: #pact-js.

Python​

Pact-Python:

🎺 Pythonista’s rejoice.

We are thrilled to announce the release of Pact Python v2.2, a significant milestone that not only improves upon the existing features but also offers an exclusive preview into the future of contract testing with Python.

Be sure to read about at pact-pythons new doc site, in its inaugural blog post from maintainer Josh Ellis.

Chat to us in: #pact-python.

Community Events​

Solving the integration testing puzzle with contract-based testing​

Bas Dijkstra is an independent test automation consultant and trainer, who has been active in the test automation field for some 16 years now, and has worked on software testing and automation solutions across a wide range of programming languages, frameworks and technology stacks.

Bas

He recently delivery a talk about contract testing with Pact.NET, which you can watch here.

I'll hand over to Bas in his own words, to describe what's in store.

Setting up and running integration and end-to-end tests in distributed software systems is hard. Making sure that all components are deployed, with the right version, in the right state, with the right data is a challenging task for many teams.

Contract-based testing is an approach that tries to address this problem and simplify and speed up integration testing for distributed software systems.

In this talk and recorded demo, you'll learn about the basic principles behind contract-based testing, the questions it tries to answer, and the three different approaches to contract-based testing. You will also see contract-based testing in action, using the well-known Pact.Net library for C#. To wrap up the talk, we will also talk about how to adopt contract-based testing in your team and organization, and some of the potential pitfalls that should be addressed along the way.

If you want to get in touch, please use the contact form on his site, or send Bas an email at bas@ontestautomation.com.

Hot new reads​

We've often wondered when a book dedicated to contract testing would appear on the scene. We even had this statement on the books section of our site

We're not aware of any books currently dedicated to contract testing, but here are some that talk about Pact and contract testing as part of a broader microservices development and testing strategy

However good news everybody 🎺

Contract Testing In Action​

Contract Testing In Action book cover

We are pleased to announce that Contract testing experts Marie Cruz and Lewis Prescott, have put pen to paper, and have just released the Contract Testing in Action πŸ“• under the MEAP (Manning Early Access Program).

Contract Testing in Action is a hands-on guide to contract testing for microservices applications and other systems of loosely-coupled components. After learning the basics of contract design and implementation, you’ll dive into constructing your own contract testing framework. You’ll explore the leading contract testing tools, including Pact, PactFlow, and GitHub Actions. Plus, you’ll set up consumer-driven contract testing for REST and GraphQL APIs and learn to integrate contract testing into a CI/CD pipeline. Finally, you’ll delve into provider-driven contract testing, which simplifies adoption by utilizing your existing stack and practices.

What does early access mean for you?

  1. You get a book dedicated to Contract Testing, written by industry leading experts.
  2. You get the chance to offer direct feedback, into the chapters as they progress. You can join the discussion forum here.
    1. This allows you to stamp your mark on the world of contract testing.
  3. If you love the book, we would love the following:
    1. Quotes that could be used in the book
    2. Social Media promotion

How can you get your hands on a copy?

Check out Contract Testing in Actions page on Manning's site.

info

πŸ₯· Want a discount?

You can use CTA45 between April 29 to July 30 to save 45% πŸ€‘

πŸŽ₯ If you want to give the book some promotion, or offer a quote, reach out to Marie, Lewis or myself

Thats a wrap​

Want to carry on the conversation? Sign up here to join our Slack community, where you will be amongst over 5k other users. It's a safe place to ask questions, and a great place to share the awesome work you are doing in the Pact ecosystem.

Whatever you are up to, let us know, and we can look to get you featured in the Pact post.

See you next month folks!

Cheers, Saf

Β· 10 min read

Welcome everyone, to that time of year when the πŸ•’ shifts an hour forward, the 🌞 shines on for a bit longer, which is nice, after a πŸ₯Ά and 🌧️ winter. It's March and we are live for another Pact Open Source update.

We've got lots of community contributions this month, and pleased to announce that Pact-PHP v10 is wrapping up for an official release, which will bring that Pact Rust core to more users, bringing speed and reliability benefits over the existing implementation. Huge props go out to Tien Vo πŸ‘¨πŸ»β€πŸ’» for the incredible coding marathon, and Lewis Cowles πŸ•΅οΈ for the code reviews.

Pact OSS Updates​

Specific language updates​

PHP​

Pact-PHP: V10 is nearly here. πŸš€ This brings the Pact Rust core to Pact-PHP allowing support up to the Pact V4 specification, which includes http / async & sync message / plugin interaction support, as well as allowing these to all co-exist in a single Pact file.

Here is a bit of a timeline of activities:

  • βœ…10.0.0-alpha7 release just went live
  • βœ… Creation of a release/9.x branch from current master branch for anyone who still want to work on Ruby Standalone code.
  • βœ… Merging of ffi branch into master
  • πŸ”œ Official release of Pact-PHP v10
    • alpha -> beta -> release

Once again we want to thank Tien and Lewis for their efforts in bringing this across the line. It is a testament to open-source collaboration across the globe, and has been really fun to watch. I really hope you enjoy using the new release. Be sure to drop us feedback like Steve Taylor did in this Github Issue

Not an issue as such, just want to say I love it. (I'm using 10-alpha3) It's so much faster and simpler, and I'm looking forward to using some of the newer Pact specification features. My API tests came across easily without much fuss.

Chat to us in: #pact-php.

Pact-Reference​

Pact-Reference:

  • Multi-Arch Docker images.

    • You asked for it, you got it!

      • --platform=linux/amd64

      • --platform=linux/arm64

      • DockerHub Images

    • Whats left?

      • CI pipeline to automate building/publishing of Docker images
      • Publishing of images to GitHub container registry
  • Alpine Support

    • Linux binaries are now built with musl statically linked rather than glibc dynamically.

      • This means any Linux users, regardless of distribution should all be able to use a single architecture specific binary.
    • Releases

      • pact-verifier-cli

        curl -LO https://github.com/pact-foundation/pact-reference/releases/download/pact_verifier_cli-v1.1.1/pact_verifier_cli-linux-$(uname -m).gz
        gunzip pact_verifier_cli-linux-$(uname -m).gz
        mv pact_verifier_cli-linux-$(uname -m) pact_verifier_cli
        ./pact_verifier_cli --help
      • pact_mock_server_cli

        curl -LO https://github.com/pact-foundation/pact-reference/releases/download/pact_mock_server_cli-v1.0.5/pact_mock_server_cli-linux-$(uname -m).gz
        gunzip pact_mock_server_cli-linux-$(uname -m).gz
        mv pact_mock_server_cli-linux-$(uname -m) pact_mock_server_cli
        ./pact_mock_server_cli --help
    • Whats left?

    • Pact FFI Alpine specific static and shared libraries

      • These are now published, and require consumption in client libraries. Contributions are welcome, otherwise you'll hopefully see these rolling out throughout the year.

Chat with us in: #pact-rust.

Node JS​

Pact-JS​

Pact-JS Features​
info

Did you know, Pact-JS now supports the V4 Specification via the PactV4 interface. The documentation has been updated to reflect this. Found an issue or gap? Let us know

Corporate proxy support was delivered by Zac Poe in this pull request

  • feat(corporate proxy #1188)

In Zac's words

Add native support of HTTPS_PROXY and HTTP_PROXY for verifier for #1188

This change adds two pieces of behavior:

  • The verifier's 2 step parse body behavior now uses a proxy request buffer (instead of the 'proxyReq' rewrite behavior) to ensure the request stream is accessible for intermediary agent behavior
  • The verifier natively supports HTTP_PROXY/HTTPS_PROXY config and assigns a proxy http Agent where those values are present

This results in out-of-the-box support for corporate proxies in the js verifier

Thanks Zac πŸ™Œ

Pact-JS Fixes​

Dany Marques went down the NPM rabbit hole, to investigate the root cause of a very interesting bug, affecting NPM registry proxies, and npm script-jacking!

Some long nights with his detective hat on, saw Dany find a suitable workaround as an interim for the Pact-JS project, as well as upstream fixes to the npm project itself. We cannot thank you enough for your herculean efforts.

Matt Fellows fixed an issue where matching rules are not supported in messages: pact-foundation/pact-js#1183.

If you've been stuck on either of these issues, be sure to give it a re-test!

Chat with us in: #pact-js.

React/Cypress users​

GearΓ³id Γ“ Treasaig upgraded one of our example repos which contains our vanilla React "Product" API consumer used across all the JS HTTP based examples, and additionally includes Cypress and Pact-Cypress-Adapter.

GearΓ³id utilized graphite.dev to stage his pull-requests in distinct commits. The PR for good reading if you are preparing for upgrading some major dependencies in your JavaScript project, and want an example to follow. Thank you, we really appreciate it.

If you want to get involved, why not pull down the example and try it out, or apply upgrades to one of our many example repos. We would greatly appreciate it, and it is a neat way to start contributing to open source, if you haven't managed to already, but want to start somewhere!

Pact Broker​

Pact-Broker: Multi-Platform support + GitHub container registry support.

Multi-platform images are available

  • --platform=linux/amd64

  • --platform=linux/arm/v7

  • --platform=linux/arm64

  • DockerHub Image

    docker pull pactfoundation/pact-broker:latest
  • GitHub Container Registry Image

    docker pull ghcr.io/pact-foundation/pact-broker:latest
    • Note: The Org name needs to match our GitHub org, so note the additional hyphen - between pact-foundation

Pact Broker on AWS Fargate with CDK​

The beauty of the Pact Broker nature as a Docker image, means that it can be deployed in a multitude of different ways, and the architecture considerations are the end users to determine, implement and manage.

There are projects which seek to offer experiences with Terraform & Helm in order to provide some out-the-box experiences for regular deployment platforms.

Most of these have come from community contributions, either publicly displayed on GitHub, or shared back into the Pact-Foundation, such as pact-broker-chart.

I'm pleased to announce that we've had a community contribution by learnautomatedtesting of a PactStack, an open source tool utilizing gitlab AWS CDK to publish and deploy a serverless framework of the pactbroker and postgres database.

PactStack is a serverless solution for running a Pact broker alongside a PostgreSQL database entirely on AWS Fargate, leveraging the AWS Cloud Development Kit (CDK) for infrastructure as code. This solution is designed to facilitate contract testing between microservices by providing a centralized broker for storing and retrieving Pact contracts. The stack includes an ECS cluster, Fargate services for the Pact broker and PostgreSQL database, a CloudWatch Log Group for logs, and an S3 bucket for storing Pacts.

You can check out the repository here and see it in action against a full worked example

We've not had the chance to test this out yet, but if it appeals to you, please feel free to try it out and let the author know if you have any issues.

Chat to us in: #pact-broker.

Pact Ruby CLI​

Pact-Ruby-CLI: Multi-Platform support + GitHub container registry support.

Multi-platform images are available

  • --platform=linux/amd64

  • --platform=linux/arm/v7

  • --platform=linux/arm64

  • DockerHub Image

    docker pull pactfoundation/pact-cli:latest
  • GitHub Container Registry Image

    docker pull ghcr.io/pact-foundation/pact-cli:latest
    • Note: The Org name needs to match our GitHub org, so note the additional hyphen - between pact-foundation

Chat to us in: #pact-ruby.

Pact Docs​

Martin Gallauner is on his road to Pact Nirvana, and has been dropping some edits to the guide as he is working through it.

Thanks Martin, we really appreciate it and know that our end-users will to!

Did you know, that the majority of our website documentation was written by volunteers and it is a collective smattering of shared knowledge. A contract testing wikipedia if you will.

Whilst this is awesome, it can make a new users journey, a little disjointed at times, as they can feel overloaded with information.

We'd love to look at the documentation estate as a whole this year, and redesign our user journeys. If this appeals to you, why not get in touch.

Community Events​

Women Who Go London Feb 2024​

image

I had the pleasure of traveling down to London and speaking to a load of budding software-engineers at Deliveroo HQ about GoLang via the Women Who Go London group!

How do we test our applications now, what are the benefits and drawbacks of each way of testing and how does integration fit into all of it. Yousaf explains it all and provides examples on how to start contract testing with Go and Pact.

You can check out the slides here

Sanyia Saidova walks us through the journey of how to shape your platform to account for growth in your application - what decisions lay in your path as your userbase grows and how to weight them.

IMG_5478

You can check out Sanyia's slides here

Are you in, or near London? Do you love coding? Do you want to build a more diverse and inclusive Go community? Why not join us the WWGL Meetup group and attend an event soon.

Community shout-outs​

Big shout outs go to these contributors for their efforts, big and small.

  • Tien Vo for his dedication and determination to complete the pact-php rust core migration, I'm sure it's been a learning journey and you've come out as an even better PHP developer. We hope you can take you learnings and apply in a day job, as many others will be able to apply your code against their projects, providing safety and guarantees for years to come.
  • Lewis Cowles for the continual reviews in pact-php and support for Tien Vo.
  • Dany Marques for his tenacity in tracking down an obscure bug in the npm ecosystem, and creating upstream fixes, as well as resolving his issue in the interim in the pact-js project.
  • GearΓ³id Γ“ Treasaig for a series of PR's to improve the quality and health of our examples.
  • learnautomatedtesting for the Pact Broker AWS Fargate project and demo.
  • Zac Poe for corporate proxy support in Pact-JS

No matter the contributions, your work will make a positive impact to end users, who wish to benefit for Pact's feature-set, no matter the language or the tooling. We love seeing users bring fixes, improvements and new features to the Pact stable. We can help support you, if you aren't sure where to start.

What's stopping you?

Thats a wrap​

Want to carry on the conversation? Sign up here to join our Slack community, where you will be amongst over 5k other users. It's a safe place to ask questions, and a great place to share the awesome work you are doing in the Pact ecosystem.

Whatever you are up to, let us know, and we can look to get you featured in the Pact post.

See you next month folks!

Cheers, Saf

Β· 3 min read
tl;dr

Call one of the following when a branch is deleted in your CI systems to improve your Pact Broker performance.

  • Pact CLI's pact-broker delete-branch command
  • Pact Broker's API endpoint http://broker/pacticipants/$APPLICATION_NAME/branches/$BRANCH

Most CI systems provide event triggers which can be used to detect branch deletion events.

Back in 2021, the Pact Broker introduced the concepts of Branches and environments, rather than overloading tags, for both purposes. This came with a range of benefits, described in this post.

We've seen rafts of you switch over to the new state of Pact Nirvana, utilizing branches and environments, to their full effect and today I'd like to share a little tip, to help keep your Pact Broker working at it's optimum.

It is important to have good hygiene in your Pact Broker, ensuring that when you remove applications, branches, or environments from your version control system (github/bitbucket etc), you reflect the same within your broker.

Doing so, will improve performance when fetching pacts for verification and is highly recommended if you are deeply reliant on the can-i-deploy matrix's output, to keep query times as low as possible.

Removing stale branches is one of the easiest, and yet most overlooked areas of these, so I'm going to show you a couple of different techniques you can use.

Delete Branch Methods​

Removes a branch from a pacticipant version. Does not delete the actual pacticipant version.

API​

Send a DELETE request to the branch version resource.

Pact Broker - No Auth - Delete Branch​

curl -X DELETE $PACT_BROKER_BASE_URL/pacticipants/$APPLICATION_NAME/branches/$BRANCH

Pact Broker - Basic Auth - Delete Branch​

curl --user $PACT_BROKER_USERNAME:$PACT_BROKER_PASSWORD \
-X DELETE $PACT_BROKER_BASE_URL/pacticipants/$APPLICATION_NAME/branches/$BRANCH

PactFlow Broker - Bearer Auth - Delete Branch​

curl -H "Authorization: Bearer $PACT_BROKER_TOKEN" \
-X DELETE $PACT_BROKER_BASE_URL/pacticipants/$APPLICATION_NAME/branches/$BRANCH

Note:

If you want to check if your Pact Broker has support for the above relation, you can call the Pact Broker index, and check for the existence of _links."pb:pacticipant-branch"

Pact Broker - No Auth - Index​

curl $PACT_BROKER_BASE_URL \
| jq '._links."pb:pacticipant-branch"'

Pact Broker - Basic Auth - Index​

curl --user $PACT_BROKER_USERNAME:$PACT_BROKER_PASSWORD $PACT_BROKER_BASE_URL \
| jq '._links."pb:pacticipant-branch"'

PactFlow Broker - Bearer Auth - Index​

curl -H "Authorization: Bearer $PACT_BROKER_TOKEN" $PACT_BROKER_BASE_URL \
| jq '._links."pb:pacticipant-branch"'

Pact CLI​

pact-broker delete-branch \
--pacticipant "$APPLICATION_NAME" \
--branch "$BRANCH" \
--no-error-when-not-found

Note:

The Pact CLI is PACT_BROKER_* environment variable aware, so if you have your Basic Auth PACT_BROKER_USERNAME/PACT_BROKER_PASSWORD, or Bearer Auth PACT_BROKER_TOKEN environment variables set, the CLI will pick them up.

In our example above, PACT_BROKER_BASE_URL is set in our shell prior to executing.

You can explicitly set those values with

-b, --broker-base-url=BROKER_BASE_URL
# The base URL of the Pact Broker
-u, [--broker-username=BROKER_USERNAME]
# Pact Broker basic auth username
-p, [--broker-password=BROKER_PASSWORD]
# Pact Broker basic auth password
-k, [--broker-token=BROKER_TOKEN]
# Pact Broker bearer token

Example​

GitHub Actions​

name: Delete application branch in a Pact Broker

on:
delete:
branches:
- "*"

jobs:
delete-branch-in-pact-broker:
name: delete
runs-on: ubuntu-latest

steps:
- name: Install Pact CLI
run: |
curl -fsSL https://raw.githubusercontent.com/pact-foundation/pact-ruby-standalone/master/install.sh | sh
echo "PATH=${PATH}:${PWD}/pact/bin/" >>$GITHUB_ENV

- name: Delete branch
run: |
pact-broker delete-branch \
--pacticipant "$APPLICATION_NAME" \
--branch "${{ github.event.ref }}" \
--no-error-when-not-found
env:
PACT_BROKER_BASE_URL: "https://your-broker-url"
PACT_BROKER_USERNAME: ${{ secrets.PACT_BROKER_USERNAME }}
PACT_BROKER_PASSWORD: ${{ secrets.PACT_BROKER_PASSWORD }}
APPLICATION_NAME: 'example-consumer'

Go forth and delete all the things!