Skip to main content

Pact Open Source Update β€” Mar 2024

Β· 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