https://pact.io logo
#pact-net
Title
# pact-net
m

Michael Fagan

03/10/2022, 10:52 PM
Interested to know if anyone here is using pact to test azure function apps? I've created an example, maybe an opportunity to compare notes?
a

Akke Luukkonen

03/11/2022, 8:06 AM
I'm testing a case where the provider is a Function App, but haven't yet had a consumer as one. Although, I'd guess the consumer would be easier in general since you can just create the contracts with Pact .NET? 🤔 My main problems so far with contract testing Function Apps have been the Durable instances (Functions & Entities). In my provider state setup I always try to cleanup all of the existing Durable instances and Azure SDK might randomly throw StorageExceptions for unknown reasons when attempting to perform `PurgeInstanceHistoryAsync`:
I haven't yet reported this to Azure since this occurs fairly infrequently and I have no idea what's causing it exactly in order to reproduce it reliably. It suddenly started occurring as part of a pull request where we added one Service Bus connection and a couple additional Event Grid Triggers to the Function App which in my eyes had no relevance in any way to this actual issue 🤷‍♂️
m

Michael Fagan

03/13/2022, 2:36 AM
Interesting @Akke Luukkonen. We're testing with a function app provider and a consumer (android java) The provider function app has provider state from another function app which we fake with a dot net core mvc api controller. Are you starting your function app with: Func start?
m

Matt (pactflow.io / pact-js / pact-go)

03/14/2022, 2:44 AM
Is it possible to run these functions locally without actually running on Azure itself? With AWS for example that have SAM and serverless framework, both of which have options to run locally/offline. This is how I typically do it
Are these for serving web applications (i.e. HTTP) or running as async functions?
a

Akke Luukkonen

03/14/2022, 7:12 AM
Are you starting your function app with:
Func start?
Technically yes if I'm developing locally, but our CI performs a test deployment. Not all of the resource types have local emulators (e.g. Service Bus) so you need to deploy at least some of them for the pipeline agents to be able to run tests. So I figured that I might as well then do a full deployment for testing. Also, Azurite (Storage Account emulator) had a bug until the recent release that you couldn't even purge Durable instances at all (related to this GH issue if I remember correctly).
Are these for serving web applications (i.e. HTTP) or running as async functions?
Not directly serving the site itself, but working as the backend for me. Both synchronous requests, e.g. typical resource CRUD stuff, and long-running asynchronous actions which are related to the concept of these Durable Functions in Azure.
👍 1
m

Michael Fagan

03/14/2022, 7:24 AM
You can start locally and verify the contract although we haven't run into @Akke Luukkonen ‘s problem yet. Sucks that you need to do a full deployment, I for sure would like to avoid that.
👍 1