https://pact.io logo
Join Slack
Powered by
# pact-net
  • g

    GitHub

    02/17/2025, 1:41 PM
    #532 ci: add ubuntu-24.04-arm runner Pull request opened by YOU54F arm64 linux runners now available in GHA see tracking issue - pact-foundation/roadmap#19 (comment) This PR adds coverage for linux arm64 (glibc) platforms in our CI pact-foundation/pact-net
    • 1
    • 1
  • g

    GitHub

    02/18/2025, 5:49 AM
    #533 Raw XML POST not working in V2, V3 and V4. Added test for simple POST interaction with different content types. Pull request opened by vcalatayud Added a test to ensure that POST works with different types of content. XML is failing with V2, V3 and V4. pact-foundation/pact-net
  • g

    GitHub

    02/19/2025, 7:49 PM
    1 new commit pushed to
    <https://github.com/pact-foundation/pact-net?email_source&#x3D;slack/tree/master|master>
    by adamrodger
    <https://github.com/pact-foundation/pact-net/commit/dad397c65c40a7e3d5e665d15d7fec8548858541|dad397c6>
    - ci: add ubuntu-24.04-arm runner pact-foundation/pact-net
  • f

    Fabian Noll

    02/20/2025, 8:01 AM
    Hello together, I am currently implementing contract tests for our product. And i have a little bit problem with the documenation. In the Contract we get Matching types like:
    Copy code
    "$.spriteUrl": {
                "combine": "AND",
                "matchers": [
                  {
                    "match": "type"
                  }
                ]
              },
    And if i look at the combine attribute i see the AND. Is there also a way to create OR combinations. The Background is that i want to check if this spriteUrl includes either .jpg or .png at the end and i wanted to know if its more best practice to just use the regex or if there is a way to combine two includes.
  • m

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

    02/20/2025, 8:27 AM
    Just use a regex
  • m

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

    02/20/2025, 8:27 AM
    We don't actually support logical OR (see howtooptional for more)
  • s

    Slackbot

    02/20/2025, 8:27 AM
    https://docs.pact.io/faq#why-is-there-no-support-for-specifying-optional-attributes
  • d

    Dominik Krichbaum

    02/26/2025, 2:22 PM
    @Dominik Krichbaum has left the channel
  • b

    boden winkel

    03/06/2025, 3:10 PM
    Good Morning/Evening all 🙂 We using Bi-Directional approach with testing .net api. One of our .net API serves as a provider, the provider contract itself is a OpenAPI file produced on each build, however... The problem which im struggling now is that our Api is in version V1 and in V2. So do OpenAPI file producing two files one with V1 endpoints spec and second with V2 spec. How to tackle now consumer tests and how to upload actually both files to Pactflow broker ? OR maybe we should use different approach to that.
  • m

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

    03/07/2025, 2:56 AM
    You have two options 1. Join the V1 and V2 versions of the OAS together a. This only works if they are versioned in a way that means they don’t collide. e.g. all urls have base paths like
    /v1/
    or
    /v2
    or you use content negotiation or something 2. Release the new provider under a new name a. e.g.
    provider-v1
    and
    provider-v2
    b
    • 2
    • 1
  • d

    Daniele Del Piano

    03/14/2025, 4:47 PM
    Is there an example to use the provider Middleware with test containers?
  • m

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

    03/14/2025, 9:33 PM
    I'm not aware of any official examples with that combo. What does the introduction of test containers change?
  • d

    Daniele Del Piano

    03/15/2025, 7:34 AM
    Automation and an isolated testing environment
  • m

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

    03/15/2025, 7:56 AM
    I understand what they are, sorry, but I'm wondering what additional information you'd need in our examples to make it work that you couldn't extrapolate on your own? Or put another way, we can't create examples with all combinations of frameworks and tools so we try and highlight the relevant points for users to integrate as needed into their tools. If we could improve that of course we would like to help
  • d

    Daniele Del Piano

    03/15/2025, 9:04 AM
    Well, I've not pretended any of the above. I just simply asked if there is an example? There is not.... That's it. Obviously the question was not restricted to pact Devs but also to everyone that works with it and may have implemented it in this way. I feel like every time I ask about pact features there is a kind of self defense answer.
    m
    y
    • 3
    • 5
  • g

    GitHub

    03/22/2025, 3:25 PM
    1 new commit pushed to
    <https://github.com/pact-foundation/pact-net/tree/master|master>
    by adamrodger
    <https://github.com/pact-foundation/pact-net/commit/c72173242045c5d9d4459d10a2831256c0529164|c7217324>
    - chore(ffi): Upgrade to FFI 0.4.27 pact-foundation/pact-net
  • g

    GitHub

    03/22/2025, 3:29 PM
    1 new commit pushed to
    <https://github.com/pact-foundation/pact-net/tree/master|master>
    by adamrodger
    <https://github.com/pact-foundation/pact-net/commit/8661b21112b6b9e56ba31315d027b5b69602b08c|8661b211>
    - chore(deps): Upgrade to System.Text.Json 8.0.5 pact-foundation/pact-net
  • g

    GitHub

    03/22/2025, 4:00 PM
    1 new commit pushed to
    <https://github.com/pact-foundation/pact-net/tree/master|master>
    by adamrodger
    <https://github.com/pact-foundation/pact-net/commit/171c82c2da0f000d424fd94a1ccd4fe910955d0e|171c82c2>
    - fix(ci): Reinstate triggering releases on pushed tags pact-foundation/pact-net
  • g

    GitHub

    03/22/2025, 4:04 PM
    Release - 5.0.1 New release published by github-actions[bot] pact-foundation/pact-net
  • g

    GitHub

    03/23/2025, 4:44 PM
    #516 Deadlock issue while running test Issue created by HuiSou Previous issues Have you searched the issue tracker to ensure this hasn't been discussed before? • Yes https://github.com/pact-foundation/pact-net/issues?q=is%3Aissue+hangs https://github.com/pact-foundation/pact-net/issues?q=is%3Aissue+freeze https://github.com/pact-foundation/pact-net/issues?q=is%3Aissue+deadlock Version information: • OS: Ubuntu 22 • PactNet Version: 4.5.0 • .Net Version: 8.0.108 • Pact Broker Version (if applicable): N/A Describe the bug I create a pact builder with multiple interaction and try to invoke the call via WebApplicationFactory in my API integration test, and some of my test run are getting stucked and here's the problem I discovered during --blame [image](https://private-user-images.githubusercontent.com/8407412/363959327-47af8349-c615-4023-aa5e-7a04138c7c38.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDI3NDg1ODksIm5iZiI6MTc0Mjc0ODI4OSwicGF0aCI6Ii84NDA3NDEyLzM2Mzk1OTMyNy00N2FmODM0OS1jNjE1LTQwMjMtYWE1ZS03YTA0MTM4YzdjMzgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDMyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAzMjNUMTY0NDQ5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZjBmYzU1OGY4MTQzMzY5NzI4NTFhMTU3MmM0MmYwZDE5NzNlY2NkODNkMGU1MTZjOGQ4NTlmN2M5Yjk3NDhjOCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.Vk_nBQm4I3yASHrtPzK9CYHBFA49PfCbEubEvFx2-VE) *notice the duplicate call of PactNet.Interop.NativeInterop.CleanupMockServer(Int32), this might cause pact_ffi mutex lock each other Steps To Reproduce • Create PACT builder with 15 interaction • Create webServer via WebApplicationFactory and change the congfiguration to mockServercontext • run api test to get information until it failed, for instance
    Copy code
    while true; do dotnet test  MyApp.Integrationtest --blame-hang  --blame-hang-timeout 10000 ; sleep 1; done
    • once the test hangs, use dotnet-dump to analyze issue Expected behavior A clear and concise description of what you expected to happen. • test should not hangs Log Output Applicable log output. Please ensure you remove any sensitive information.
    Copy code
    00007F04EACEB710 00007f468de3488d [InlinedCallFrame: 00007f04eaceb710] PactNet.Interop.NativeInterop.CleanupMockServer(Int32)
    00007F04EACEB710 00007f46199bc919 [InlinedCallFrame: 00007f04eaceb710] PactNet.Interop.NativeInterop.CleanupMockServer(Int32)
    00007F04EACEB700 00007F46199BC919 ILStubClass.IL_STUB_PInvoke(Int32)
    00007F04EACEB790 00007F46199BC88A PactNet.Drivers.MockServerDriver.ReleaseUnmanagedResources()
    00007F04EACEB7B0 00007F46199BC848 PactNet.Drivers.MockServerDriver.Dispose()
    00007F04EACEB7D0 00007F4613B9D36C PactNet.PactBuilder+<VerifyAsync>d__9.MoveNext()
    00007F04EACEB7F0 00007F4613B9D2D5 PactNet.PactBuilder+<VerifyAsync>d__9.MoveNext()
    00007F04EACEB850 00007F461997BF01 System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib],[PactNet.PactBuilder+<VerifyAsync>d__9, PactNet]].ExecutionContextCallback(System.Object)
    00007F04EACEB870 00007F4613878091 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
    00007F04EACEB8C0 00007F461997BDB4 System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib],[PactNet.PactBuilder+<VerifyAsync>d__9, PactNet]].MoveNext(System.Threading.Thread)
    00007F04EACEB910 00007F461997BCAA System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib],[PactNet.PactBuilder+<VerifyAsync>d__9, PactNet]].MoveNext()
    00007F04EACEB930 00007F4613BA9B09 Xunit.Sdk.AsyncTestSyncContext+<>c__DisplayClass7_0.<Post>b__0() [/_/src/xunit.execution/Sdk/AsyncTestSyncContext.cs @ 58]
    00007F04EACEB970 00007F4612014FF3 Xunit.Sdk.XunitWorkerThread+<>c.<QueueUserWorkItem>b__5_0(System.Object) [/_/src/common/XunitWorkerThread.cs @ 37]
    00007F04EACEB9B0 00007F4613878091 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
    00007F04EACEBA00 00007F460E817994 System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
    00007F04EACEBC50 00007f468da26413 [DebuggerU2MCatchHandlerFrame: 00007f04eacebc50]
    Additional context Add any other context about the problem here. pact-foundation/pact-net
    • 1
    • 1
  • g

    GitHub

    03/23/2025, 7:06 PM
    1 new commit pushed to
    <https://github.com/pact-foundation/pact-net/tree/master|master>
    by adamrodger
    <https://github.com/pact-foundation/pact-net/commit/b3c2fe14a513a886dab165721b156526765690fa|b3c2fe14>
    - chore: Delete some old unused tests pact-foundation/pact-net
  • g

    GitHub

    03/27/2025, 1:35 PM
    #534 RFC: Throw explicit timeout errors on verification Issue created by isaac-r ## Issue When running the verifier if the verify method times out there is nothing in the logs to explain the issue is timeout rather than a failing pact verification. ## Solution Add explicit timeout messaging in the
    Execute
    method of
    pact-net\src\PactNet\Verifier\InteropVerifierProvider.cs
    by passing down the
    timeout
    Timespan from
    pact-net\src\PactNet\Verifier\PactVerifierSource.cs
    . Wrapping the result in a try-catch, the explicit timeout exception can be caught and thrown back up. ## Further work I have encountered further issues with no explanations in the errors dure to the limited feedback from the pact-core errors. It would be useful to log config/set up errors with the pact server and return status codes when running the mock server if requests fail or if the application stop unexpectedly. ## Alternatives This could be done in pact-core and updated with additional errors for connection issues to the mock server pact-foundation/pact-net
  • i

    Isaac Richardson

    03/28/2025, 9:41 AM
    Hi, I'm trying to run my app using minimal api in .NET 9 but I'm running into an issue when using a process to run the app. I am following on advice given in this answer: https://stackoverflow.com/a/77231959/18482058 but I am unable to get my application to keep running within the process (see the discussion under the answer)
    i
    • 2
    • 2
  • m

    Mayamiko K

    03/28/2025, 11:24 AM
    Hi all, We’re looking to implement message-based contract tests for Azure Service Bus messages. The consumer expects certain headers to be included with the messages. Is there a way to specify headers when to be included in the pact? I’ve come across the .WithMetadata method, but I’m not sure if that’s the appropriate approach for setting headers. Thanks!
    m
    • 2
    • 1
  • g

    GitHub

    03/28/2025, 11:33 AM
    #535 Test Host Process Crashes After 5.0.1 Upgrade Issue created by adamrodger Version information: • OS: Linux x64 • PactNet Version: 5.0.1 • .Net Version: 9.0 Describe the bug After the upgrade from PactNet 5.0.0 to 5.0.1, I get an error when running provider tests inside a .Net Docker container:
    Copy code
    The active test run was aborted. Reason: Test host process crashed
    
    Test Run Aborted.
           _VSTestConsole:
             MSB4181: The "VSTestTask" task returned false but did not log an error.
         1>Done Building Project "/app/tests/MyProject.Pacts/MyProject.Pacts.csproj" (VSTest target(s)) -- FAILED.
    
    Build FAILED.
        0 Warning(s)
        0 Error(s)
    
    Time Elapsed 00:00:03.52
    Process exited with code 1
    Test ignored: MyProject.ProviderTests.VerifyPacts, ignore reason: Interrupted by build execution timeout
    Consumer tests work absolutely fine, it's only provider tests that crash. Steps To Reproduce Unsure currently - it was working fine before the upgrade Additional context The diff between 5.0.0 and 5.0.1 only really has an FFI upgrade in it, so I'm assuming the issue is there and that it's crashing the provider tests. pact-foundation/pact-net
  • e

    Erich Zimmerman

    04/01/2025, 9:35 PM
    @Erich Zimmerman has left the channel
  • j

    Jordi March

    04/09/2025, 12:52 PM
    Hi! We are working on the implementation of PACT in some API projects. We have the following case: One of the endpoints returns an array, and the problem we encountered during provider validation was that the order defined in the contract was different from the one returned by the API. For now, we have resolved it by sorting the array in the contract to match what the provider returns. However, our question is if there is any other way to do this and what best practices we can apply in this case. Thanks!
    i
    • 2
    • 4
  • g

    GitHub

    04/22/2025, 1:46 PM
    #538 Messaging pacts - guidelines to provide real message to verifier Issue created by scrocquesel-ml150 I'm working on implementing the messaging verifier. In my case, the provider sends messages to an Azure Service Bus in response to certain interactions. I want to verify that these messages conform to the consumer pact. Looking at the examples, it seems that messages are manually constructed in the tests. #459 call them canned message. IMHO, this introduces a risk of divergence between the actual messages sent by the application and the ones defined in the test. What I’ve done instead is configure the provider to send messages to a Service Bus Testcontainer during integration tests. A MessageProcessor dequeues the messages and transforms them into Pact scenarios. Once all integration tests have passed, I use the collected scenarios with the message pact verifier. What do you think of this approach? pact-foundation/pact-net
    • 1
    • 1
  • g

    GitHub

    04/24/2025, 7:28 AM
    #539 Request/Response and messaging in same service; how do we filter? Issue created by robbiewareham I am using PactNet 5.0.1 and I have a service that provides the following: • POST request is made to my service which results in a message being written to a 3rd party queue. I now have two pact files hosted in PactBroker; one generated by the consumer of the POST endpoint, the other generated by the process that reads the messages from the queue. I've implemented the verification by having 2 classes, each with one Xunit test. One class uses
    MessagingProvider
    and is configured to download from a pact broker:
    Copy code
    using var verifier = new PactVerifier(config);
       
     verifier.MessagingProvider("personal-details-api", CreateJsonSettings())
             .WithProviderMessages(scenarios =>
             {
                 scenarios.Add("An event is created", _event);
             })
             .WithPactBrokerSource(_pactBrokerUri)
             .Verify();
     }
    I was hoping/assuming that this would only download the messaging pact from pact broker but it is also downloading the request/response pact too so fails as it only expects messages. The "provider" name in Pact Broker is the same (which makes sense to me as the provider is the same), but do I have to have unique provider names? pact-foundation/pact-net
    • 1
    • 1
  • g

    GitHub

    05/06/2025, 5:08 PM
    #540 How to authenticate to the Provider target endpoint ? Issue created by rpbs Version information: • PactNet Version: 5.0.1 • .Net Version: 8 Describe the bug Not a bug but I'm not being able to pass Authorization with a Bearer to the header of the Pact Uri Steps To Reproduce I have a pact verifier, I need to be able to authenticate to the Provider Uri.
    httpVerifier.WithHttpEndpoint(providerUri)
    Then I'm calling
    Verify()
    method Log Output I'm getting 401 Could you guys help me to understand what I'm missing ? pact-foundation/pact-net