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

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

    03/03/2022, 10:55 AM
    So, something like this:
    Copy code
    Tags         []string `json:"tags" pact:"example="Name::CustomerName"
    a
    • 2
    • 2
  • w

    win

    03/04/2022, 3:52 PM
    been looking at this https://docs.pact.io/slack/pact-go.html#1531267542.000155 as i have ran into the error where i get
    No pacts found to verify
    . This fails my test, what could be the cause
    m
    • 2
    • 4
  • a

    Ancy Aziz

    03/09/2022, 3:51 AM
    I have a response body with contents like below, is there a way to match the values in Header using dsl.Match and just validate the type of the fields inside Body part using dsl.Like in pact.AddInteraction WillRespondWith section?
    Copy code
    [
        {
            "Body": {
                 "environments": [
                                   {
                                        "createdDate": "2020-05-20",
                                        "id": "abc",
                                        "name": "abc",
                                        "state": "YES",
                                        "tags": [],
                                        "status": false
                                    }
                                ],
                   "nPageKey": "aabbgggcc==",
                   "pageSize": 1,
                   "totalCount": 1
                  },
            "Header": {
                   "ResponseCode": 200,
                   "Region": "xyz"
             }
         }
     ]
    m
    • 2
    • 6
  • t

    Thomas K

    03/09/2022, 8:54 AM
    Hi has anyone got pact go v3 beta working on M1 Mac / arm64 architecture?
    👍 1
    j
    • 2
    • 1
  • m

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

    03/09/2022, 9:31 AM
    I'm told Rosetta mode also doesn't work, but have yet to verify for the same reasons as above
    t
    • 2
    • 3
  • j

    Jeroen van Dijk

    03/16/2022, 12:25 PM
    hello 🙂 with Pact Go v2, is there a way to set the Provider Log Directory? In v1 it was:
    m
    • 2
    • 5
  • m

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

    03/19/2022, 5:08 AM
    I'm not sure I understand sorry, you can definitely test the body shape in that JSON you shared. This looks like it's failing the verification though, which would indicate the request is not eliciting the response shape you're after.. Can you please share the req/res details your expecting, the consumer pact test and the provider verification output?
    a
    • 2
    • 3
  • m

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

    03/28/2022, 12:47 PM
    (unless you mean https://github.com/pact-foundation/pact-go/blob/master/dsl/verify_mesage_request.go, in which case, you’re right, it needs to be added)
    j
    • 2
    • 2
  • m

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

    03/30/2022, 11:53 AM
    Why aren't you using the correct path in your mock?
    a
    • 2
    • 1
  • j

    Justin Berger

    03/31/2022, 6:12 PM
    Trying to get v2 running on windows, I've got gcc installed via msys2/mingw64 Running pact-go install returns
    Copy code
    2022/03/31 11:24:39 [INFO] package libpact_ffi not found
    2022/03/31 11:24:39 [INFO] downloading library from <https://github.com/pact-foundation/pact-reference/releases/download/libpact_ffi-v0.1.2/libpact_ffi-windows-x86_64.dll.gz> to /usr/local/lib/libpact_ffi.dll
    2022/03/31 11:24:39 [ERROR] Your Pact library installation is out of date and we were unable to download a newer one for you: bad response code: 404
    I tried manually downloading and copying the
    libpact_ffi.dll
    and
    libpact_ffi.so
    to C:\msys64\mingw64\lib And it's running the tests now (got some failures to work out first)
    m
    • 2
    • 2
  • m

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

    04/06/2022, 12:00 PM
    What happens if you run
    pact-mock-service version
    in the same terminal you're running the tests?
    a
    • 2
    • 10
  • g

    Guillaume Camus

    04/06/2022, 1:58 PM
    Hi all, I use Pact-go v2.XXX. And I try to describe a float number with a matcher like this:
    Copy code
    WithJSONBody(Map{
    				"id":             Integer(21),
    				"name":           S("foo 2"),
    				"brand":          S("bar 2"),
    				"price_incl_vat": Regex("23.125", "[0-9]+\\.[0-9]+"),
    				"price_excl_tax": Regex("18.185", "[0-9]+\\.[0-9]+"),
    			}).
    but that generates a string and not a float, so when I unmarshal the response I have errors. How I can generate a float ?
    âś… 1
    m
    • 2
    • 2
  • j

    Justin Berger

    04/07/2022, 7:44 PM
    Almost have v2 pact provider verification working in github action, but it's failing to publish for some reason when running in the github action (ubuntu-based) But not when running locally on windows, with manually setting matching environment variables
    Copy code
    Publishing verification results back to the Pact Broker
    
    Fetching path '/pacticipants/Notifications' from pact broker
    
    Failed to push branch feature/pact-v2 for provider version 1.214.1-a2d64f325200e3b5931ce5e9623041dbd8f50773
    
    Publishing of verification results failed with an error: Error with the content of a HAL resource - Request to pact broker URL '<https://paxi.pactflow.io/pacticipants/Notifications/branches/feature/pact-v2/versions/1.214.1-a2d64f325200e3b5931ce5e9623041dbd8f50773>' failed - HTTP status client error (404 Not Found) for url (<https://paxi.pactflow.io/pacticipants/Notifications/branches/feature/pact-v2/versions/1.214.1-a2d64f325200e3b5931ce5e9623041dbd8f50773>)
    m
    • 2
    • 3
  • j

    Jeroen van Dijk

    04/14/2022, 8:39 AM
    On Pact v2, with regards to Configuring the branch when publishing verification results (https://docs.pact.io/pact_broker/branches#configuring-the-branch-when-publishing-verification-results) is the
    ProviderBranch
    in https://github.com/pact-foundation/pact-go/blob/2.x.x/provider/verify_request.go
    m
    • 2
    • 2
  • g

    Guillaume Camus

    04/21/2022, 1:30 PM
    Hi, I’m trying to play with
    StateHandlers
    but I don’t see how I can change the response status code. Do you have an example?
    đź‘€ 1
    m
    • 2
    • 9
  • Ă©

    Édouard Lopez

    04/25/2022, 8:39 AM
    Hello, I'm trying to execute my test on a Ubuntu machine using
    pact-go@2.x.x branch
    . However, the
    pact-go
    install command fails
    Copy code
    pact-go -l DEBUG install
    2022/04/25 10:40:43 [INFO] package libpact_ffi found
    2022/04/25 10:40:43 [DEBUG] unable to determine current version of package libpact_ffi this is probably because the package is currently being installed
    And the
    go test
    command throws a
    ld
    related error;
    Copy code
    ❯ go test ./... 
    ?   	…/pact-consumer-b2c-example-for-go/cmd/pactgoconsumerexample	[no test files]
    ?   	…/pact-consumer-b2c-example-for-go/cmd/pactgoconsumerexample/docs	[no test files]
    # <http://github.com/pact-foundation/pact-go/v2/internal/native|github.com/pact-foundation/pact-go/v2/internal/native>
    /usr/bin/ld: cannot find -lpact_ffi
    collect2: error: ld returned 1 exit status
    FAIL	…/pact-consumer-b2c-example-for-go/internal/b2b [build failed]
    FAIL	…/pact-consumer-b2c-example-for-go/internal/b2c [build failed]
    FAIL
    • 1
    • 1
  • m

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

    04/25/2022, 9:11 AM
    Have you installed the pact_ffi lib?
    Ă©
    • 2
    • 5
  • n

    Nuno Frias

    04/25/2022, 3:17 PM
    Any ideas ?
    • 1
    • 2
  • n

    NewtoPact

    04/25/2022, 8:09 PM
    Hello, any updates on https://pact.canny.io/feature-requests/p/support-grpc
    m
    • 2
    • 6
  • Ă©

    Édouard Lopez

    04/26/2022, 9:01 AM
    Importing
    "<http://github.com/pact-foundation/pact-go/v2/sugar|github.com/pact-foundation/pact-go/v2/sugar>"
    and running the linter I got this error:
    Copy code
    golangci-lint run --skip-dirs cmd/pactgoconsumerexample_tester
    WARN [runner] Can't run linter goanalysis_metalinter: inspect: failed to load package sugar: could not load export data: no export data for "<http://github.com/pact-foundation/pact-go/v2/sugar|github.com/pact-foundation/pact-go/v2/sugar>" 
    ERRO Running error: 1 error occurred:
    	* can't run linter goanalysis_metalinter: inspect: failed to load package sugar: could not load export data: no export data for "<http://github.com/pact-foundation/pact-go/v2/sugar|github.com/pact-foundation/pact-go/v2/sugar>"
    m
    w
    s
    • 4
    • 44
  • g

    GitHub

    05/20/2022, 12:31 PM
    #199 2.x.x: Support for Arm64 Architecture Issue closed by mefellows pact-foundation/pact-go
    🎉 1
    j
    m
    • 3
    • 2
  • n

    Nuno Frias

    06/06/2022, 12:36 AM
    Copy code
    let response = request.send()
        .map_err(|err| anyhow!(err))
        .and_then(native_response_to_pact_response)
        .await?;
    • 1
    • 1
  • n

    Nuno Frias

    06/13/2022, 6:34 AM
    Hello all On a consumer test is there a way for me to set an expectation for the metadata? The
    .WithMetadata
    function only accepts fix values
    map[string]string
  • n

    Nuno Frias

    06/13/2022, 6:39 AM
    I would like to use pact DSL to set the metadata as we have properties on the metadata that are not constants -- namely a timestamp.
    m
    • 2
    • 3
  • w

    win

    06/13/2022, 3:14 PM
    Hey does anyone know why my linter fails?
  • w

    win

    06/13/2022, 3:14 PM
    https://github.com/pact-foundation/pact-go/issues/212
  • w

    win

    06/13/2022, 3:14 PM
    i have an issue similar to this issue^
  • m

    Mark Wilson

    06/24/2022, 12:34 PM
    Hello, can anyone help me with my issue:
    Copy code
    2022/06/24 11:08:29 [INFO] checking pact-mock-service within range >= 3.5.0, < 4.0.0
    2022/06/24 11:08:29 [ERROR] CLI tools are out of date, please upgrade before continuing
    FAIL    <http://github.com/pact-foundation/pact-workshop-go/consumer/client|github.com/pact-foundation/pact-workshop-go/consumer/client>     0.002s
    When I run "sudo pact-mock-service version" it returns 3.10.0 I am following the https://github.com/pact-foundation/pact-workshop-go/tree/step3 but stuck on the end of step3 and receiving the above issue. Any ideas?
    m
    • 2
    • 4
  • r

    Ringo

    06/27/2022, 12:49 PM
    Hello, does pact-go (v2 beta) work with the standalone rust mock server?
    m
    • 2
    • 5
  • m

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

    06/28/2022, 12:43 PM
    Attention Golang users - the latest 2.x.x is out (2.0.0-beta.13)! 🚀 This is quite a big change from the past release, namely I’ve been thinking on the API design with the introduction of V4 and plugins. Summary: • V4 Pact support • Support for synchronous messages • Support for plugins (e.g. for gRPC support https://github.com/pact-foundation/pact-go/tree/2.x.x/examples/grpc) Because the API is more complex, i’ve used a type state builder pattern to force which options can be used at any point in time, and ensure that pre-requisite methods are called in sequence. I’m still not 100% happy with the HTTP package layout (and requiring V2/V3/V4 prefixes on a number of types), so there might be another refactor in that space, but mainly I think it would just be the names of types and packages that could change. I’ll tidy up the documentation over the next few days, but look to the examples folder in the short term if you’re wondering what’s changed. I found refactoring the existing examples fairly straightforward, so I hope you do too. Feedback welcome 🙏
    y
    s
    • 3
    • 10
1234Latest