Hi there! My team set up Pact a few months ago but...
# general
l
Hi there! My team set up Pact a few months ago but could use some clarity / guidance on our setup (which we have likely not configured quite right). My team's service is a lambda function that is the consumer of an SQS queue that is written to by a Ruby gem, which is called by another microservice. The Ruby gem is not just a passthrough service, as it takes some of the parameters of the provider's request and puts them into the body of the SQS message while it attaches some of the others as messageAttributes to the SQS message. We initially set up message Pact tests between the Ruby gem and our consumer, since it is the gem that creates and sends the payload that we need to confirm matches with our consumer microservice’s message handler code. We realized though that this does nothing to guarantee that the greater flow between our provider microservice and our consumer microservice (the flow which we really do want to safeguard in production using pact) is actually unbroken. Our team owns the consumer microservice and the client gem and we make sure that any changes that go live on the consumer microservice are immediately supported by an update to the Ruby gem to match. However, the provider microservice is in control of upgrading the Ruby gem to newer versions and if it is using an old version of the gem, the message put onto the queue by that old version of the client gem will fail to be processed by the new, live version of the consumer microservice. We are trying to reason about what makes the most sense for us given our architecture here. Is there a very different way we should be setting up our Pact integration to meet our contract testing goal of ensuring that the provider and consumer microservices (via the Ruby gem) are always in sync with each other in production? Thank you so much for your time!
👋 1
y
Hi @Laura Walsh, so sorry this has missed my radar! This sounds like a really interesting use case. One of co-founders, @Beth (pactflow.io/Pact Broker/pact-ruby) is a Ruby 🧙‍♀️. Also top marks for the diagram and really well structured and laid out question. Shining example of how to ask a great question in a community setting 👌 A great question, deserves a great reply, but it's super late here, so I will wrap my head around this over the weekend and get back to you.
thank you 1
Hey @Laura Walsh, have you seen this post out of interest? https://pactflow.io/blog/should-i-write-contract-tests-for-client-sdks/ Matt pointed me to it when I asked about using SDK's. I think it seems correct that you have a pact between the client gem and consumer microservice. Do you have anything between your provider microservice and the client gem to tie the versions up? do you call can-i-deploy when deploying the provider microservice? you could call it asking if you could deploy between the gem and the consumer, providing the version of the pact relating to the gem, that is going to be used in the provider microservice build you wish to deploy
Would love to see a sample demo app, and this sounds like a super cool showcase, and I would be happy to help on it