https://pact.io logo
Join Slack
Powered by
# pact-go
  • y

    Yunzhao Xu

    12/08/2024, 1:00 PM
    Hello everyone! I have a Kafka message communication that needs to be verified. I'm implementing this function according to [https://docs.pact.io/implementation_guides/go/docs/messages](https://docs.pact.io/implementation_guides/go/docs/messages). However, for the provider part of the sample code, types such as
    MessageVerifier
    and
    ProviderStateV3Response
    cannot be found. Is there a problem with the document or my usage? Where should I look for a suitable example?
    m
    • 2
    • 3
  • p

    Pietro Di Bello

    12/17/2024, 11:22 AM
    @Pietro Di Bello has left the channel
  • k

    Kevser

    01/06/2025, 3:39 PM
    Hello everyone, I'm encountering an issue with our Pact consumer tests using pact-go v2.0.1 and go 1.21.13. When sending the request, we're using Body(contentType, content), where contentType is generated by the FormDataContentType() method from multipart.Writer. Here’s how the interaction is defined:
    Copy code
    WithRequest(http.MethodPost, url, func(b *consumer.V4RequestBuilder) {
    	b.Body(contentType, content)
    }).
    Error:
    Copy code
    Mismatch with header 'Content-Type': Expected header 'Content-Type' to have value 'multipart/form-data;boundary=a76648f32eda23feef43a81954d35cbd782294c16f488baef7acbda53e32' but was 'multipart/form-data; boundary=325ce599ed0e830d149d04fa6be3c58835aa1bb7f8d31cb22d2514534999'
    is there a way to use the Body method without specifying a contentType to avoid boundary mismatches? Thanks.
    m
    r
    j
    • 4
    • 51
  • k

    Kevser

    01/15/2025, 2:50 PM
    Hello everyone again 🙂 I'm trying to send a file and include taskId as form data in the same request. The file is being sent successfully, but the taskId is missing from the contract. How can I properly include both the file and taskId in the request body? Thanks.
    Copy code
    err = mockProvider.
    		AddInteraction().
    		Given("a valid send log").
    		WithRequestPathMatcher(http.MethodPost, matchers.S(url), func(b *consumer.V4RequestBuilder) {
    			b.
    				Header("Content-Type", matchers.Like(contentType)).
    				MultipartBody(contentType, PactTaskID, "taskId").
    				MultipartBody("application/zip", zipFile, "file")
    		}).
    m
    • 2
    • 6
  • g

    GitHub

    01/21/2025, 11:03 AM
    Release - v2.0.9 New release published by YOU54F What's Changed • build(deps): bump google.golang.org/protobuf from 1.34.2 to 1.35.1 by @dependabot in #459 • build(deps): bump google.golang.org/grpc from 1.66.0 to 1.67.1 by @dependabot in #460 • fix: ensure sync messages write metadata to both req & res by @YOU54F in #461 • build(deps): bump google.golang.org/protobuf from 1.35.1 to 1.35.2 by @dependabot in #463 • chore(ci): upgrade macos-12 to macos-13 by @JP-Ellis in #468 • docs: pact-go supported platforms by @YOU54F in #466 • chore(ci): prevent duplicate ci triggers by @JP-Ellis in #476 • chore: Configure Renovate by @renovate in #467 • fix(deps): update module github.com/spf13/afero to v1.12.0 by @renovate in #483 • fix(deps): update module github.com/linkedin/goavro/v2 to v2.13.1 by @renovate in #482 • fix(deps): update module google.golang.org/protobuf to v1.36.3 by @renovate in #486 • fix(deps): update module github.com/stretchr/testify to v1.10.0 by @renovate in #487 • Improving Provider VerifyRequest - ProviderBaseURL documentation. by @marcusvnac in #464 • fix(deps): update module gopkg.in/yaml.v2 to v3 by @renovate in #489 • Deps/go mod tidy by @YOU54F in #492 New Contributors • @JP-Ellis made their first contribution in #468 • @renovate made their first contribution in #467 • @marcusvnac made their first contribution in #464 Full Changelog: v2.0.8...v2.0.9 pact-foundation/pact-go
    y
    • 2
    • 2
  • g

    GitHub

    01/21/2025, 11:54 AM
    Release - v2.0.10 New release published by YOU54F What's Changed • fix: update pact-ffi to v0.4.26 by @YOU54F in #493 Full Changelog: v2.0.9...v2.0.10 pact-foundation/pact-go
  • g

    GitHub

    01/21/2025, 12:06 PM
    Release - v2.0.10 New release published by YOU54F What's Changed • fix: update pact-ffi to v0.4.26 by @YOU54F in #493 Full Changelog: v2.0.9...v2.0.10 pact-foundation/pact-go
  • g

    GitHub

    01/21/2025, 4:00 PM
    Release - v2.1.0 New release published by YOU54F What's Changed • fix(deps): update module google.golang.org/grpc to v1.69.4 by @renovate in #488 Breaking Change • chore(deps)!: require minimum go version 1.22 by @YOU54F in #490 Full Changelog: v2.0.10...v2.1.0 pact-foundation/pact-go
  • r

    Rishav Singh

    01/22/2025, 10:07 AM
    hey team!, we are trying to write contracts tests using pact-go and we are getting this failure in our pipeline
    Copy code
    /usr/bin/ld: cannot find -lpact_ffi: No such file or directory
    collect2: error: ld returned 1 exit status
    can you please help to fix this ?
    m
    s
    • 3
    • 22
  • t

    Tom Lopez

    01/22/2025, 4:04 PM
    @Tom Lopez has left the channel
  • g

    GitHub

    01/23/2025, 3:07 PM
    Release - v2.2.0 New release published by YOU54F What's Changed • feat: support linux musl by @YOU54F in #454 Full Changelog: v2.1.0...v2.2.0 pact-foundation/pact-go
  • s

    Sudhir Meena

    01/28/2025, 11:19 AM
    Hey Team, I have an another question. I am writing contract testing following this example contract test file :- https://github.com/pact-foundation/pact-go/blob/master/examples/basic_test.go But when I am adding one another test case in the same code, Interactions are not getting merged in same pact file. I guess interactions should be merged as it is an array of interactions in pact output.
  • m

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

    01/28/2025, 11:40 AM
    Do they have unique interaction descriptions?
  • s

    Sudhir Meena

    01/28/2025, 12:28 PM
    Yes
  • m

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

    01/28/2025, 12:33 PM
    Set logs to debug and have a see if anything jumps out about writing interactions
  • m

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

    01/28/2025, 12:34 PM
    Feel free to share code examples also
    s
    • 2
    • 1
  • d

    Dominic Plourde

    01/30/2025, 7:48 PM
    Hello, I already posted my question in #C9VPNUJR2, but I feel it may be related to pact-go, we get a strange error when using certain selector:
    Copy code
    pact_verifier: Failed to load pact - Failed to load pact from '<https://pact-broker.spatium-iot.com>': Error with the content of a HAL resource - Expected either a "*" or path identifier in path expression "$.query.$" at index 8
    when we use one of those selector: • DeployedOrReleased • Environment • Deployed We tried a lot of possibilities, but only “Latest: true” works. since we have multiple environments, we also want DeployedOrReleased, which was working until recently
    m
    • 2
    • 13
  • r

    Romain Létendart

    01/31/2025, 4:56 PM
    @Romain Létendart has left the channel
  • f

    Fabian Noll

    02/03/2025, 6:00 AM
    Hello together, i am doing some Pact Messaging Tests and just saw in the pactBroker that it says the pacts are verified by pact-rust. Is this normal or a overlook of the implementation?
    Copy code
    {
      "providerName": "MQTTProducer",
      "providerApplicationVersion": "1.0.0",
      "success": true,
      "verificationDate": "2025-02-03T05:54:37+00:00",
      "testResults": [
        {
          "interactionId": "4502629169ea07b9fd7c9fd70c772553a1b4407d",
          "success": true
        }
      ],
      "verifiedBy": {
        "implementation": "Pact-Rust",
        "version": "1.2.5"
      },
      "_links": {
        "self": {
          "title": "Verification result",
          "name": "Verification result 201 for Pact between MQTTConsumer (1.0.1) and MQTTProducer",
          "href": "<http://localhost:9292/pacts/provider/MQTTProducer/consumer/MQTTConsumer/pact-version/cd421621766dde56e9e01a0c8a8b47c4b5f63b40/verification-results/201>"
        },
        "pb:pact-version": {
          "title": "Pact",
          "name": "Pact between MQTTConsumer (1.0.1) and MQTTProducer",
          "href": "<http://localhost:9292/pacts/provider/MQTTProducer/consumer/MQTTConsumer/pact-version/cd421621766dde56e9e01a0c8a8b47c4b5f63b40/metadata/Y3ZuPTEuMC4x>"
        },
        "pb:triggered-webhooks": {
          "title": "Webhooks triggered by the publication of this verification result",
          "href": "<http://localhost:9292/pacts/provider/MQTTProducer/consumer/MQTTConsumer/pact-version/cd421621766dde56e9e01a0c8a8b47c4b5f63b40/verification-results/201/triggered-webhooks>"
        }
      }
    }
    m
    • 2
    • 4
  • d

    Devin Woods

    02/05/2025, 8:58 PM
    When trying to run provider pact tests, getting this error:
    Copy code
    Undefined symbols for architecture arm64:
      "_pactffi_with_metadata", referenced from:
          __cgo_b3f3fec7e6e1_Cfunc_pactffi_with_metadata in 000003.o
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    Anyone ever see this before?
    m
    e
    • 3
    • 9
  • s

    Spencer

    02/11/2025, 3:34 PM
    @Spencer has left the channel
  • g

    GitHub

    03/06/2025, 7:15 PM
    Release - v2.3.0 New release published by mefellows ## Changelog • bd5ea1c chore(release): release v2.3.0 • e6e2c11 feat: add metadata.pact-go.version to pact file • 1e4ecc7 fix(deps): update module github.com/spf13/cobra to v1.9.1 (#502) • e05acfd fix(deps): update module google.golang.org/grpc to v1.70.0 (#495) • 6c40e0b fix(deps): update module google.golang.org/protobuf to v1.36.5 (#496) • 8d700cc fix: strip v prefix from pact-go verifier version pact-foundation/pact-go
  • d

    David Gibson

    03/07/2025, 10:52 AM
    Is there a pact-mock-server that supports the latest version of PACT?
    y
    • 2
    • 16
  • d

    David Gibson

    03/07/2025, 10:54 AM
    Im currently using https://github.com/pact-foundation/pact-mock_service for a consumer test which I can write out a PACT contract, but we I verify the contract I am getting an error stating that 'type' attribute is missing, so I suspect the pact-mock-service is runnign an older version of PACT
  • m

    Martin Mineo

    03/07/2025, 1:16 PM
    @Martin Mineo has left the channel
  • g

    GitHub

    03/24/2025, 1:04 AM
    Release - v2.4.0 New release published by mefellows ## Changelog • 9e92fc2 chore(deps)!: require minimum go version 1.23 • 6ba0381 chore(release): release v2.4.0 • ada7782 fix(deps): update module google.golang.org/grpc to v1.71.0 pact-foundation/pact-go
  • g

    GitHub

    03/24/2025, 1:34 AM
    Release - v2.4.1 New release published by mefellows ## Changelog • 9e92fc2 chore(deps)!: require minimum go version 1.23 • 2f21a81 chore(release): release v2.4.0 • 0f6597b chore(release): release v2.4.1 • ada7782 fix(deps): update module google.golang.org/grpc to v1.71.0 • eba6b2c fix: update pact-ffi to 0.4.27 (#509) pact-foundation/pact-go
  • s

    Srinivas Nali

    04/01/2025, 3:04 PM
    Hi Guys, Is anyone facing issues with Pact-Go compatibility on Go 1.22? Running:
    Copy code
    go install <http://github.com/pact-foundation/pact-go/v2@latest|github.com/pact-foundation/pact-go/v2@latest>
    fails, but if I remove
    @latest
    , it works fine. Would it be possible to document Go version compatibility in the README? That would be really helpful. Thanks
    m
    y
    • 3
    • 4
  • e

    Erich Zimmerman

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

    Yevhen Nosulko

    05/02/2025, 9:45 AM
    hello lovely people. I am having a problem with pact-go Provider verification test where it cannot read the provider states from a contract json generated by pact-jvm. There is a mismatch in how the contract JSON is generated by pact-jvm and pact-go. Let me explain a bit more. We have a Consumer test written in Java with pact-jvm, snippet below:
    Copy code
    @Pact(provider = PROVIDER, consumer = CONSUMER)
        public RequestResponsePact operationalHealth(PactDslWithProvider builder) {
            return builder
                .given("IFE functionalHealth is Operational")
                .uponReceiving("A request for IFE availability status Operational")
    ...
    ...
    ...
    this will generate a contract where provider state is defined as an Array of Strings:
    Copy code
    "interactions": [
        {
          "description": "A request for IFE availability status Operational",
          "providerStates": [
            {
              "name": "IFE functionalHealth is Operational"
            }
          ],
    on the provider side we have a Provider test written in Golang with pact-go, snippet as follows:
    Copy code
    StateHandlers: models.StateHandlers{
    			"IFE functionalHealth is Operational": func(setup bool, ps models.ProviderState) (models.ProviderStateResponse, error) {
    ...
    ...
    ...
    and the problem is when I run this test it doesn't seem to read the provider states at all because when I tried to pusposely break it it was still passing. I went ahead and created a similar consumer test in Golang, like this:
    Copy code
    mockProvider.
    		AddInteraction().
    		Given("IFE functionalHealth is Operational").
    		UponReceiving("A request for IFE availability status Operational").
    ...
    ...
    ...
    ...
    after running this test I got the contract JSON where provider state is defined as String:
    Copy code
    "interactions": [
        {
          "description": "A request for IFE availability status Operational",
          "providerState": "IFE functionalHealth is Operational",
    this contract is then consumed and parsed correctly by provider test because when I try to break it I see a corresponding provider state failing. Are you guys aware of similar issues? If so how do I go about addressing it? Thank you in advance.
    m
    y
    • 3
    • 17