bethskurrie
2018-03-24 03:39
has joined #pact-go

bethskurrie
2018-04-05 04:12
/github subscribe pact-foundation/pact-go

matt.fellows
2018-04-05 04:12
has joined #pact-go

bethskurrie
2018-05-02 04:55
/github subscribe pact-foundation/pact-go releases

bethskurrie
2018-05-02 04:56
/github unsubscribe pact-foundation/pact-go commits

bethskurrie
2018-05-02 04:56
/github unsubscribe pact-foundation/pact-go public

bethskurrie
2018-05-02 04:56
/github unsubscribe pact-foundation/pact-go deployments

tjones
2018-05-15 01:05
has joined #pact-go

aphelps
2018-05-22 21:39
has joined #pact-go

mr.matt.r.long
2018-06-11 13:18
has joined #pact-go

elliot.chen7
2018-07-03 17:48
has joined #pact-go

elliot.chen7
2018-07-03 18:58
Is the README out of sync? I?m getting `undefined: dsl.MapMatcher` when using the example and I?m running v0.0.13 revision 1567bdaba1c9bccb747cfba1ade5e09b9ccf5eea

matt.fellows
2018-07-03 21:34
@elliot.chen7 it shouldn't be, but it's possible. I'll take a look this morning

elliot.chen7
2018-07-03 21:37
Thanks, also do I need to have a daemon running? From the looks of the doc it says pact-go shouldn?t need one?

matt.fellows
2018-07-03 21:40
No you shouldn't need one. It's all just the usual `go get`, but you do need some binaries on the PATH as per readme

elliot.chen7
2018-07-03 21:59

elliot.chen7
2018-07-03 21:59
Getting `unrecognized import path`

yamad
2018-07-07 09:47
has joined #pact-go

yamad
2018-07-07 12:02
i'd like to ask few questions. i was trying `pact-go/examples`. but i've got some troubles. 1. how to execute `./pact-go daemon`. is the file exists in pact-go repogitory? 2. i couldn't run `consumer_test.go` and `provider_test.go`. i've got these message. is this example not recent? ``` $ go test -v -run TestProvider # _/Users/dorako321/pact-go/examples ./consumer_test.go:22: unknown field 'Port' in struct literal of type dsl.Pact ./consumer_test.go:55: cannot use "/foobar" (type string) as type dsl.StringMatcher in field value: string does not implement dsl.StringMatcher (missing GetValue method) ./consumer_test.go:56: cannot use map[string]string literal (type map[string]string) as type dsl.MapMatcher in field value ./consumer_test.go:61: cannot use map[string]string literal (type map[string]string) as type dsl.MapMatcher in field value ./provider_test.go:28: unknown field 'Port' in struct literal of type dsl.Pact FAIL _/Users/dorako321/pact-go/examples [build failed] ```

matt.fellows
2018-07-08 05:02
I?ll take a look @elliot.chen7 @yamad. We?re transitioning to a new API, so it?s quite possible

matt.fellows
2018-07-08 05:36
OK yep, there was definitely a couple of examples out of date - funnily enough, the only 2 that don?t run as part of CI.


matt.fellows
2018-07-08 05:36
Fixed in all branches, sorry about that!

steve.cook
2018-07-08 10:21
has joined #pact-go

elliot.chen7
2018-07-09 01:38
Thanks @matt.fellows! I?ll give it another try tomorrow

matt.fellows
2018-07-09 01:39
:+1:

alex.bednarczyk
2018-07-10 13:19
has joined #pact-go

alex.bednarczyk
2018-07-10 13:24
is there a golang version of pact I need to install to pact test golang code?

yamad
2018-07-10 13:25
@matt.fellows it working perfectly now. thanks. good product.

alex.bednarczyk
2018-07-10 13:25
I tried this command `go get -d http://github.com/pact-foundation/pact-go` and it executed without error but when I run `go test-v .` i get an error ``` :> go test -v . === RUN TestPact_GoKitProvider 2018/07/10 08:24:29 [DEBUG] pact setup logging 2018/07/10 08:24:29 [DEBUG] pact setup 2018/07/10 08:24:29 [DEBUG] checking CLI compatability 2018/07/10 08:24:29 [INFO] checking pact-mock-service within range >= 2.6.4, < 3.0.0 2018/07/10 08:24:29 [DEBUG] running binary pact-mock-service 2018/07/10 08:24:29 [ERROR] CLI tools are out of date, please upgrade before continuing FAIL http://github.com/pact-foundation/pact-go/examples/go-kit/provider 0.027s ```

matt.fellows
2018-07-10 13:32
Awesome, sorry about those. Any questions do let us know

matt.fellows
2018-07-10 13:32
Have you installed the CLI tools?


matt.fellows
2018-07-10 13:35
It's a bit misleading, I'll update that first section of the docs. But you need to first have some tools in your path first

alex.bednarczyk
2018-07-10 13:42
@matt.fellows does this install method work for mac?

alex.bednarczyk
2018-07-10 14:00
the `some tools` isnt clear. i assumed that `go get -d http://github.com/pact-foundation/pact-go` would install everything i need but it didnt seem to work

elliot.chen7
2018-07-10 16:21
I had the same understanding as @alex.bednarczyk and got the same error when I first tried

alex.bednarczyk
2018-07-10 16:54
@elliot.chen7 did you get it working?

matt.fellows
2018-07-10 21:01
@alex.bednarczyk ah, I see the problem in our docs. We have a links section with all of the re-usable links but they aren?t rendering for some reason. I?ll take a look. Apologies


matt.fellows
2018-07-10 21:02
and yes, that should work on a Mac

matt.fellows
2018-07-10 21:02
What have you tried?

matt.fellows
2018-07-10 21:09
Docs updated, links have been restored

alex.bednarczyk
2018-07-10 23:39
I tried NPM install pact, the instructions don?t have the global arg so i?m a little confused how pact would be available gloally

alex.bednarczyk
2018-07-10 23:41
also tried the ruby standalone but i cant find the error i got from that

alex.bednarczyk
2018-07-10 23:41
`go get -d http://github.com/pact-foundation/pact-go` might have done something but `pact` didnt work after so a step might be missing

matt.fellows
2018-07-10 23:51
@alex.bednarczyk npm?

alex.bednarczyk
2018-07-10 23:51
`npm i @pact-foundation/pact-standalone`

matt.fellows
2018-07-10 23:52
Those three steps are all you need: 1. Download the appropriate zip file for your platform from https://github.com/pact-foundation/pact-ruby-standalone/releases 2. Ensure the files in the extracted `bin` dir are on your `PATH` 3. then you can go get

matt.fellows
2018-07-10 23:52
is there somewhere that says to use npm? If so, it?s confusing and it needs to be corrected

alex.bednarczyk
2018-07-10 23:53
let me look

matt.fellows
2018-07-10 23:53
thanks

alex.bednarczyk
2018-07-10 23:54
I think I was trying to get something installed.

alex.bednarczyk
2018-07-10 23:55
let me look at the readme again. ill have some feedback tomorrow. thanks for responding

alex.bednarczyk
2018-07-11 00:03
I unzipped the tgz and moved all files in the bin directory to /Users/alex/bin which is in my path ```:> pact /Users/alex/bin/pact: line 27: /Users/alex/lib/ruby/bin/ruby: No such file or directory```

bethskurrie
2018-07-11 00:04
@alex.bednarczyk the easiest way to install the standalone is to use https://github.com/pact-foundation/pact-ruby-standalone/blob/master/install.sh

bethskurrie
2018-07-11 00:04
What is your OS?

bethskurrie
2018-07-11 00:05
Also, @alex.bednarczyk @matt.fellows let's move this to a thread so we're not spamming the whole channel.

alex.bednarczyk
2018-07-11 00:05
macos

alex.bednarczyk
2018-07-11 00:06
trying the install.sh now

bethskurrie
2018-07-11 00:07
``` bethtemp $ curl -fsSL https://raw.githubusercontent.com/pact-foundation/pact-ruby-standalone/master/install.sh | bash % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 612 0 612 0 0 652 0 --:--:-- --:--:-- --:--:-- 652 100 7435k 100 7435k 0 0 651k 0 0:00:11 0:00:11 --:--:-- 1376k bethtemp $ ./pact/bin/pact Commands: pact docs # Generate Pact documentation in markdown pact help [COMMAND] # Describe available commands or one specific command pact verify -h, --pact-helper=PACT_HELPER # Verify a pact ```

alex.bednarczyk
2018-07-11 00:07
```:> ./install.sh % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 612 0 612 0 0 2398 0 --:--:-- --:--:-- --:--:-- 2390 100 7435k 100 7435k 0 0 1248k 0 0:00:05 0:00:05 --:--:-- 1552k```

alex.bednarczyk
2018-07-11 00:07
ok let me try your command

alex.bednarczyk
2018-07-11 00:08
```:> curl -fsSL https://raw.githubusercontent.com/pact-foundation/pact-ruby-standalone/master/install.sh | bash % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 612 0 612 0 0 2235 0 --:--:-- --:--:-- --:--:-- 2241 100 7435k 100 7435k 0 0 1943k 0 0:00:03 0:00:03 --:--:-- 2369k```

alex.bednarczyk
2018-07-11 00:08
stops there

bethskurrie
2018-07-11 00:08
yes, that's fine.

bethskurrie
2018-07-11 00:08
Then run pact/bin/pact

alex.bednarczyk
2018-07-11 00:11
```:> pact/bin/pact Commands: pact docs # Generate Pact documentation in markdown pact help [COMMAND] # Describe available commands or one specific command pact verify -h, --pact-helper=PACT_HELPER # Verify a pact```

bethskurrie
2018-07-11 00:11
looks like it's working.

alex.bednarczyk
2018-07-11 00:12
ok great. ill try the go test command

alex.bednarczyk
2018-07-11 00:14
```:> go test -v . === RUN TestConsumer 2018/07/10 19:14:53 [INFO] checking pact-provider-verifier within range >= 1.12.0, < 3.0.0 2018/07/10 19:14:53 [ERROR] CLI tools are out of date, please upgrade before continuing FAIL http://github.com/pact-foundation/pact-go/examples 0.025s```

bethskurrie
2018-07-11 00:19
@matt.fellows?

bethskurrie
2018-07-11 00:20
@alex.bednarczyk look at the readme in the top pact dir. It will list all the versions used.

alex.bednarczyk
2018-07-11 00:21
@bethskurrie do I need to do anything with the `pact/bin/pact` file?

bethskurrie
2018-07-11 00:21
no

alex.bednarczyk
2018-07-11 00:22
ok, its in `~/projects/test/pact-ruby-standalone`

bethskurrie
2018-07-11 00:22
The readme?

alex.bednarczyk
2018-07-11 00:22
go is in `~/go/src/github.com/pact-foundation/pact-go/examples`

bethskurrie
2018-07-11 00:22
No, it's in pact/README.md

bethskurrie
2018-07-11 00:22
The standalone that you installed has a readme.md in it.

alex.bednarczyk
2018-07-11 00:23
ok i see it

alex.bednarczyk
2018-07-11 00:23
```This version (1.49.0) of the Pact standalone executables package contains: * pact gem 1.28.0 * pact-mock_service gem 2.9.1 * pact-support gem 1.6.2 * pact-provider-verifier gem 1.14.4 * pact_broker-client gem 1.16.0 * pact-message gem 0.4.5```

bethskurrie
2018-07-11 00:24
So, that logic that says it's out of date is mistaken.

bethskurrie
2018-07-11 00:24
Matt will be able to help you, but he's currently busy.

alex.bednarczyk
2018-07-11 00:24
ok

matt.fellows
2018-07-11 00:31
you need to add that folder (l?m just guessing, but from what you?ve been saying it will be something like: `~/projects/test/pact-ruby-standalone/pact/bin/`) to your `PATH`: e.g. ``` PATH="${PATH}:~/projects/test/pact-ruby-standalone/pact/bin/" ```

matt.fellows
2018-07-11 00:31
Pact Go can?t run a binary if it can?t find it

bethskurrie
2018-07-11 00:32
It looks like you've got the pact-ruby-standalone project checked out?

matt.fellows
2018-07-11 00:32
It looks like you _moved_ the binaries - you can?t do that

alex.bednarczyk
2018-07-11 13:10
yea i have it checked out

alex.bednarczyk
2018-07-11 13:11
i added the `bin` dir to my path and the tests executed

alex.bednarczyk
2018-07-11 13:11
```:> go test -v . === RUN TestConsumer 2018/07/11 08:09:31 [INFO] checking pact-provider-verifier within range >= 1.12.0, < 3.0.0 2018/07/11 08:09:32 [INFO] checking pact-broker within range >= 1.14.0, < 2.0.0 2018/07/11 08:09:33 [INFO] checking pact-mock-service within range >= 2.6.4, < 3.0.0 2018/07/11 08:09:34 [ERROR] service: [2018-07-11 08:09:34] INFO WEBrick 1.3.1 2018/07/11 08:09:34 [ERROR] service: [2018-07-11 08:09:34] INFO ruby 2.2.2 (2015-04-13) [x86_64-darwin13] 2018/07/11 08:09:34 [ERROR] service: [2018-07-11 08:09:34] INFO WEBrick::HTTPServer#start: pid=15046 port=58415 Test Passed! 2018/07/11 08:09:34 [ERROR] service: [2018-07-11 08:09:34] INFO going to shutdown ... 2018/07/11 08:09:34 [ERROR] service: [2018-07-11 08:09:34] INFO WEBrick::HTTPServer#start done. 2018/07/11 08:09:34 [INFO] INFO: Writing pact before shutting down 2018/07/11 08:09:34 [INFO] 2018/07/11 08:09:34 [INFO] Writing pact for MyProvider to /Users/alex/go/src/github.com/pact-foundation/pact-go/examples/pacts/myconsumer-myprovider.json --- PASS: TestConsumer (3.04s) === RUN TestProvider 2018/07/11 08:09:34 [INFO] checking pact-provider-verifier within range >= 1.12.0, < 3.0.0 2018/07/11 08:09:35 [INFO] checking pact-broker within range >= 1.14.0, < 2.0.0 2018/07/11 08:09:35 [INFO] checking pact-mock-service within range >= 2.6.4, < 3.0.0 === RUN TestProvider/has_status_code_200 === RUN TestProvider/has_a_matching_body === RUN TestProvider/"Content-Type"_which_equals_"application/json" --- PASS: TestProvider (2.23s) --- PASS: TestProvider/has_status_code_200 (0.00s) pact.go:314: Verifying a pact between MyConsumer and MyProvider Given User foo exists A request to get foo with GET /foobar returns a response which has status code 200 --- PASS: TestProvider/has_a_matching_body (0.00s) pact.go:314: Verifying a pact between MyConsumer and MyProvider Given User foo exists A request to get foo with GET /foobar returns a response which has a matching body --- PASS: TestProvider/"Content-Type"_which_equals_"application/json" (0.00s) pact.go:314: Verifying a pact between MyConsumer and MyProvider Given User foo exists A request to get foo with GET /foobar returns a response which includes headers "Content-Type" which equals "application/json" PASS ok http://github.com/pact-foundation/pact-go/examples 5.292s```

alex.bednarczyk
2018-07-11 13:38
are these errors ok?

bethskurrie
2018-07-11 21:07
Looks OK to me. Not sure why they're prefixed with ERROR.

matt.fellows
2018-07-11 21:09
I'll double check. There was a bug a while ago where things were being interpreted as if they were from stderr.

matt.fellows
2018-07-11 21:09
But if there is a pact file created, it's working

matt.fellows
2018-07-11 21:14
@bethskurrie I?ll ping you in a sec

matt.fellows
2018-07-12 02:01
How did you go Alex?


bethskurrie
2018-07-12 09:06
@matt.fellows I've worked out how to send that log to stdout. It's in the latest standalone 1.51.0

ssn899
2018-07-12 22:27
has joined #pact-go

bethskurrie
2018-07-13 06:18
> ? 2e0f236 - upgrade(broker): allow pb:pacts and pacts HAL links to be followed (Matt Fellows, Sun May 20 13:15:52 2018 +1000) ? 808ebfa - fix(broker): use 'pb:pacts' instead 'pacts'. See #82 (Matt Fellows, Fri May 18 22:55:20 2018 +1000) Thank you for noticing @matt.fellows!

matt.fellows
2018-07-13 06:34
:smile:

bethskurrie
2018-07-13 06:35
I want to move the pact retrieval into the ruby standalone so that I can put the WIP pacts stuff into there and roll it out to all the languages. it will help the problem where we have to configure the ssl for both the wrapper language and the ruby code as well.

bethskurrie
2018-07-13 06:36
From what I've seen in the js, the configuration options are the provider name, and a list of tags?

bethskurrie
2018-07-13 06:36
`--provider Foo --tag prod --tag master`?

matt.fellows
2018-07-13 06:47
Yep, it makes complete sense.

bethskurrie
2018-07-13 06:48
Rashi has actually already done the ruby code, i just have to hook it up to the command line

matt.fellows
2018-07-13 06:49
I?ll have a quick look, I think that?s correct

kaushalye
2018-07-23 07:11
has joined #pact-go

jim
2018-07-23 17:59
has joined #pact-go

rabih
2018-08-10 06:53
has joined #pact-go

rabih
2018-08-10 07:05
Hello, I am working with pact hosted broker. I have a golang docker image with pact installed in it. I build the image and when try to run consumer integration tests it fails, knowing that when running it independently it works and upload the contracts to the broker. I think it is an issue in creating json contracts locally. Any help regarding this issue would be appreciated :question:

rabih
2018-08-10 11:42
I believe this issue is related to the below https://github.com/pact-foundation/pact-js/issues/154

bethskurrie
2018-08-10 11:46
Have you tried the fix suggested by the issue you mention @rabih?

rabih
2018-08-10 11:46
yes and worked just fine

bethskurrie
2018-08-10 11:50
:+1:


pau
2018-08-20 10:56
has joined #pact-go

madu.alikor
2018-09-27 09:14
has joined #pact-go

madu.alikor
2018-09-27 09:15
my provider test does not seem to ever end and i'm forced to terminate the process can anyone help?

madu.alikor
2018-09-27 09:16
``` // +build contract package rest import ( "encoding/json" "fmt" "log" "net/http" "os" "path/filepath" "testing" "http://github.com/pact-foundation/pact-go/dsl" "http://github.com/pact-foundation/pact-go/types" ) var port = 8000 var dir, _ = os.Getwd() var pactDir = fmt.Sprintf("%s/../../../pacts", dir) var logDir = fmt.Sprintf("%s/logs", dir) func TestProvider(t *testing.T) { // Start provider API in the background go startServer() // Create Pact connecting to local Daemon pact := &dsl.Pact{ Consumer: "client", Provider: "paymentService", Host: "localhost", LogDir: logDir, PactDir: pactDir, DisableToolValidityCheck: true, } // log.Println("Start verify ", []string{filepath.ToSlash(fmt.Sprintf("%s\\buildreader-bringon.json", pactDir))}, // fmt.Sprintf("http://localhost:%d/setup", port), fmt.Sprintf("http://localhost:%d", port), fmt.Sprintf("%s\\buildReader-bringon.json", pactDir)) // Verify the Provider with local Pact Files _, err := pact.VerifyProvider(t, types.VerifyRequest{ ProviderBaseURL: fmt.Sprintf("http://localhost:%d", port), PactURLs: []string{filepath.ToSlash(fmt.Sprintf("%s/client-paymentservice.json", pactDir))}, ProviderStatesSetupURL: fmt.Sprintf("http://localhost:%d/setup", port), }) if err != nil { t.Fatal("Error:", err) } } func startServer() { mux := http.NewServeMux() lastName := "billy" mux.HandleFunc("/foobar", func(w http.ResponseWriter, req *http.Request) { w.Header().Add("Content-Type", "application/json") fmt.Fprintf(w, fmt.Sprintf(`{"name":"billy", "lastName":"%s"}`, lastName)) // Break the API by replacing the above and uncommenting one of these // w.WriteHeader(http.StatusUnauthorized) // fmt.Fprintf(w, `{"s":"baz"}`) }) // This function handles state requests for a particular test // In this case, we ensure that the user being requested is available // before the Verification process invokes the API. mux.HandleFunc("/setup", func(w http.ResponseWriter, req *http.Request) { var s *types.ProviderState decoder := json.NewDecoder(req.Body) decoder.Decode(&s) if s.State == "User foo exists" { lastName = "bagr" } w.Header().Add("Content-Type", "application/json") }) log.Fatal(http.ListenAndServe(":8000", mux)) } ```

fergusstrange764
2018-10-04 02:47
has joined #pact-go

paul.davies
2018-10-12 05:01
has joined #pact-go

rabih
2018-11-06 16:47
hello, any help regarding the below issue:(note that I am using option PactFileWriteMode: ?update?) /pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/shared_helpers.rb:78: warning: Insecure world writable dir /go/bin in PATH, mode 040777

matt.fellows
2018-11-08 08:59
I've seen it before on a wercker build. It's a warning, so shouldn't affect any builds

matt.fellows
2018-11-08 09:00
The answer is in the warning - it's telling you /go/bin had insecure permissions on it. Make it more secure, and it will go away

rabih
2018-11-08 09:56
I have 2 micro-services, first one has GET rest APIs and the other has the POST APIs. Is there a way that the two services could update the same pact consumer and provider? Since what is happening now is that the last integration tests ran will override pacts. Any advice regarding this issue?

nihei.dev
2018-11-12 09:45
has joined #pact-go

rabih
2018-12-12 13:36
Hi all, I have issue in Message pact testing, So the contract has a message with contents, when the provider try to validate this message the dsl.Message is an empty struct, so the question here, the message should have been parsed with the json message found in the contract?

stein
2018-12-19 17:40
has joined #pact-go

stein
2018-12-19 17:40
Hi, quick question. When verifying a pact using the go provider, e.g. ``` res, err := pact.VerifyProvider(...) ``` If no consumers have published pacts the provider verification fails with an ambiguous error - ?Pact URLs is mandatory?. Is this the expected behavior? From memory (I might be wrong) the same scenario in the jvm verifier just skips the test if no consumers are defined. How might I achieve this in go since it?s quite convenient when setting stuff up initially? Cheers

matt.fellows
2018-12-19 23:31
hmm I recall this coming up before, but can?t quite remember the discussion :smile:

matt.fellows
2018-12-19 23:32
one the one hand, not finding any consumers might be a signal something is wrong. On the other hand, perhaps you?re searching for tags (andn therefore consumers) that don?t yet exist, and therefore it isn?t a problem yet.

matt.fellows
2018-12-19 23:33
Could you please raise an issue to track on the github repo?

stein
2018-12-20 08:06
Thanks Matt. Will do.

matt.fellows
2018-12-20 20:42
Sorry for the late response, did you get this sorted?

rabih
2018-12-21 06:40
Hi @matt.fellows, actually no, I am still getting an empty dsl.Message. You can find the below code for your reference. Please advice how MQ pact works. ``` "an event created": func(m dsl.Message) (interface{}, error) { myEvent := m.Content.(*MyEvent) // This is not working, only getting state and message description in m //The below is working since it is comparing it with the message in the contract myCreatedEvent, err := prepareEvent() return myCreatedEvent, err }, ```

matt.fellows
2018-12-21 06:49
The provider will never receive the message - it's the one sending it to a queue in the first place!. Pact will invoke that function and expect it to populate the returning interface {} with the response, which is then compared to the contract.

rabih
2018-12-21 06:51
yes, that?s what I figured out

rabih
2018-12-21 06:52
Thank you

matt.fellows
2018-12-21 08:11
Do you think we could make this clearer on the docs? If so, what do you think we should do differently?

rabih
2018-12-21 08:17
I?d suggest to have more related examples to message queueing like integration with RabbitMQ, Nats, Kafka. Since the example provided for messages is translated from the API examples, which I think is not a valid use case for message queueing. Thank you

matt.fellows
2018-12-21 08:28
Thanks Rabieh. Some good advice for the backlog :slightly_smiling_face:

matt.fellows
2018-12-21 08:29
PR?s welcome, too :smile:

lucas.beier
2019-01-10 12:38
has joined #pact-go

lucas.beier
2019-01-10 12:39
about this specific issue

lucas.beier
2019-01-10 12:39
I'm not sure if this is an issue or not

lucas.beier
2019-01-10 12:39
I'm trying to debug it locally

lucas.beier
2019-01-10 12:41
I saw the server I start is starting in a port (eg 55756) and the mock service on other one (eg 55757)

lucas.beier
2019-01-10 12:41
I'm not sure what is this mock service

lucas.beier
2019-01-10 12:42
In `client.go` we can find this code: ``` port := getPort(request.ProviderBaseURL) waitForPort(port, p.getNetworkInterface(), p.Address, fmt.Sprintf(`Timed out waiting for Provider API to start on port %d - are you sure it's running?`, port)) ```

lucas.beier
2019-01-10 12:43
In the `for select` on `waitForPort`, the first time the `net.Dial` dials to the correct port (57420, for example), but the second time it dials to 0

lucas.beier
2019-01-10 12:53
Is this deliberate?

matt.fellows
2019-01-11 01:55
hi @lucas.beier, thanks for raising the issue. I can?t quite reproduce your code but will publish to our test broker and go from there

matt.fellows
2019-01-11 01:56
The port `0` doesn?tt look deliberate, so i?s possible something else has gone awry before that point to cause issues.

matt.fellows
2019-01-11 01:56
During consumer side testing, the mock service is what records the interactions and is your ?dummy? provider. It?s not used on provider verification, however.

matt.fellows
2019-01-11 02:01
OK,. I?ve just published your pacts to our hosted broker (http://test.pact.dius.com.au)

matt.fellows
2019-01-11 02:02
Passing as expected, I think

matt.fellows
2019-01-11 02:02
My guess is that perhaps it can?t find the CLI tools

matt.fellows
2019-01-11 02:02
Can you please test without `DisableToolValidityCheck: true`?

rabih
2019-01-16 10:30
Hello, I have a question, is it possible to test 2 different consumer against same provider?

matt.fellows
2019-01-16 10:30
Yes

matt.fellows
2019-01-16 10:30
Absolutely!

rabih
2019-01-16 10:33
we are testing the two pacts in the same file, is it a problem?

matt.fellows
2019-01-16 12:43
Can you elaborate on what you mean? You'll need to ensure you setup so that each test directs the interactions at separate mock providers

rabih
2019-01-16 12:46
so we are initializing two pacts, the first is for Consumer1 and Provider1, the second is for Consumer2 and Provider1, we have a TestMain function and multiple testing functions where we are adding the function mapping in each unit tests with the specific pact, and at the end of the TestMain we are calling provider validation

matt.fellows
2019-01-18 02:58
I?m not sure this is a good idea. Each consumer/provider testing should be done in isolation from one another. Is there are reason why they are coupled like this?

rabih
2019-01-18 07:51
so according to CQRS, we have command service and query service, where command ones can consume events from multiple query services

matt.fellows
2019-01-18 10:31
Sure, but you can still separate out the tests for the query and command consumers. Perhaps if you could share some code that would help. In short, you can most definitely share multiple consumers for a single provider

rabih
2019-01-21 15:48
my issue is resolved, so instead, I used one pact for the provider without specifying a consumer, so now it is validating all consumers with one provider

rabih
2019-01-22 12:44
has any one worked with versioning pact with CI builds and github?

matt.fellows
2019-01-24 04:59
might want to ask in #general or #pact-broker

matt.fellows
2019-01-24 04:59
but yes, it?s common :slightly_smiling_face:

zach.the.hammer
2019-02-12 01:15
has joined #pact-go

rickard.andersson
2019-02-20 07:04
has joined #pact-go

rabih
2019-03-04 15:48
Hi, is it possible to force the name for consumer/provider instead of getting this message(other than creating manually): The name ?ServicesProvider? is very similar to the following existing consumers/providers: * providers_api If you meant to specify one of the above names, please correct the pact configuration, and re-publish the pact.

matt.fellows
2019-03-05 02:57
Best asking this in the #pact-broker channel, but the answer is yes (maybe).

matt.fellows
2019-03-05 02:57
Are you using the hosted version or your own?

matt.fellows
2019-03-10 12:22
Hi folks, I've made a few significant changes to pact go tonight and am looking for feedback.

matt.fellows
2019-03-10 12:25
1. Deprecated need for the annoying states setup URL in favour of registering simple state handler functions 2. Added before and after hooks to invoke during test lifecycle 3. Added Request Filter middleware where you can intercept requests to the provider, enabling use cases such as updating bearer tokens https://github.com/pact-foundation/pact-go/tree/feat/hooks-api

matt.fellows
2019-03-10 12:25
This is based on feedback on forums as well as usage and adoption in the JS dsl which I also maintain.

dave.carrell
2019-03-25 14:09
has joined #pact-go

marc
2019-04-17 13:28
has joined #pact-go

vaso.giamarelou
2019-04-20 11:44
has joined #pact-go

j
2019-04-23 02:49
has joined #pact-go

drewbailey5
2019-05-02 17:11
has joined #pact-go

drewbailey5
2019-05-02 17:12
Hello! has anyone ever worked with building query params to allow for the rails flavor of arrays in params?

drewbailey5
2019-05-02 17:12
`names[]=ENV1&names[]=ENV2`

nboyd
2019-05-06 20:52
has joined #pact-go

nick.karamaniolas
2019-05-07 13:10
has joined #pact-go

braddle
2019-05-08 10:09
has joined #pact-go

edwin.tye
2019-05-24 15:59
has joined #pact-go

void.alexey
2019-05-27 22:11
has joined #pact-go

rob.clarken
2019-06-04 22:47
has joined #pact-go

n.chachampis
2019-06-11 06:49
has joined #pact-go

fili.projetto
2019-06-17 10:17
has joined #pact-go

meirosuandreea
2019-07-18 09:58
has joined #pact-go

meirosuandreea
2019-07-18 09:59
Hi, I am pretty new to PACT and I find myself stuck with the following situation: I want to match a stream response of type text/plain which looks similar to: {"Id": 1224, "Name": "Ana", "Age": 5} {"Id": 34, "Name": "Lele", "Age": 4} I know it can be done with regex but I am interested in actually checking if each row is of a certain object type, similar to EackLike("Person") which works if response is json - array of objects. Do you have any suggestion? Or how a custom Matcher would look like?

meirosuandreea
2019-07-18 09:59
has anyone tried something similar or is there any post with more details on custom matcher in go? and how would the pact file be interpreted by a provider in another language (like Java) if the matcher is not built in type?

matt.fellows
2019-07-18 10:29
Hmmm why text/plain?

matt.fellows
2019-07-18 10:30
One option would be to parse it into JSON before handing it off to Pact, but that has its drawbacks

matt.fellows
2019-07-18 10:31
(also I saw your note in gophers, but the real Pact audience is here...)

meirosuandreea
2019-07-18 10:54
yes, I was trying to get an answer and the gophers was the first channel I saw, then I red about this one. But if I change the response to json it means I am not testing the actual response of the provider

matt.fellows
2019-07-18 11:13
> But if I change the response to json it means I am not testing the actual response of the provider Yes, that is the drawback :wink:

matt.fellows
2019-07-18 11:27
I refer you to the pragmatism principle

matt.fellows
2019-07-18 11:28
You?ll need to weigh up the value of maintaining the tests vs potential for reality to get out of sync.

matt.fellows
2019-07-18 11:29
Obviously, it would be ideal to do the plain text match. There is currently no (published) way to add / extend the matchers, and if you did, you?d need to somehow make the pact file it generates compatible with other implementations, else it wouldn?t work if it needed to be verified by, say, Java

matt.fellows
2019-07-18 11:29
The specification for the pact file is https://github.com/pact-foundation/pact-specification/

meirosuandreea
2019-07-18 11:33
ok, got it. thank you for the response. Ideally, I would have wanted something like the EachLike and check for a object type, since with regex order is important and it's hard to cover optional fields and values, but I will reconsider probably the enforcement on the response

matt.fellows
2019-07-18 11:33
Yes.

matt.fellows
2019-07-18 11:33
Currently, all of the matching logic is performed by a Ruby process (for consistency with the other Pact implementations)

matt.fellows
2019-07-18 11:34
In theory, you could add matchers to it by modifying that code (https://github.com/pact-foundation/pact-ruby)

matt.fellows
2019-07-18 11:34
But, probably, a better option would be to add a new matcher to Pact Go somehow that simply is syntatic sugar that spits out a bunch of regexes under the hood, keeping things compatible

matt.fellows
2019-07-18 11:35
It?s been a while since I?ve had my head in the depths of the code base, but you?d probably want to be looking at https://github.com/pact-foundation/pact-go/blob/master/dsl/matcher.go as a starting point

matt.fellows
2019-07-18 11:36
I would absolutely welcome a PR. BUT, I would like to know a bit more about your use case to justify expanding any interface, to see how it could benefit the community going forward

meirosuandreea
2019-07-18 11:39
I looked on it and I was pretty much sure that the custom matcher would have to use the built in types in the end just to support cross language integration but wanted double check.

matt.fellows
2019-07-18 11:40
cool

matt.fellows
2019-07-18 11:40
Let me know if you need help

matt.fellows
2019-07-18 11:41
I?ll be honest, the next 2 weeks i?m flat out (2 talks, 2 interstate trips and client work), but will do what I can.

meirosuandreea
2019-07-18 11:42
thank you again. will come back here if any further questions on the road

kevin.monteiro
2019-07-18 22:12
has joined #pact-go

fergusstrange764
2019-07-30 23:23
I think this message is displayed when the CLI tools can?t actually be found either. You need to install https://github.com/pact-foundation/pact-ruby-standalone beforehand and make sure al the executables are available on your path

elliot.sel
2019-08-14 13:17
has joined #pact-go

marius.maaland
2019-08-21 15:35
has joined #pact-go

marius.maaland
2019-08-21 15:36
I have a question about provider states. I understand that when I can't run the API locally, you need to have an endpoint or similar you can call that will insert the test data into my datasource before the interaction is replayed against the provider. Now, for provider states in a local API, how would they work, exactly? Do they still interact with the datastore, only locally? The only examples I've seen have been really simple and general

matt.fellows
2019-08-21 23:03
exactly

matt.fellows
2019-08-21 23:03
The only difference is how the states get setup. You can instrument your running API with extra endpoints (e.g. `/pact/setup`) that will handle the state, or you can pass a function to the Pact runner and that will do a similar thing

matt.fellows
2019-08-21 23:04
People didn?t like having to add extra endpoints to their APIs - they felt they were cheating or potentially modifying the code in such a way that it reduced their confidence in what was actually going to production. For some, appending new endpoints/handlers to the API was problematic also

marius.maaland
2019-08-21 23:20
I see. And the I presume then will happen right before the interaction is actually run, so the `/pact/setup` endpoint is called, the mock data gets injected into the database, the request is replayed and the provider sees that "Oh, TestUser123 does exist" and responds accordingly

marius.maaland
2019-08-21 23:21
Now, this would have to be cleaned up. It doesn't sound like that can happen in the `setup` endpoint, is this the purpose of the `AfterEach` handler?

matt.fellows
2019-08-21 23:24
Pretty much, albeit in most cases you can have a default case in the setup endpoint enough yelled care of initialisation/cleanup

matt.fellows
2019-08-21 23:24
In most cases, a cleanup is not necessary and the new state setup can just set it as needed

matt.fellows
2019-08-22 00:13
> Pretty much, albeit in most cases you can have a default case in the setup endpoint enough yelled care of initialisation/cleanup Apologies was on the phone and obviously this misspelled. What I meant to say was? Pretty much, albeit in most cases you can have a default case in the setup endpoint that takes care of initialization/cleanup

marius.maaland
2019-08-22 18:30
Makes sense! Thanks for explaining

marius.maaland
2019-08-26 23:56
Quick question: where in the `pact-go` source is the consumer side request parsed? I.e. where the mock receives the request and creates the response

bethskurrie
2019-08-26 23:58
In Ruby :wink:

marius.maaland
2019-08-26 23:58
ah..

bethskurrie
2019-08-26 23:59
It uses the ruby mock service that has been packaged so it can be used independently.


marius.maaland
2019-08-27 00:00
I see, thanks

marius.maaland
2019-08-27 00:03
The reason I am asking is: my client creates the request body in a POST request by calling `json.Marshal()` on a struct instance, and calling `bytes.NewReader(body)` before sending it as an input in `http.NewRequest()`.

marius.maaland
2019-08-27 00:03
In the interaction setup I am describing the body with a `MapMatcher`.

marius.maaland
2019-08-27 00:04
The problem I am having is, when executing the test, pact says that the interaction does not match the request, because the request body it gets has doubly escaped quotation marks, while the interaction does not

bethskurrie
2019-08-27 00:04
have you looked at the logs?

marius.maaland
2019-08-27 00:05
I can, of course, just `json.Marshal` the interaction setup as well, but that is the deprecated way of doing it according to the source code

bethskurrie
2019-08-27 00:05
You'll need @matt.fellows to help you with that.

bethskurrie
2019-08-27 00:05
I'm not a go person

marius.maaland
2019-08-27 00:06
Yep, my logs are showing this: ``` Key: - is expected + is actual Matching keys and values are not shown { - "body": { - "proofRequestId": "someId" - } + "body": "{\"proofRequestId\":\"someId\"}" } ```

marius.maaland
2019-08-27 00:06
Thanks Beth! I'll wait for Matt's input

bethskurrie
2019-08-27 00:06
I think your content types may be not matching

bethskurrie
2019-08-27 00:07
the second one is a string

bethskurrie
2019-08-27 00:07
not a json object

bethskurrie
2019-08-27 00:07
it only tries to parse the body to json if the content type contains "json"

marius.maaland
2019-08-27 00:07
oh good catch, I'll give that a *go*

marius.maaland
2019-08-27 00:10
lol, yup, that was it

marius.maaland
2019-08-27 00:10
Thanks @bethskurrie !

bethskurrie
2019-08-27 00:11
np

priyank.shah217
2019-08-30 07:18
has joined #pact-go

marius.maaland
2019-08-30 23:21
What is the purpose of this check? https://github.com/pact-foundation/pact-go/blob/master/dsl/pact.go#L416 It's causing my `BeforeEach` to be skipped

matt.fellows
2019-08-30 23:40
Hmm I see the issue. I'm assuming you are setting a remote provider states endpoint? The idea is that we need a way to avoid duplication of calling that before each hook. The current rule is to only execute on proxy setup endpoint. We might need to enhance that logic

marius.maaland
2019-09-03 18:40
I am not setting a provider states endpoint, I was just trying to use a `BeforeEach` to run before my test

marius.maaland
2019-09-03 19:56
So the idea is that `BeforeEach` statements are only run if a proxy setup endpoint is set?

matt.fellows
2019-09-04 09:06
No, it should happen only once per interaction. It just so happens to be done when the setup endpoint is called - which should _always_ happen (unless you set a specific remote endpoint for that)

matt.fellows
2019-09-04 09:06
so it sounds like a bug, then

marius.maaland
2019-09-05 17:44
Right, so if I don't set a setup endpoint, pact should still call the `/__setup` endpoint, thus allowing the `BeforeEach` to be run?

mui_ume
2019-09-07 09:13
has joined #pact-go

matt.fellows
2019-09-10 02:47
@marius.maaland apologies, have been away for a few days. Managed to do this on the plane: https://github.com/pact-foundation/pact-go/compare/fix/enable-external-https-requests?expand=1

matt.fellows
2019-09-10 02:48
Would you mind taking a look to see if it?s a sensible implementation?

matt.fellows
2019-09-10 02:48
Basically, allow somebody to specify a TLS configuration for their needs. There is an example in there for a self-signed certificate, but to simply disable verification is also very easy

matt.fellows
2019-09-10 02:48
Yes

matt.fellows
2019-09-10 02:49
Would you mind providing more detail on this bug? It should definitely be called, unless there is a new bug in there

marius.maaland
2019-09-10 05:15
Yep. Let me get back to you tomorrow (pacific time)

marius.maaland
2019-09-10 05:20
great! thanks, I'll take a look as soon as I get the chance

matt.fellows
2019-09-10 06:38
You?re welcome

matt.fellows
2019-09-10 06:38
It?s still not ready from prime time, but I?d rather have real users play with it before I invest too far

marius.maaland
2019-09-16 23:22
Hi @matt.fellows, sorry I've been busy. I'll try to type up an MVP showing the problem asap. But here's a short description: I tried to setup `BeforeEach`, but it wasn't run, because that `if` statement I linked to wasn't entered, since I did not specify any `ProviderStatesSetupURL`

matt.fellows
2019-09-16 23:26
Thanks Marius. It should be the other way around. If you _don?t_ specify that URL, we will do the provider states mapping: https://github.com/pact-foundation/pact-go/blob/master/dsl/pact.go#L345

matt.fellows
2019-09-16 23:26
in any case, if you get around to raising an issue that?d be great. Then we can track it appropriately

marius.maaland
2019-10-01 18:50
Hi @matt.fellows, just wanted to let you know that I haven't forgot about this, I've just had to focus on other things. Will get back to this soon

matt.fellows
2019-10-01 22:26
:+1:

marius.maaland
2019-10-08 23:11
Finally got around to checking this out, thanks for your patience @matt.fellows. The PR looks fine, I don't think we're going to use the self-signed certificate functionality because it provides little extra benefit for our testing. Simply disabling the verification works just fine for us

matt.fellows
2019-10-08 23:11
:+1:

matt.fellows
2019-10-08 23:12
Awesome thanks

matt.fellows
2019-10-08 23:12
I agree

matt.fellows
2019-10-08 23:12
Just driving but will get this in to mainline soon

grzegorz.polek
2019-10-09 14:25
has joined #pact-go

mauricio.galeas
2019-10-09 15:40
has joined #pact-go

mauricio.galeas
2019-10-09 17:44
Hello. I'm new in pact-go. I'm testing the examaples of the pact-go documentation, but appears always the same error. ```2019/10/09 14:34:26 [DEBUG] starting service 2019/10/09 14:34:26 [ERROR] service exec: "pact-mock-service": executable file not found in $PATH 2019/10/09 14:34:26 [DEBUG] waiting for port 55073 to become available 2019/10/09 14:34:36 [ERROR] Expected server to start < 10s. Timed out waiting for Mock Server to start on port 55073 - are you sure it's running? panic: runtime error: invalid memory address or nil pointer dereference```

mauricio.galeas
2019-10-09 17:44
Do you know how to fix this?


mauricio.galeas
2019-10-09 19:23
yes

marius.maaland
2019-10-09 21:20
Is `pact/bin` in your `$PATH` ? `pact-go` does not seem to find `pact-mock-service` so I suspect it might not be

marius.maaland
2019-10-09 21:21
What happens if you run `pact-provider-verifier --help verify` ?

mauricio.galeas
2019-10-09 21:59
You were right. I didn't set the pact/bin correctly, but now i did it. Thx!

marius.maaland
2019-10-09 22:16
:+1:

matt.fellows
2019-10-09 23:01
Thanks Marius!

mauricio.galeas
2019-10-11 17:56
Hello i'm tryng to build a project with pact-go in travis/trusty, but when it starts to run test files this error appears: ```2019/10/11 17:52:57 [ERROR] service: /home/travis/pact/lib/ruby/bin/ruby: line 6: /home/travis/pact/lib/ruby/bin.real/ruby: No such file or directory --- PASS: TestProvider (0.13s)```

mauricio.galeas
2019-10-11 17:56
Is there something missing in travis.yml or my dockerfile?

mauricio.galeas
2019-10-11 18:26
I've fixed the previous error.

matt.fellows
2019-10-14 13:10
FYI `v1.0.0-beta.8` has been released with this included

matt.fellows
2019-10-14 13:10
thanks for your help

matt.fellows
2019-10-14 13:10
probably can release `1.0.0` now :slightly_smiling_face:

marius.maaland
2019-10-14 17:12
Nice! Thank you!

matt.fellows
2019-10-14 21:44
:+1:

matt.fellows
2019-10-14 21:45
Looks like I'll be doing some work on a client that used Go soon, and they are very keen for Pact. So I'll iron out any wrinkles I experience when there

marius.maaland
2019-10-15 21:51
Sounds good :slightly_smiling_face:

srinivasan.anusha
2019-10-28 22:50
has joined #pact-go

matt.fellows
2019-10-31 05:50
First cut at a Pact workshop for Go: https://github.com/pact-foundation/pact-workshop-go Feedback welcome!

mahadi087
2019-11-04 09:20
has joined #pact-go

matt.fellows
2019-11-11 00:14
we have a new feature available to Pact Go to remove the pain point of consumers breaking a provider build with new / changed contracts. If you?d like to opt-in to a beta of this, please DM me.

mauricio.galeas
2019-11-12 21:02
hey. Which is the right way to build a consumer test with a query param?

mauricio.galeas
2019-11-12 21:02
```// Package main contains a runnable Consumer Pact test example. package main import ( "fmt" "log" "net/http" "strings" "testing" "http://github.com/pact-foundation/pact-go/dsl" ) // Example Pact: How to run me! // 1. cd <pact-go>/examples // 2. go test -v -run TestConsumer func TestConsumer(t *testing.T) { type UserOutput struct { Name string `json:"fullname"` Phone string `json:"cellphone"` Gender string `json:"gender"` Country string `json:"country"` Region string `json:"region"` Commune string `json:"commune"` } // Create Pact connecting to local Daemon pact := &dsl.Pact{ Consumer: "consumer", Provider: "prov", Host: "localhost", } defer pact.Teardown() // Pass in test case var test = func() error { u := fmt.Sprintf("http://localhost:%d/api/v1/user/basics?mail=hola@mail.com", pact.Server.Port) req, err := http.NewRequest("GET", u, strings.NewReader(`{"mail":""}`)) // NOTE: by default, request bodies are expected to be sent with a Content-Type // of application/json. If you don't explicitly set the content-type, you // will get a mismatch during Verification. req.Header.Set("Content-Type", "application/json") if err != nil { return err } if _, err = http://http.DefaultClient.Do(req); err != nil { return err } return err } // Set up our expected interactions. pact. AddInteraction(). Given("A user"). UponReceiving("A request to get user"). WithRequest(dsl.Request{ Method: "GET", Path: dsl.String("user/basics?mail=hola@mail.com"), Headers: dsl.MapMatcher{"Content-Type": dsl.String("application/json")}, Body: map[string]string{ "mail": "", }, }). WillRespondWith(dsl.Response{ Status: 200, Headers: dsl.MapMatcher{"Content-Type": dsl.String("application/json")}, Body: dsl.Match(&UserOutput{}), }) // Verify if err := pact.Verify(test); err != nil { log.Fatalf("Error on Verify: %v", err) } fmt.Println("Test Passed!") } ```

mauricio.galeas
2019-11-12 21:03
im using this way but it isnt working prioperly

bethskurrie
2019-11-12 21:05
In other languages, the query params are a separate key

bethskurrie
2019-11-12 21:05
Try "Query".

mauricio.galeas
2019-11-12 21:34
ok, i will try

mauricio.galeas
2019-11-21 20:09
Hello! Which is the best way to retrieve a specific contract from pact-broker without extra information ?

mauricio.galeas
2019-11-21 20:28
I'm currently trying to obtain the "response" tag of a retrieved pact-test, from the broker. But it's pretty messy.

matt.fellows
2019-11-21 22:32
What are you trying to achieve?

gordo
2019-12-09 22:27
has joined #pact-go

bheemreddy181
2019-12-12 23:53
has joined #pact-go

dlmiddlecote
2020-01-12 23:40
has joined #pact-go

mokbat
2020-01-13 20:58
has joined #pact-go

anja.kammer
2020-01-23 12:23
has joined #pact-go

kulik.olenka
2020-03-12 05:18
has joined #pact-go

steffen.vulpius
2020-03-18 00:06
has joined #pact-go

steffen.vulpius
2020-03-18 00:07
Hi, I'm having an issue with the pact workshop. I dont see a pact file being created in step 3.

steffen.vulpius
2020-03-18 00:08
Here is the output (after adding -v and fmt.Println(os.Getenv("PACT_DIR")) in the test): ```--- ?Running Consumer Pact tests go test -v -tags=integration -count=1 http://github.com/pact-foundation/pact-workshop-go/consumer/client -run 'TestClientPact' /home/Steffen/code/pact-workshop-go/pacts 2020/03/17 17:05:28 [INFO] INFO WEBrick 1.3.1 2020/03/17 17:05:28 [INFO] INFO ruby 2.2.2 (2015-04-13) [i386-mingw32] 2020/03/17 17:05:28 [INFO] INFO WEBrick::HTTPServer#start: pid=11104 port=62467 === RUN TestClientPact_GetUser === RUN TestClientPact_GetUser/the_user_exists --- PASS: TestClientPact_GetUser (0.06s) --- PASS: TestClientPact_GetUser/the_user_exists (0.06s) PASS ok http://github.com/pact-foundation/pact-workshop-go/consumer/client 4.179s```

matt.fellows
2020-03-18 00:34
Can you please set the log level to `DEBUG` and run again?

matt.fellows
2020-03-18 02:13
It looks like you might be running in a Windows-like environment, but somehow it seems to start the mock service - so that?s a good start!

matt.fellows
2020-03-18 02:16
There should be a log file somewhere also - if you could dig that up and share that would be ace

tausif2909
2020-03-18 11:37
has joined #pact-go

steffen.vulpius
2020-03-18 17:20
Yes, this is under cygwin.

steffen.vulpius
2020-03-18 17:20
```$ make consumer --- ?Running Consumer Pact tests go test -v -tags=integration -count=1 http://github.com/pact-foundation/pact-workshop-go/consumer/client -run 'TestClientPact' Starting test /home/Steffen/code/pact-workshop-go/pacts 2020/03/18 10:13:47 [INFO] INFO WEBrick 1.3.1 2020/03/18 10:13:47 [INFO] INFO ruby 2.2.2 (2015-04-13) [i386-mingw32] 2020/03/18 10:13:47 [INFO] INFO WEBrick::HTTPServer#start: pid=12612 port=51529 === RUN TestClientPact_GetUser === RUN TestClientPact_GetUser/the_user_exists --- PASS: TestClientPact_GetUser (0.06s) --- PASS: TestClientPact_GetUser/the_user_exists (0.06s) PASS 2020/03/18 10:13:47 [DEBUG] pact setup logging 2020/03/18 10:13:47 [DEBUG] pact setup 2020/03/18 10:13:47 [DEBUG] pact write Pact file 2020/03/18 10:13:47 [DEBUG] mock service write pact 2020/03/18 10:13:47 [DEBUG] teardown 2020/03/18 10:13:47 [DEBUG] client: stop server 2020/03/18 10:13:47 [DEBUG] stopping service with pid 11876 ok http://github.com/pact-foundation/pact-workshop-go/consumer/client 4.177s```

steffen.vulpius
2020-03-18 17:21
I guess the file is written somewhere, but not in the expected place, maybe because its trying to use cygwin path name as a Windows path name?

steffen.vulpius
2020-03-18 17:22
Anyway, I'll set it up on MacOs

matt.fellows
2020-03-18 21:13
Thanks Steffen - given all of that seems to be working fine, I?m also guessing that the pact files will be written somewhere else too!

steffen.vulpius
2020-03-20 20:53
Now that I have it working, the output I get when verifying the provider is different from the doc:

steffen.vulpius
2020-03-20 20:53
```--- ?Running Provider Pact tests go test -count=1 -tags=integration http://github.com/pact-foundation/pact-workshop-go/provider -run "TestPactProvider" 2020/03/20 13:48:06 API starting: port 61622 ([::]:61622) --- FAIL: TestPactProvider (0.90s) pact.go:416: Verifying a pact between GoAdminService and GoUserService Given User sally exists A request to login with user 'sally' with GET /users/10 returns a response which has a matching body user_service_test.go:33: Pact test failed FAIL FAIL http://github.com/pact-foundation/pact-workshop-go/provider 1.129s FAIL make: *** [provider] Error 1```

steffen.vulpius
2020-03-20 20:54
it doesn?t show the diff

matt.fellows
2020-03-20 22:14
yes I?ve seen this issue recently. I think the latest standalone breaks it because of the wey the output

matt.fellows
2020-03-20 22:19
I?ll try and diagnose it today, and will raise an issue to fix it

matt.fellows
2020-03-20 22:19
sorry about this

bethskurrie
2020-03-20 23:31
I didn't think I made a backwards incompatible change, but let me know if you need something fixed @matt.fellows

matt.fellows
2020-03-20 23:39
It was the change that sent output from stdout to stderr or something like that.

matt.fellows
2020-03-20 23:40
I'll fix it on the go side because I think that's where it belongs. I need to look a bit more carefully though and will let you know what I find

bethskurrie
2020-03-20 23:46
There might have been an unintentional release while we were working out the right format.

matt.fellows
2020-03-21 00:02
@bethskurrie so just got home from swimming and did a quick test (outside of go). Start a web server on a port so you get passed the connection refused erors (e.g. `python -m http.server 8080` (python 3) or `python -m SimpleHTTPServer` (python 2), then point your verifier at any old pact file with the json formatter enabed: ``` ./pact/bin/pact-provider-verifier -f json --provider-base-url http://localhost:8080 ./examples/pacts/consumer-httpbin.json | jq .```

matt.fellows
2020-03-21 00:04
With the JSON formatter, neither in stdout/stderr do you get the formatted diffs. This used to be the case, but seems to have disappeared. Current version of the verifier from latest standalone is `1.30.0` . But I?m pretty sure the regression came in a few releases ago

matt.fellows
2020-03-21 00:07
I think the mismatches has the info I need, but doesn?t pretty-print it

bethskurrie
2020-03-21 00:52
Hm I don't remember changing that.

bethskurrie
2020-03-21 00:53
I'll have a look this afternoon.

bethskurrie
2020-03-21 01:29
Looks like the exception has disappeared.

bethskurrie
2020-03-21 02:04
@matt.fellows 1.82.1

bethskurrie
2020-03-21 02:05
It was a while ago that disappeared. I hadn't realised that go was relying on that part of the json for the mismatches, and I'd removed it because of the noise of the backtrace.

matt.fellows
2020-03-21 02:16
I'll have a look but I'm fairly confident we weren't using a JSON field to print the failure - it was in stderr/stdout somewhere and we just printed it verbatim

matt.fellows
2020-03-21 02:16
Let me confirm, I've just put toddler down for a nap and will jump online in 5

bethskurrie
2020-03-21 02:17
I didn't think it supported doing json to file and stdout as well.

bethskurrie
2020-03-21 02:19
Using git@github.com:pact-foundation/pact-ruby-standalone-e2e-example.git is the easiest way to go back in time.

bethskurrie
2020-03-21 02:19
set the standalone version in script/install.sh

matt.fellows
2020-03-21 02:23
thanks

matt.fellows
2020-03-21 02:23
Online now, will give it a ~go~ Go

matt.fellows
2020-03-21 02:33
OK whatever you did fixed it. I?ll look at the diff shortly

bethskurrie
2020-03-21 02:33
I put the exception back in.

matt.fellows
2020-03-21 02:33
Is that in the JSON document?

bethskurrie
2020-03-21 02:33
yes

matt.fellows
2020-03-21 02:33
Cool. Let me just see what we?re doing to make sure it?s sensible

matt.fellows
2020-03-21 02:37
ok cool yep, we were just printing `example.Exception.Message` - so thanks for adding it back in. I recalled a while back me doing some magic on the strings in `stderr`/`stdout` and hence my initial suspicion. The only magic now is the JSONL formatted parsing of `stdout` that goes on to get the JSON.

matt.fellows
2020-03-21 02:37
thanks for fixing so quickly

bethskurrie
2020-03-21 02:41
np

matt.fellows
2020-03-21 02:43
@steffen.vulpius delete the `./pact` folder in the workshop and try running the step again. It should automatically pull down the latest standalone with a fix for that message. Thanks for raising it!

steffen.vulpius
2020-03-21 20:40
Cool. I'll reinstall it. I setup pact broker locally and have a python client publishing to a Go service. Can't wait to demo it to my org next week.

braddle
2020-03-25 11:47
Is there a way to make the example content for Errors empty for this struct?? ```type Status struct { Status string `json:"status" pact:"example=OK"` Errors []string `json:"errors"` }``` I am looking for something like this: ```{ "status": "OK, "errors": [] }```

matt.fellows
2020-03-25 11:49
hmm that is an interesting question.

matt.fellows
2020-03-25 11:49
Also, hello there - long time no speak!

braddle
2020-03-25 11:53
Hi, How are you doing?

rbenbolton
2020-03-26 22:56
has joined #pact-go

matt.fellows
2020-04-20 12:29
Sorry, I ended up going to bed - late night. Did I see that you?d moved on from Sainos?

bheemreddy181
2020-04-20 21:12
Hey , Pact Gophers - How dow you handle a session based authorization on a API while verifying contracts on the provider Example : there is a session API which is used to create a token and that token is an Authorization for another request API , and that session lasts only for some time

matt.fellows
2020-04-20 23:32
:wave:

matt.fellows
2020-04-20 23:32
I usually replace any tokens with a valid token using request filters https://github.com/pact-foundation/pact-go#request-filtering

matt.fellows
2020-04-20 23:33
Step 8-10 cover off this exact scenario. See https://github.com/pact-foundation/pact-workshop-go/tree/step10 for the solution to the problem

bheemreddy181
2020-04-21 00:42
@matt.fellows@matt.fellows@matt.fellows will I be able to do this for each state say good state where the session is valid and invalid state where the session is invalid some thing like that ?

matt.fellows
2020-04-21 00:46
of course

bheemreddy181
2020-04-21 00:47
Typically in the state handlers directly

matt.fellows
2020-04-21 00:47
you can handle that in many ways - state handlers are the main one though

matt.fellows
2020-04-21 00:47
yes

bheemreddy181
2020-04-21 00:52
If you have any example can you share the same ?

matt.fellows
2020-04-21 00:53
The example above does this, does it not?

bheemreddy181
2020-04-21 00:53
The above example adds it to all requests which is slightly different from our case

matt.fellows
2020-04-21 00:54
So use the state handlers to set a variable that the request filter uses

matt.fellows
2020-04-21 00:54
and then the request filter can act conditionally on the state

bheemreddy181
2020-04-21 00:54
Ah got it may be I am understand you let me give a try

bheemreddy181
2020-04-23 14:57
I am slightly confused matt here , can we append request filters from the state handlers ?

matt.fellows
2020-04-23 23:14
No, the request filter is a function that has to be declared in advance of running the verification. That function can close over variables however in the outer scope (e.g. a top-level test variable like `var authorization bool` ). You could then use the state handlers to enable/disable authorization by setting the value to what you need

matt.fellows
2020-04-23 23:14
make sense?

bheemreddy181
2020-04-24 01:55
the idea is the authorization header value changes based on the endpoint what we test , for one API thee header value is static where as for other API the value is dynamic , the dynamic value is what we want to override in the statehandlers

bheemreddy181
2020-04-24 01:55
@matt.fellows ^

bheemreddy181
2020-04-24 01:56
Typically the value for the Dynamic API is generated from static API endpoint basically its all session based

bheemreddy181
2020-04-24 01:59
here is an example what we trying , we haven?t tested this but ```func (suite *FunctionalTestSuite) TestProvider() { token, err := uuid.NewUUID() if err != nil { suite.FailNow(err.Error()) } suite.authToken = token f := func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if strings.Contains(r.RequestURI, "requests") { r.Header.Add("Authorization", suite.authToken.String()) next.ServeHTTP(w, r) } }) } // Verify the Provider - Tag-based Published Pacts for any known consumers _, err = suite.pact.VerifyProvider(suite.T(), types.VerifyRequest{ ProviderBaseURL: os.Getenv("PACT_BASE_URL"), Tags: []string{"master", "prod"}, FailIfNoPactsFound: true, BrokerURL: os.Getenv("PACT_BROKER_URL"), BrokerUsername: os.Getenv("PACT_BROKER_USERNAME"), BrokerPassword: os.Getenv("PACT_BROKER_PASSWORD"), BrokerToken: os.Getenv("PACT_BROKER_TOKEN"), PublishVerificationResults: true, StateHandlers: suite.getPactStateHandlers(), RequestFilter: f, }) if err != nil { suite.FailNow(err.Error()) } } func (suite *FunctionalTestSuite) getPactStateHandlers() types.StateHandlers { return types.StateHandlers{ "a session exists for requests API ": func() error { _, err := persistSession(exampleSession(), suite.authToken) if err != nil { return err } return nil }, } }```

bheemreddy181
2020-04-24 02:00
if you look at the statehandlers here we are trying to persist the token what we are passing in the RequestFilter for Authorization

matt.fellows
2020-04-24 02:34
ok, so what?s the question exactly?

matt.fellows
2020-04-24 02:34
I can?t validate that your code works obviously, but something like that should work

matt.fellows
2020-04-24 02:34
you have all of the tools you need to modify the request based on a state handler.

matt.fellows
2020-04-24 02:35
> Typically the value for the Dynamic API is generated from static API endpoint basically its all session based Do you mean you have to go out to another API to get the session value? You may want to consider mocking that component out


bheemreddy181
2020-04-24 03:47
Will give a try for sure , the reason I shared the implementation is to check whether is this the recommended way to implement this or is there a better way for this

matt.fellows
2020-04-24 03:50
No probs!

matt.fellows
2020-04-24 03:51
So I don?t fully appreciate the authentication layers going on in the app, but what you?re doing there looks fine to me

matt.fellows
2020-04-28 01:15
How?d you go @bheemreddy181?

bheemreddy181
2020-04-28 01:18
It is going good just that the examples were slightly confusing - ruby implementation was quite straight forward compared to Go, same with setup as well

matt.fellows
2020-04-28 06:13
what?s confusing about the examples? Happy to update them

marko.justinek
2020-04-29 02:06
has joined #pact-go

bheemreddy181
2020-04-30 01:38
Mainly interms of spinning up the application for running pact tests , major Go Application just serve the HTTP requests user mux router they don?t spin up the app on local host.

bheemreddy181
2020-04-30 01:39
we don?t have file structure like this ```go test -count=1 -tags=integration http://github.com/pact-foundation/pact-workshop-go/provider -run "TestPactProvider"``` how do we run tests when the file structure is really flat ? and we all use GO MODS

matt.fellows
2020-04-30 01:48
> Mainly interms of spinning up the application for running pact tests , major Go Application just serve the HTTP requests user mux router they don?t spin up the app on local host. (edited) I would like to add support for that. It shouldn?t actually be very hard, but at the moment, starting it up shouldn?t be terribly difficult

matt.fellows
2020-04-30 01:48
> how do we run tests when the file structure is really flat ? and we all use GO MODS That?s up to you. I can?t answer how you want to structure your tests. It?s very common to use build tags, if you don?t want to use build tags, remove the tags

bheemreddy181
2020-04-30 01:50
Even Developers are taking longer time for setting up pact either on provider and consumer the examples help a lot but more documentation should help

matt.fellows
2020-04-30 01:52
The workshop using `go mod`, so that shouldn?t be an issue - have you looked at that?

matt.fellows
2020-04-30 01:52
We?ve found that more documentation doesn?t necessarily help, it would be great to know what challenges they have specifically, and then we can address that

matt.fellows
2020-04-30 01:52
I?d very much suggest they all run the workshop first

matt.fellows
2020-04-30 01:52
It?s very detailed, and covers of 99% of what you normally need to do

bheemreddy181
2020-04-30 01:55
Sounds good we are giving our best to understand the tests , the setup is slightly different from Examples to our Applications. I will ask my dev to ask questions here

bheemreddy181
2020-04-30 01:56
Does holding a go protobuf registry ( which holds all the schema for multiple services ) as a library for a group of services eliminate Contract Tests ?

bheemreddy181
2020-04-30 01:58
The Schema defined in the library is used by multiple services , typically everyone should use the same package and import schema from it and fill the data and emit messages out

matt.fellows
2020-04-30 02:07
See https://pact.canny.io/feature-requests/p/support-grpc and the protobufs feature. Keen for more feedback (but the short answer I think is ?no?)

bheemreddy181
2020-04-30 20:58
Is there a way we can read request headers in State Handlers for Go Implementation ? Our use case is more like we want session passed in as header for an API and store that in the DB ( for Authorization ) before verifying the request

matt.fellows
2020-04-30 22:04
Request filter is the only opportunity to read from or modify a request. Can't you create the session header from a state handler, and then inject it using a request filter?

matt.fellows
2020-04-30 22:05
If not, I'd recommend just not including authorization in your tests because it is sounding like you're making it too complicated. It shouldn't be the case

bheemreddy181
2020-04-30 23:01
the idea was we want to keep a session sitting in thee contract file and then use that session in the state handlers to persist in the db , as you said it is getting complicated

matt.fellows
2020-04-30 23:05
when you say ?session in the contract files? what do you mean? A long lived session? How long will the session be valid for?

matt.fellows
2020-04-30 23:05
It all sounds like a recipe for confusion and unmaintainable tests, if you ask me

matt.fellows
2020-04-30 23:05
I?d start to question the value of including auth in pact tests if you can?t make it more simple (and also, if your auth need be this complicated in the first place)

matt.fellows
2020-04-30 23:06
presumably, auth is common to all of your services. So in that case, you could fallback to other types of tests (good functional coverage on the provider, and any synthetic/smoke tests for consumers)

matt.fellows
2020-04-30 23:07
FWIW it usually isn?t this hard, so my instincts are telling me something else is wrong - e.g. the code base isn?t modular enough to deal with it etc.

bheemreddy181
2020-04-30 23:17
makes sense , i will move away the auth from contract and just handle them directly in state handlers

bheemreddy181
2020-04-30 23:17
Another Question @matt.fellows

bheemreddy181
2020-04-30 23:18
is this a right matcher for matching on string ? ``` }, "response": { "status": 200, "headers": { "Content-Type": "application/json; charset=utf-8" }, "body": { "request": { "id": "4c8e646e-2e19-4796-81ea-c1ec5f45d156" }, "matchingRules": { "$.body.request.id": { "match": "type" } } } } } ], "metadata": { "pactSpecification": { "version": "2.0.0" } }```

bheemreddy181
2020-04-30 23:19
like the response body.request.id needed to be a string and can be anything assume my consumer has written some wrong matchers i feel

matt.fellows
2020-04-30 23:27
Yep, that is a string matcher in this case. Is the request id supposed to be a string or something else?

bheemreddy181
2020-04-30 23:27
string only

bheemreddy181
2020-04-30 23:29
Error ```Description of differences -------------------------------------- * Expected a Hash (like {"request"=>{"id"=>"4c8e646e-2e19-4796-81ea-c1ec5f45d156"}, "matchingRules"=>{"$.body.request.id"=>{"match"=>"type"}}}) but got a String ("{\"request\":{\"id\":\"e8393004-8b37-11ea-9596-dca90488bbb8\",\"type\":\"access\",\"status\":\"initial\",\"error\":\"\"}}") at $```

bheemreddy181
2020-04-30 23:29
Ah i think a header is missing for this

matt.fellows
2020-04-30 23:29
I think you need to set the `content-type` header

bheemreddy181
2020-04-30 23:32
i have that actually

matt.fellows
2020-05-01 00:04
What?s the response type from the API?

matt.fellows
2020-05-01 00:04
The matching library is getting a content type that?s not JSON, so it?s interpreting the result as a string

matt.fellows
2020-05-01 00:05
so maybe just check that

bheemreddy181
2020-05-01 00:06
ok will check that

bheemreddy181
2020-05-01 00:07
Another question when ever we have multiple clients using the same API , does that mean we write multiple TestProvider https://github.com/pact-foundation/pact-go/blob/master/examples/provider_test.go#L22 each with its own provider consumer config and its own request filters ?

bheemreddy181
2020-05-01 00:08
I mean more like multiple Consumer Combination

matt.fellows
2020-05-01 00:11
No, just one provider test is all that is required, and you fetch all contracts registered for that provider

matt.fellows
2020-05-01 00:11
Haven?t you done this with Ruby already?

kaypee90
2020-05-01 00:19
has joined #pact-go

bheemreddy181
2020-05-01 00:19
For ruby we have done only one combo , but we provide the consumer name as part of the rake JOB

bheemreddy181
2020-05-01 00:20
I see that we provider the combo like this while doing the setup ```suite.pact = &dsl.Pact{ Consumer: os.Getenv("CONSUMER_NAME"), Provider: os.Getenv("PROVIDER_NAME"), LogLevel: "INFO", }```

bheemreddy181
2020-05-01 00:20
does this mean i do the same for other combinations ?

matt.fellows
2020-05-01 00:31
the consumer is not required on the provider side verification

matt.fellows
2020-05-01 00:33
I?ll update the readme, that?s not very clear I?m sorry

bheemreddy181
2020-05-01 00:44
Oh cool thanks

bheemreddy181
2020-05-01 00:46
Here is an issue what i am seeing @matt.fellows , for some reason i have to append and header while writing response thats ok i will check with dev why thats happening . but if you look at the below response even with a matcher it is trying to match the exact value ``` { "request": { - "id": "4c8e646e-2e19-4796-81ea-c1ec5f45d156" - }, - "matchingRules": { - "$.body.request.id": { - "match": "type" - } + "id": "87eb23f8-8b44-11ea-9602-dca90488bbb8" } } Description of differences -------------------------------------- * Expected "4c8e646e-2e19-4796-81ea-c1ec5f45d156" but got "87eb23f8-8b44-11ea-9602-dca90488bbb8" at $.request.id * Could not find key "matchingRules" (keys present are: request) at $```

matt.fellows
2020-05-01 00:47
hangon, how did the matching rules get added to the `body`? Are you hand coding the pact?

bheemreddy181
2020-05-01 00:48
nope thats not the body let me share the pact file

bheemreddy181
2020-05-01 00:48
```{ "consumer": { "name": "consumer" }, "provider": { "name": "provider" }, "interactions": [ { "description": "a request for request creation", "providerState": "a session exists for requests API", "request": { "method": "post", "path": "/public-api/requests", "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "4c8e646e-2e19-479s6-81ea-c1ec5f45d156" }, "body": { "request_type": "access" } }, "response": { "status": 200, "headers": { "Content-Type": "application/json; charset=utf-8" }, "body": { "request": { "id": "4c8e646e-2e19-4796-81ea-c1ec5f45d156" }, "matchingRules": { "$.body.request.id": { "match": "type" } } } } } ], "metadata": { "pactSpecification": { "version": "2.0.0" } } }```

matt.fellows
2020-05-01 00:50
the error message above is 100% looking for a field called `matchingRules` in the body.

matt.fellows
2020-05-01 00:50
it?s also a child of `body` in the message you just pasted

matt.fellows
2020-05-01 00:51
It seems to me somebody has manually modified that Pact file, or is using a broken pact consnumer code

bheemreddy181
2020-05-01 00:51
Oh ok which is weird let me generate a new PACT file then and test with that

matt.fellows
2020-05-01 00:54
I?m in meetins for the next few hours - good luck!

bheemreddy181
2020-05-01 00:54
thanks for helping

bheemreddy181
2020-05-01 12:42
i assume there is an issue with `pact-support gem 1.14.3` where it is not able to read the pact file with a matcher from pact broker ```2020/05/01 07:37:56 [DEBUG] executing after hook 2020/05/01 07:37:56 [DEBUG] teardown --- FAIL: TestFunctionalTestSuite (3.40s) --- FAIL: TestFunctionalTestSuite/TestProvider (3.39s) contract_test.go:59: Error Trace: contract_test.go:59 Error: Expected nil, but got: &errors.errorString{s:"error verifying provider: exit status 1\n\nSTDERR:\nINFO: Fetching pacts for provider_name from http://pact-broker-poc.dev.com for tags: latest master\nINFO: Reading pact at http://pact-broker-poc.dev.com/pacts/provider/provider_name/consumer/consumer_name/version/1.0.0\nError reading file from \nNo such file or directory @ rb_sysopen - /Users/bvennapureddy/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.14.3/lib/pact/consumer_contract/pact_file.rb:51:in `read'\n/Users/bvennapureddy/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.14.3/lib/pact/consumer_contract/pact_file.rb:51:in `get_local'\n/Users/bvennapureddy/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.14.3/lib/pact/consumer_contract/pact_file.rb:41:in `render_pact'\n/Users/bvennapureddy/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.14.3/lib/pact/consumer_contract/pact_file.rb:22:in `read'\n/Users/bvenn``` the same pact file works when i reference it from my local using PACT_URL?s , correct me if i am wrong

bheemreddy181
2020-05-01 12:45
i am using CURL command to push contracts to broker manually which is something like this ```curl -v -XPUT \-H "Content-Type: application/json" -d@consumer_name-provider_name.json http://pact-broker-poc.dev.com/pacts/provider/provider_name/consumer/consumer_name/version/1.0.0```

bheemreddy181
2020-05-01 12:53
below is how my provider setup looks like ```// Verify the Provider - Tag-based Published Pacts for any known consumers _, err := suite.pact.VerifyProvider(suite.T(), types.VerifyRequest{ AfterEach: func() error { suite.pact.Teardown() return nil }, ProviderBaseURL: fmt.Sprintf("http://127.0.0.1:%d", port), PactURLs: []string{os.Getenv("PACT_URL")}, Tags: []string{"master"}, FailIfNoPactsFound: true, BrokerURL: fmt.Sprintf(os.Getenv("PACT_BROKER_URL")), PublishVerificationResults: canIPublishResultsToBroker(suite), ProviderVersion: os.Getenv("TRAVIS_PULL_REQUEST_SHA"), StateHandlers: suite.getPactStateHandlers(), RequestFilter: updateIncomingRequestHeaders, })```

matt.fellows
2020-05-01 12:56
You need to configure the test to use the broker properties, not pact URLs

matt.fellows
2020-05-01 12:56
See examples in repo

bheemreddy181
2020-05-01 12:57
without matcher in the pact file this works fine for some reason

bheemreddy181
2020-05-01 12:57
will check that

matt.fellows
2020-05-01 12:57
That doesn't sound right to me

bheemreddy181
2020-05-01 12:58
Actually i am using both

bheemreddy181
2020-05-01 12:59
the reason you see PACT_URL above is my consumer triggered provider CI build will pass a PACT_URL where as provider PR verification will directly pull master contract from pact broker

bheemreddy181
2020-05-01 12:59
using broker properties like the BROKER_URL

bheemreddy181
2020-05-01 13:00
the setup is done this way because we want to use the same configuration for both ( Consumer initiated CI build vs PROVIDER initiated CI build )

bheemreddy181
2020-05-01 13:01
if there is PACT_URL pull that pact file else pull the master PACT from the broker for all consumers

bheemreddy181
2020-05-01 13:03
if i use the pact file from local ( bare metal ) reference this setup works fine , i see a problem only when i am pulling this pact file from the broker

matt.fellows
2020-05-01 13:03
Seems highly unlikely, but if you can prove that that needs to be fixed!

bheemreddy181
2020-05-01 13:22
either the error logging is not correct i feel , hard to debug whats wrong here , i tried a pact file from broker without a matcher i see the below logs ```2020/05/01 08:15:50 [DEBUG] teardown --- FAIL: TestFunctionalTestSuite (3.06s) --- FAIL: TestFunctionalTestSuite/TestProvider (2.96s) --- FAIL: TestFunctionalTestSuite/TestProvider/has_a_matching_body (0.00s) pact.go:622: Verifying a pact between consumer_name and provider_name Given a session exists for requests API request to create a request with POST /public-api/requests returns a response which has a matching body pact.go:628: Verifying a pact between consumer_name and provider_name Given a session exists for requests API request to create a request with POST /public-api/requests returns a response which has a matching body Actual: {"request":{"id":"e0e0b432-8bad-11ea-b94f-dca90488bbb8","type":"access","status":"initial","error":""}} Diff -------------------------------------- Key: - is expected + is actual Matching keys and values are not shown { "request": { - "id": "4c8e646e-2e19-4796-81ea-c1ec5f45d156" + "id": "e0e0b432-8bad-11ea-b94f-dca90488bbb8" } } Description of differences -------------------------------------- * Expected "4c8e646e-2e19-4796-81ea-c1ec5f45d156" but got "e0e0b432-8bad-11ea-b94f-dca90488bbb8" at $.request.id contract_test.go:60: Error Trace: contract_test.go:60 Error: Expected nil, but got: &errors.errorString{s:"error verifying provider: exit status 1\n\nSTDERR:\nINFO: Fetching pacts for datacompliance from http://pact-broker-poc.dev.com for tags: latest master\nINFO: Reading pact at http://pact-broker-poc.dev.com/pacts/provider/provider_name/consumer/consumer_name/version/1.0.0\nError reading file from \nNo such file or directory @ rb_sysopen - /Users/bvennapureddy/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.14.3/lib/pact/consumer_contract/pact_file.rb:51:in `read'\n/Users/bvennapureddy/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.14.3/lib/pact/consumer_contr```

bheemreddy181
2020-05-01 13:23
which also has ```Reading pact at http://pact-broker-poc.dev.com/pacts/provider/provider_name/consumer/consumer_name/version/1.0.0\nError reading file from \nNo such file or directory @ rb_sysopen - /Users/bvennapureddy/pact/lib/vendor/ruby/2.2.0/gems/pact-support-```

matt.fellows
2020-05-01 13:34
Can you please set log level to debug and share that? I suspect a configuration issue

matt.fellows
2020-05-01 13:34
It is confusing tho getting a response and that error

bheemreddy181
2020-05-01 13:35
Can i DM you the logs or paste it here ?

matt.fellows
2020-05-01 13:45
What happens if you comment out pact_urls ?

matt.fellows
2020-05-01 13:45
I think you're passing in an empty string

matt.fellows
2020-05-01 13:47
Hence why it's says can't read file <blank>

matt.fellows
2020-05-01 13:47
(sorry I'm on a mobile)

bheemreddy181
2020-05-01 13:48
giving a try

bheemreddy181
2020-05-01 13:50
Ah that worked , is there a way we can support this ?

matt.fellows
2020-05-01 13:53
What do you mean?

matt.fellows
2020-05-01 13:53
Don't supply an empty string in that value

matt.fellows
2020-05-01 13:54
I.e. Ensure PACT_URLS slice is empty

matt.fellows
2020-05-01 13:54
Have to run but sounds like you're back on track

bheemreddy181
2020-05-01 13:59
Can we improve the logging when there are errors ?

dan.h.lee329
2020-05-02 01:54
has joined #pact-go

bheemreddy181
2020-05-03 15:23
I was able to successfully do a pact provider setup for one of our GO applications thanks a ton Matt for the help

bheemreddy181
2020-05-03 18:29
while publishing the results from the CI , i don?t see the provider tags are being set correctly , we are passing in the branch names as a reference , but the broker UI doesn?t show up anything

bheemreddy181
2020-05-03 19:03
this is how verify provider looks like ```// Verify the Provider - Tag-based Published Pacts for any known consumers _, err := suite.pact.VerifyProvider(suite.T(), types.VerifyRequest{ AfterEach: func() error { suite.pact.Teardown() return nil }, ProviderBaseURL: fmt.Sprintf("http://127.0.0.1:%d", port), // Consumer initiated CI build will have PACT URL with a specific pact PactURLs: setPACTURL(), Tags: []string{"master"}, FailIfNoPactsFound: true, BrokerURL: fmt.Sprintf(os.Getenv("PACT_BROKER_URL")), PublishVerificationResults: canIPublishResultsToBroker(), ProviderVersion: getProviderVersion(), StateHandlers: suite.getPactStateHandlers(), RequestFilter: updateIncomingRequestHeaders, ProviderTags: []string{os.Getenv("BRANCH")}, })``` i could see there is BRANCH variable on my CI as well


matt.fellows
2020-05-03 23:16
The docs there could probably be updated, but that file is for internal use only anyway

matt.fellows
2020-05-03 23:16
The flag is passed in `types/verify_request.go`

matt.fellows
2020-05-03 23:17
In `debug` log level, you should see the arguments passed to the standalone CLI. If `--provider-version-tag` is not being said, there may be an issue (or latest standalone tools not installed)

bheemreddy181
2020-05-04 00:04
i don?t see that in the debug log level ``` starting verification service with args: [--format json --provider-base-url http://localhost:63819 --provider-states-setup-url http://localhost:63819/__setup --pact-broker-base-url http://pact-broker-poc.dev.com --provider_app_version 1.0.0 --provider providername --consumer-version-tag master]```

bheemreddy181
2020-05-04 00:10
Do you know which standalone had this issue and in which version it was fixed

matt.fellows
2020-05-04 00:34
ok so something else is amisse

matt.fellows
2020-05-04 00:34
can you please print out `os.Getev("BRANCH")`

matt.fellows
2020-05-04 00:34
it doesn?t look to be an issue with the standalone, it looks like an issue with pact go

bheemreddy181
2020-05-04 00:35
yes i did the value exists

matt.fellows
2020-05-04 00:36
:thought_balloon:

bheemreddy181
2020-05-04 00:43
I even tried with a hardcoded value i see the same issue

matt.fellows
2020-05-04 00:43
which version of pact go?

bheemreddy181
2020-05-04 00:44
```v1.3.0```

matt.fellows
2020-05-04 00:51
ta

matt.fellows
2020-05-04 01:16
I?ve found the issue - just pushed up a change now. Can you pull latest (not tagged) to see if that works?

bheemreddy181
2020-05-04 01:19
i just saw a new commit , Sure will check that

bheemreddy181
2020-05-04 01:26
Perfecto that worked :slightly_smiling_face:

bheemreddy181
2020-05-04 01:27
why is verbose variable deprecated

matt.fellows
2020-05-04 01:40
It?s a long answer, but basically because it?s incompatible with the way the current Go package works

matt.fellows
2020-05-04 01:41
It?s been deprecated for at least a year I think

matt.fellows
2020-05-04 01:41
released `1.4.0`

bheemreddy181
2020-05-04 01:51
thanks :slightly_smiling_face:

matt.fellows
2020-05-04 01:51
no probs! Thanks for picking up the issue

bheemreddy181
2020-05-04 15:28
How do we do a no_op in state handlers in go similar to ruby ? https://github.com/pact-foundation/pact-ruby/wiki/Provider-states#provider-codebase

dan.h.lee329
2020-05-04 16:53
I've notice that `GraphQLInteraction` is implemented for `pact-js`, but not `pact-go`. No one has submitted an enhancement request so far, is there a roadmap to bring this feature into `pact-go` ? I can submit the request if not planned yet, thanks!

matt.fellows
2020-05-04 21:49
Just pass in a function that doesn't return an error

matt.fellows
2020-05-04 21:49
PR/feature request welcome!

bheemreddy181
2020-05-04 22:00
Is there any documentation about Work in progress pacts , i couldn?t find it

matt.fellows
2020-05-04 22:01
It's documented on the readme

bheemreddy181
2020-05-04 22:07
Sorry i missed that

bheemreddy181
2020-05-06 02:34
Quick Question Team , understanding pending pacts https://github.com/pact-foundation/pact-go/blob/master/README.md#pending-pacts what does this mean ? ```It does so by flagging the contract as "unverified" in the Pact Broker the first time a contract is published``` Do we need to manually unverify the pact using an API ?

matt.fellows
2020-05-06 02:36
> It does so by flagging the contract as ?unverified? in the Pact Broker *the first time a contract is published* does that answer your question?

matt.fellows
2020-05-06 02:36
I?ve bolded the part that should answer it :wink:

matt.fellows
2020-05-06 02:37
(short answer is no)

bheemreddy181
2020-05-06 02:41
you mean tagging the contract as `unverified` rather than tagging it as `master` ? i am slightly confused

matt.fellows
2020-05-06 02:42
you don?t do anything, when the pact is published the broker automatically detects that the contract has or hasn?t been seen before and internally marks it as ?pending? or not

matt.fellows
2020-05-06 02:43
when provider verificaction happens, if the verification passes it transitions out of pending and is now a real contract that will break builds (see the original article that talks about the caveats around tagging etc.)

matt.fellows
2020-05-06 02:44
if the verification fails, the `can-i-deploy` check for the consumer will fail, because the provider has not yet verified it

bheemreddy181
2020-05-06 02:48
Ah ok , that depends on if provider enabled `EnablePending: true` which will automatically set the verifications results to true even though the contract is failed / not verified - we are not using `can-i-deploy` actually

bheemreddy181
2020-05-06 02:57
thanks for the explanation

matt.fellows
2020-05-06 02:58
> verifications results to true No, the verification results are still sent back to the broker that the verification failed, and the reasons why (so in Pactflow you can see why the verification failed, which fields were impacted etc.). It just returns a local exit status of `0`

matt.fellows
2020-05-06 02:59
So if you?re not using `can-i-deploy` you?ll need a way to check if the consumer is compatible with the provider - otherwise you might release something the provider does not yet support

bheemreddy181
2020-05-06 03:00
We are using http://blog.pact.io/2018/07/16/publishing-pact-verification-statuses-to-github/ feature actually which will replace `can-i-deploy`

bheemreddy181
2020-05-06 03:02
```if the verification fails, the can-i-deploy check for the consumer will fail, because the provider has not yet verified it``` this more looks like feature branch based implementation

matt.fellows
2020-05-06 03:02
why?

bheemreddy181
2020-05-06 03:02
we don?t want the consumer build to be blocked until the provider actually implements the feature

matt.fellows
2020-05-06 03:03
sure, so how do you have a feature in master that is going to production that relies on an API that doesn?t yet exist?

bheemreddy181
2020-05-06 03:06
Steps we are following now is 1. Consumer pushes contracts first to branch and then pushes them to master ( Typically only writes tests first ) feature is switched off 2. Provider implements the feature by looking at the contracts ( Test Driven Development ) may be 3. Once Provider successfully implements the feature thats when we will ask the Consumer to Switch on the feature and we will enable the Git Status Checks

bheemreddy181
2020-05-06 03:07
I assume here for time being if we don?t enable Git Status Checks that should fill this use case , but correct me if i am wrong

morten.hekkvang
2020-05-07 10:25
has joined #pact-go

pyasi
2020-05-08 13:48
has joined #pact-go

morten.hekkvang053
2020-05-10 08:40
has joined #pact-go

bheemreddy181
2020-05-10 21:09
I don?t see this happening i still see the jobs exits with a status `1` this is how my provider setup looks like ```// Verify the Provider - Tag-based Published Pacts for any known consumers _, err := suite.pact.VerifyProvider(suite.T(), types.VerifyRequest{ AfterEach: func() error { suite.pact.Teardown() return nil }, ProviderBaseURL: fmt.Sprintf("http://127.0.0.1:%d", port), // Consumer initiated CI build will have PACT URL with a specific pact //PactURLs: setPACTURL(), PactURLs: []string{"pact.json"}, //Tags: []string{"master"}, FailIfNoPactsFound: true, //BrokerURL: fmt.Sprintf(os.Getenv("PACT_BROKER_URL")), PublishVerificationResults: canIPublishResultsToBroker(), StateHandlers: suite.getPactStateHandlers(), RequestFilter: updateIncomingRequestHeaders, // https://github.com/pact-foundation/pact-go/blob/master/README.md#pending-pacts // even if we get new contracts which is not implemented in case as we are doing parallel development. This flag will mark Provider CI Green EnablePending: true, // These below two are used to tag the provider version and the reference branch for each verification ProviderVersion: getProviderVersion(), ProviderTags: setProviderTags(), })```

bheemreddy181
2020-05-10 21:12
Another thing i spotted here is if i have local pact which i am referring to , with `BrokerURL`it doesn?t pick the local pact rather refers to the broker

bheemreddy181
2020-05-10 21:13
Doesn?t pactUrl array takes the precedence over the brokerURL ?

bheemreddy181
2020-05-10 23:29
I don?t think this works as expected more details in the thread

matt.fellows
2020-05-10 23:31
So two things. You currently need to be using Pactflow for pending pacts (we often test out new features this way). It was mentioned previously but not clear in the readme. I'll update that

matt.fellows
2020-05-10 23:32
The second part I'm not sure off the top of my head the precedence rules. I would just set the right properties dynamically rather than specifying both

bheemreddy181
2020-05-10 23:37
Another quick question , go test suite only tells that there are only two things getting validated when ever i run my test 1. has a matching body 2. validating the headers Does this mean it is not validating the status code( like whether its 200 or not ) of the response , Can we output the logs when the validation is successful which we don?t do right now

matt.fellows
2020-05-10 23:57
hmm that doesn?t look right to me

matt.fellows
2020-05-11 00:02
I?ll check the example output in the project, it should definitely show all assertions, including status codes

bheemreddy181
2020-05-11 00:08
when you pactflow does that mean we should use broker instance of pact flow ?

matt.fellows
2020-05-11 00:09
Correct, if you?re self hosting a broker it won?t yet work

bheemreddy181
2020-05-11 00:10
hmmm :disappointed: is there any other way we can achieve this with self hosted broker ? this will not work even with a local pact ?

matt.fellows
2020-05-11 00:11
local pact?

matt.fellows
2020-05-11 00:11
Not yet I?m afraid. Let me find the public issue/feature request

matt.fellows
2020-05-11 01:17
@bheemreddy181 https://pact.canny.io/feature-requests/p/pending-pacts-prevent-consumers-being-able-to-break-provider-builds-with-changed. Apologies it wasn?t clear earlier. People seemed to know about the pending/WIP pacts but from other sources so assumed everyone knew we were rolling it out slowly

bheemreddy181
2020-05-11 01:23
Thanks for supporting and maintaining the open source version. By when in general I can expect this feature I assumed so it is available and we planned things accordingly but ya have to change those now

matt.fellows
2020-05-11 01:29
Thanks Bheem

matt.fellows
2020-05-11 01:30
I?m not sure I understand the question. Is there a few parts - when will it be generally available? I can?t answer that yet, but once we have fully support across languages and we?ve ironed out any basic kinks, we?ll roll it into the OSS broker for broad consumption

matt.fellows
2020-05-11 01:31
This might be a month or so, but can?t say for sure. We roll things out to Pactflow first, because we can see logs, diagnose issues faster etc.

bheemreddy181
2020-05-11 03:50
Makes sense you answered it :)

matt.fellows
2020-05-11 04:20
All that being said - please feel free to comment on the issue above. Feedback is helpful

matt.fellows
2020-05-11 04:20
welcome to signup to a free dev account and put test data in their if you?d like to prove out the workflow ahead of time

matt.fellows
2020-05-12 01:07
@bheemreddy181 you can enable wip/pending

matt.fellows
2020-05-12 01:07
using `PACT_BROKER_FEATURES=pacts_for_verification` env var

bheemreddy181
2020-05-12 01:07
Ah with the current version of pact_go ?

matt.fellows
2020-05-12 01:08
yep, should work

bheemreddy181
2020-05-12 01:08
oh cool will give a try

bheemreddy181
2020-05-12 01:08
Do we still need `enable_pending` ?

matt.fellows
2020-05-12 01:13
yes


bheemreddy181
2020-05-12 01:14
i mean the `PACT_BROKER_FEATURES` variable

bheemreddy181
2020-05-12 01:17
I tried passing that as a variable to my test command like this `PACT_BROKER_FEATURES=pacts_for_verification go test -tags=contract`

bheemreddy181
2020-05-12 01:17
that still didn?t help

bheemreddy181
2020-05-12 01:18
i am not sure if this is the correct way though

matt.fellows
2020-05-12 01:36
What version of the broker are you using?

matt.fellows
2020-05-12 01:36
Oh, it needs to be set _on the pact broker instance_

matt.fellows
2020-05-12 01:39
i.e. the pact broker process itself must have that environment variable set

bheemreddy181
2020-05-12 03:02
Ah got it will do that thanks :)

bheemreddy181
2020-05-13 03:55
this thing still didn?t work , i still see exit status `1` is there a way i can debug this

bheemreddy181
2020-05-13 04:00
And also i observed that tests run more than once when they fail is there a retry functionality in built for this by default if so any peculiar reason why it was built that way ?

matt.fellows
2020-05-13 04:01
There is no retry built into pact go

matt.fellows
2020-05-13 04:02
Can you please show me what you mean

bheemreddy181
2020-05-13 04:02
Ah weird i see the failed logs twice which i assumed tests are running twice

bheemreddy181
2020-05-13 04:05
Ya here are the logs

bheemreddy181
2020-05-13 04:05
```2020/05/12 22:53:50 [DEBUG] pact setup logging 2020/05/12 22:53:50 [DEBUG] pact setup 2020/05/12 22:53:50 [DEBUG] checking CLI compatability 2020/05/12 22:53:50 [INFO] checking pact-mock-service within range >= 3.5.0, < 4.0.0 2020/05/12 22:53:50 [DEBUG] running binary pact-mock-service 2020/05/12 22:53:50 API starting: port 61027 ([::]:61027) 2020/05/12 22:53:51 [DEBUG] checking version for binary pact-mock-service version 3.6.1 2020/05/12 22:53:51 [DEBUG] checking if version 3.6.1 within semver range >= 3.5.0, < 4.0.0 2020/05/12 22:53:51 [DEBUG] 3.6.1 satisfies constraints 3.6.1 >= 3.5.0, < 4.0.0 2020/05/12 22:53:51 [INFO] checking pact-provider-verifier within range >= 1.30.0, < 2.0.0 2020/05/12 22:53:51 [DEBUG] running binary pact-provider-verifier 2020/05/12 22:53:52 [DEBUG] checking version for binary pact-provider-verifier version 1.30.1 2020/05/12 22:53:52 [DEBUG] checking if version 1.30.1 within semver range >= 1.30.0, < 2.0.0 2020/05/12 22:53:52 [DEBUG] 1.30.1 satisfies constraints 1.30.1 >= 1.30.0, < 2.0.0 2020/05/12 22:53:52 [INFO] checking pact-broker within range >= 1.22.3 2020/05/12 22:53:52 [DEBUG] running binary pact-broker 2020/05/12 22:53:52 [DEBUG] checking version for binary pact-broker version 1.26.0 2020/05/12 22:53:52 [DEBUG] checking if version 1.26.0 within semver range >= 1.22.3 2020/05/12 22:53:52 [DEBUG] 1.26.0 satisfies constraints 1.26.0 >= 1.22.3 2020/05/12 22:53:52 [DEBUG] setting up a service manager 2020/05/12 22:53:52 [DEBUG] setting up a service manager 2020/05/12 22:53:52 [DEBUG] starting service removal monitor 2020/05/12 22:53:52 [DEBUG] starting service creation monitor 2020/05/12 22:53:52 [DEBUG] setting up a service manager 2020/05/12 22:53:52 [DEBUG] starting service creation monitor 2020/05/12 22:53:52 [DEBUG] starting service removal monitor 2020/05/12 22:53:52 [DEBUG] setting up a service manager 2020/05/12 22:53:52 [DEBUG] starting service creation monitor 2020/05/12 22:53:52 [DEBUG] starting service removal monitor 2020/05/12 22:53:52 [DEBUG] starting service creation monitor 2020/05/12 22:53:52 [DEBUG] starting service removal monitor 2020/05/12 22:53:52 [DEBUG] starting new proxy with opts {http 127.0.0.1:61027 0 [0x4715270 0x4715790 0x47831c0] /__setup <nil>} 2020/05/12 22:53:52 [DEBUG] starting reverse proxy on port 61041 2020/05/12 22:53:52 [DEBUG] waiting for port 61041 to become available 2020/05/12 22:53:52 [DEBUG] pact provider verification 2020/05/12 22:53:52 [DEBUG] client: verifying a provider 2020/05/12 22:53:52 [DEBUG] waiting for port 61041 to become available 2020/05/12 22:53:52 [DEBUG] starting verification service with args: [/Users/bvennapureddy/8b/apps/portfolio/spec/pacts/brazil_portal-datacompliance.json --format json --provider-base-url http://localhost:61041 --provider-states-setup-url http://localhost:61041/__setup --pact-broker-base-url http://pact-broker-poc.dev.com --provider_app_version 1.0.0 --provider data --enable-pending] 2020/05/12 22:53:53 [WARN] state handler not found for state: creating a session 2020/05/12 22:53:53 [DEBUG] skipping state handler for request /sessions 2020/05/12 22:53:53 [DEBUG] http reverse proxy received connection from [::1]:61048 on path /sessions 2020/05/12 22:53:53 [DEBUG] setting proxy to target 2020/05/12 22:53:53 [DEBUG] incoming request /sessions 2020/05/12 22:53:53 [DEBUG] outgoing request http://127.0.0.1:61027/sessions (/Users/bvennapureddy/datacompliance/session_handler.go:89) [2020-05-12 22:53:53] pq: value too long for type character varying(2) (/Users/bvennapureddy/datacompliance/session_handler.go:89) [2020-05-12 22:53:53] pq: value too long for type character varying(2) 2020/05/12 22:53:53 [DEBUG] executing after hook 2020/05/12 22:53:53 [DEBUG] teardown 2020/05/12 22:53:53 [DEBUG] skipping state handler for request /public-api/requests 2020/05/12 22:53:53 [DEBUG] http reverse proxy received connection from [::1]:61053 on path /public-api/requests 2020/05/12 22:53:53 [DEBUG] setting proxy to target 2020/05/12 22:53:53 [DEBUG] incoming request /public-api/requests 2020/05/12 22:53:53 [DEBUG] outgoing request http://127.0.0.1:61027/public-api/requests 2020/05/12 22:53:53 [DEBUG] executing after hook 2020/05/12 22:53:53 [DEBUG] teardown 2020/05/12 22:53:53 [WARN] state handler not found for state: creating a session 2020/05/12 22:53:53 [DEBUG] skipping state handler for request /sessions 2020/05/12 22:53:53 [DEBUG] http reverse proxy received connection from [::1]:61056 on path /sessions 2020/05/12 22:53:53 [DEBUG] setting proxy to target 2020/05/12 22:53:53 [DEBUG] incoming request /sessions 2020/05/12 22:53:53 [DEBUG] outgoing request http://127.0.0.1:61027/sessions (/Users/bvennapureddy/datacompliance/session_handler.go:89) [2020-05-12 22:53:53] pq: value too long for type character varying(2) (/Users/bvennapureddy/datacompliance/session_handler.go:89) [2020-05-12 22:53:53] pq: value too long for type character varying(2) 2020/05/12 22:53:53 [DEBUG] executing after hook 2020/05/12 22:53:53 [DEBUG] teardown 2020/05/12 22:53:53 [DEBUG] skipping state handler for request /public-api/requests 2020/05/12 22:53:53 [DEBUG] http reverse proxy received connection from [::1]:61059 on path /public-api/requests 2020/05/12 22:53:53 [DEBUG] setting proxy to target 2020/05/12 22:53:53 [DEBUG] incoming request /public-api/requests 2020/05/12 22:53:53 [DEBUG] outgoing request http://127.0.0.1:61027/public-api/requests 2020/05/12 22:53:53 [DEBUG] executing after hook 2020/05/12 22:53:53 [DEBUG] teardown```

matt.fellows
2020-05-13 04:28
What makes you think it's repeating?

matt.fellows
2020-05-13 04:30
Print verbose pact output from go. It will tell you if the server is able to support the pending pacts feature

matt.fellows
2020-05-13 04:31
Also, I think the server (broker) will print a notice but can't verify. I'll check when back at my desk later

matt.fellows
2020-05-13 04:31
Are you running the latest server version?

bheemreddy181
2020-05-13 04:41
I think so , I can check that will let you know tomorrow

bheemreddy181
2020-05-13 04:43
Will i see the request twice out there I had more logs which also prints ther errors twice and there is a dB check which is failing for one request and that?s printed twice too all this routed me there

matt.fellows
2020-05-13 04:59
Can you share the pact file?

matt.fellows
2020-05-13 04:59
Or the test

matt.fellows
2020-05-13 05:04
I'm wondering if it's because you've provided a broker option and a local option if it's reading both. The output should show this in the tests results, can you please share the full log output including test results?

matt.fellows
2020-05-13 05:04
It should say which pacts it's reading and from where

bheemreddy181
2020-05-13 11:13
Sure Matt I will check that

bheemreddy181
2020-05-13 12:28
this is working as expected , once i pulled that latest broker. thanks

matt.fellows
2020-05-13 12:57
Just a general note Bheem - new features generally require newer versions of software :wink:

bheemreddy181
2020-05-13 14:00
yes true , i agree :slightly_smiling_face:

bheemreddy181
2020-05-13 14:00
is there a way we can emit failure logs with pending flag ?

bheemreddy181
2020-05-13 14:07
it was reading from broker alone and for only failures they are running twice not sure how else i can explain this

bheemreddy181
2020-05-13 14:12
Usecase : for people running these tests on the bare metal or even for the tests running on CI , rather than visiting the broker it would be great if we can emit the logs for understanding what is not implemented or what is failing for which API

matt.fellows
2020-05-14 23:27
The output should contain these failures already one way or another, you could use those

bheemreddy181
2020-05-15 14:50
One more observation from my testing , when ever the broker is not reachable verification job emits logs saying `pact.go:413: No pacts found to verifify. Check the tags provided (master) for your broker` which seems little odd for investigation - rather can we emit logs saying `connection refused or couldn't connect`

bheemreddy181
2020-05-15 14:51
i didn?t really get you

matt.fellows
2020-05-16 00:25
Thanks Bheem that's not ideal. You can't fail on no pacts found but a dead broker should error

matt.fellows
2020-05-16 00:25
I'll make a reminder to follow this up Monday

dan.h.lee329
2020-05-18 23:47
@matt.fellows I haven't forgotten about this item, I'll plan to get to this sometime this week, thanks!

dan.h.lee329
2020-05-18 23:47
Yepp, that's my account

matt.fellows
2020-05-19 00:12
Thanks!

sankalan13
2020-05-22 08:57
has joined #pact-go

sankalan13
2020-05-22 09:11
Hey @matt.fellows I was going through the workshop for pact-go and I am unable to run any commands via the `make` command like `make unit` and `make consumer`. I keep getting the following error. ```make: "/bin/bash": Command not found make: *** [Makefile:4: install] Error 127``` This might be a very trivial question. Sorry for my ignorance but I wasn't able to find anything in the internet. I installed build-essentials as I am running the latest Ubuntu. I am not sure what is going wrong.

matt.fellows
2020-05-22 09:52
Is bash installed?

sankalan13
2020-05-22 09:56
Yes it is

sankalan13
2020-05-22 09:57
If I run the go commands defined in the Makefile manually, the commands run but some comands exit with a panic state.

matt.fellows
2020-05-22 10:07
Are you using docker? If you could pop an issue against the repo with your docker image that's enough for me to find/fix. It's only been tested on a Mac, so it's possible it doesn't work on Linux. I might add a Travis build for each step

matt.fellows
2020-05-22 11:29
Also, can you try please removing the `SHELL` variable in the `http://config.mk` file

matt.fellows
2020-05-22 11:30
```# SHELL = "/bin/bash"``` It actually should work without that, and it may cause issues

sankalan13
2020-05-22 13:16
I am not using docker. I will go through the workshop and pop an issue when I find it!

sankalan13
2020-05-22 13:16
Yep that was the problem! Thanks Matt!!

dom.udall
2020-05-22 13:33
has joined #pact-go

matt.fellows
2020-05-22 13:40
Would you mind raising an issue? I'll fix it

sankalan13
2020-05-22 14:20
Okay will do!

sairsule
2020-05-25 06:29
has joined #pact-go

sairsule
2020-05-27 15:53
Hi All, are there any examples of message-driven pacts tests in GO?

dom.udall
2020-05-27 15:58
Hey, there's an example in the pact-go repo with some good supporting docs, though I haven't tried it myself yet! https://github.com/pact-foundation/pact-go/tree/master/examples/messages

sairsule
2020-05-27 16:01
thanks, I'll checkout

morten.hekkvang
2020-06-02 07:59
Hi! Just wondering why the go implementation relies on the ruby-standalone version of pact? I would much rather see a pure golang module for this. The reason I think like this is that a lot of CI/CD implementations would require the user to install and properly config both ruby and go before being able to build and run the test suite. An alternative would be to compile the ruby-standalone into a shared object library and use that. Instead of relying on having ruby installed correctly on the machines.

ramfjordm
2020-06-02 08:00
has joined #pact-go

matt.fellows
2020-06-02 09:47
You don't need Ruby installed on the machine

matt.fellows
2020-06-02 09:47
Or are you just referring to the standalone?

matt.fellows
2020-06-02 09:47
Either way you have to download a dependency.

matt.fellows
2020-06-02 09:47
I'm also working on integrating to a that shared binary which is the long term objective

matt.fellows
2020-06-02 09:53
So just in case it's not clear. Any CI runtime does not require Ruby to run Pact (albeit a pure implementation would be ideal). We need to publish updated info on our strategy, but pact is very very complex now and having 12 languages implement all of the features and capabilities is a tall ask. So we've moved to a shared engine to do it. Ruby was the old, rust is the new

bheemreddy181
2020-06-03 01:37
probably i missed followup on this i didn?t really understand what you mean?t by ```The output should contain these failures already one way or another, you could use those``` you mean as they already show up on pact broker we should look at broker rather than the CI itself

matt.fellows
2020-06-03 01:38
I mean the output of `go test ?` type thing. Any failures will be in there

ramfjordm
2020-06-04 11:11
Hello, I am struggling to pull down and verify pacts from my self-hosted broker. I followed the examples on https://github.com/pact-foundation/pact-go and the following works when I use a local broker running on my machine: ```pact.VerifyProvider(t, types.VerifyRequest{ BrokerURL: "http://localhost:9292", ProviderVersion: "1.0.0", ProviderBaseURL: "https://provider-base-url", RequestFilter: fixBearerToken, })``` Setting "PublishVerificationResults: true" works as well using the local broker. But it fails if I use the self-hosted broker: ```pact.VerifyProvider(t, types.VerifyRequest{ BrokerURL: "https://self-hosted-broker-url", ProviderVersion: "1.0.0", ProviderBaseURL: "https://provider-base-url", RequestFilter: fixBearerToken })``` Using the self-hosted broker I just get an error saying "No pacts found to verify", although the same pact has been published to both brokers. Not sure where to go from here. I cannot find any relevant logs for the self-hosted broker. Any help would be appreciated :slightly_smiling_face:

matt.fellows
2020-06-04 12:38
Is the self hosted broker using a self signed certificate?

matt.fellows
2020-06-04 12:39
To connect to a Pact Broker that uses custom SSL cerificates, set the environment variable $SSL_CERT_FILE or $SSL_CERT_DIR to a path that contains the appropriate certificate

ramfjordm
2020-06-04 13:16
The self hosted broker is using a certificate signed by Entrust. It is running in GKE and nginx though, so I'm starting to wonder if adding these headers mentioned here would help - at least I'll give it a try: https://github.com/pact-foundation/pact_broker/wiki/Configuration#running-the-broker-behind-a-reverse-proxy

matt.fellows
2020-06-04 22:49
Golang aside, can you login to the broker and poke around?

ramfjordm
2020-06-05 06:41
Yes, I can view the pacticipants/pacts/matrix etc, but the API browser does not work properly. None of the endpoints are displayed there. Not sure how relevant it is, but I see this error in the console in Chrome when I open the API browser: ```Uncaught TypeError: HAL.normalizeUrl is not a function at eval (eval at _.template (underscore.js:1157), <anonymous>:58:13) at Function._.each._.forEach (underscore.js:87) at child.eval (eval at _.template (underscore.js:1157), <anonymous>:6:4) at child.template (underscore.js:1165) at child.render (links.js:52) at child.render (resource.js:28) at Object.<anonymous> (resource.js:8) at triggerEvents (backbone.js:96) at Object.trigger (backbone.js:181) at Object.success (client.js:13)```

matt.fellows
2020-06-05 07:04
interesting

matt.fellows
2020-06-05 07:04
that seems like JS isn?t being loaded properly, which indicates a configuration issue

matt.fellows
2020-06-05 07:05
if you were to curl the `/` endpoint on your broker, sharing the hostname you hit and the results that might help (DM me if you like)

bheemreddy181
2020-06-05 16:16
So one of our contracts only looks for a 200 status and doesn?t care about the response but in cases where we get a 400 response doesn?t user needs to know why there is a 400 what is missing ? pact tests only tell you expected 200 and you got a 400 thats all

matt.fellows
2020-06-06 01:26
It's an interesting point, there may be more detail on your app logs, but having more context would be helpful

bheemreddy181
2020-06-06 22:01
Yes looking for more context for such cases

matt.fellows
2020-06-07 00:11
Usually with a failed test, you would print out context of the API responses anyway. Do you not log what your API is doing in those cases?

bheemreddy181
2020-06-07 19:46
i assume we do i am still looking into this why we are not seeing logs from applications side.

bheemreddy181
2020-06-08 22:48
Question : Is there a way we can re-use statehandlers between two different states in PACT go ?

matt.fellows
2020-06-08 23:34
Of course, a state handler is just a function

matt.fellows
2020-06-09 00:44
@bheemreddy181 FYI if you set log level to `TRACE` you will get full request/response logging.

matt.fellows
2020-06-09 00:45
That should help you diagnose why you are getting `400` when you expect `200`

sairsule
2020-06-09 11:50
example here doesn't work .https://github.com/pact-foundation/pact-go/tree/master/examples/messages. I get following error ``` FAIL: TestExampleMessageConsumer_UserExists (5.45s) pact.go:762: VerifyMessageConsumer failed: error creating message: exit status 255 STDERR: 'controller' is not recognized as an internal or external command, operable program or batch file.```

matt.fellows
2020-06-09 13:42
Are you on windows?

matt.fellows
2020-06-09 13:42
It is run as part of our ci so it at least works there

bheemreddy181
2020-06-09 14:50
My question was more like clubbing two states like below ```"User jmarie exists","User jmarie is unauthenticated": func() error { userRepository = jmarieExists return nil },```

bheemreddy181
2020-06-09 14:51
like a comma separated ones

sairsule
2020-06-09 15:12
yes, I am on windows.

sairsule
2020-06-09 15:20
whats different on windows? and how shall I get it work on windows?

bheemreddy181
2020-06-09 15:48
this does but it doesn?t show if any error json response is returned

matt.fellows
2020-06-09 23:32
Thanks for clarifying

matt.fellows
2020-06-09 23:32
there shouldn?t be, it should ?just work? but looks like there might be an issue

matt.fellows
2020-06-09 23:32
I?ll take a look today

matt.fellows
2020-06-09 23:35
```state1 := func() error { ... } "User jmarie exists": state1, "User jmarie is unauthenticated": state1,```

matt.fellows
2020-06-09 23:36
I?d just do that

matt.fellows
2020-06-09 23:36
so short answer is no

sairsule
2020-06-10 08:58
format of my message is ```{ "foo":{ "bar":"baz", } "name": "test", }``` its not the map[string]interface{} format, like in example. how can I use this?

matt.fellows
2020-06-10 09:28
I'm unsure of your problem, sorry. It is of type map[string] interface {}

matt.fellows
2020-06-10 09:28
Can you share your test that you're trying to get it into?

matt.fellows
2020-06-10 09:30
If there is a type for that you can use tags on the fields (see docs)

sairsule
2020-06-11 04:43
Thanks @matt.fellows, I realised my mistake. It had to do with adding map[string]interface{} for inner object too. something like ```WithContent(map[string]interface{}{ "id": like(127), "name": "Baz", "address": map[string]interface{}{ "city": "pune", "zip": "411045", }, }). AsType(&User{})```

sairsule
2020-06-11 08:18
When pact.json file is not provider-test still return "ok". How can we make sure weather tests were "ok" or its returning "ok" because pact file is not found?

zbintliff
2020-06-11 21:02
has joined #pact-go

zbintliff
2020-06-11 21:03
Hey all, its been a really long time since we gave our pact some TLC. We are version 0.0.12 and looking to upgrade to latest and great. Happy to shed the ruby daemon too! I thought I saw an upgrade doc somewhere but can't seem to find it. Does anyone have a link?

matt.fellows
2020-06-11 22:29
Hey - welcome back!

matt.fellows
2020-06-12 02:22
There is no guide, but the API should be pretty similar to before. There is at least one deprecated field (`Verbose`) but I don?t think we removed any stable APIs

matt.fellows
2020-06-12 02:22
The big difference is that you now need to install the CLI tools manually, and then you can do the usual `go get` , using mod etc.

zbintliff
2020-06-12 12:57
Ok cool. We have a crazy docker compose set up that has ruby and the deamon in it. Super excited to slim down that container

zbintliff
2020-06-12 12:58
The one thing I get is "Port" is not there any more bu twill dig in and see if i can actually do anything other than speculate :slightly_smiling_face:

zbintliff
2020-06-12 18:42
Lots of breaking changes. All the matcher requests now take custom dsl types instead of just string and map (for headers)

zbintliff
2020-06-12 18:42
not huge deal just a lot of small changes that are hard to sed

zbintliff
2020-06-12 18:59
Hmm i seem to be confused. I thought the big change for version 0.0.12 to 1.0.0 is that we no longer rely on ruby.

zbintliff
2020-06-12 19:00
The installation instructions are unclear. It says : > See below for how to automate this: Is that onlyk referring to the step3 ? on installation? Do we still need the cli tools separately?

zbintliff
2020-06-12 20:34
WOw i just found the autogeneration. That is _awesome_ and I want to use it. IS there a way though to isolate it per request? For example, the DTO's fields may change per request (i.e. we expect a slice of size 0 in one request and size >= 1 in another)

zbintliff
2020-06-12 20:36
Is something like that possible? We have massive payloads and the old version (0.0.12) was string based and new version iss struct based (i.e. sprintf("%", dsl.EachLike)) and converting our iant json payloads to `map[string]interface` doesnt seem appealing to me. so would love a way to auto gen as much as possible

zbintliff
2020-06-12 20:46
BTW :point_up: is super dope and saved me a ton of time

zbintliff
2020-06-12 20:50
Ths is my only concern now but honestly all of our returns are objects, i'm happy to make "dummy" ones with proper values on sizes per request

zbintliff
2020-06-12 22:29
I answered this myself. Yes! I got it all working in a `strech-slim` docker container

matt.fellows
2020-06-13 08:47
Thanks for all of this feedback Zach. I'll make a reminder to read thru all of it and address it. Thanks so much!

matt.fellows
2020-06-13 09:09
Ruby will be removed in next major version. The big change here was removing the daemon because people hated it. It still needs the standalone

matt.fellows
2020-06-13 09:09
But in case it's not clear. You didn't, and still don't, need to install Ruby to run Pact. We always bundled a runtime

matt.fellows
2020-06-13 09:10
Obviously those doc's aren't clear enough. I'll fix that thx

matt.fellows
2020-06-13 09:11
It's a good idea. Any thoughts on how to do so nicely? I don't want the tags to he overly complicated. They are ultimately probably going to link to a provider state so that could be an approach

matt.fellows
2020-06-13 09:12
Perhaps point to externalised data sources? E.g. a YAML/JSON file with all of the states and data variants?

matt.fellows
2020-06-13 09:12
Sorry which part are you referring to?

zbintliff
2020-06-15 02:32
> They are ultimately probably going to link to a provider state so that could be an approach Not a bad idea. I think i can minimize the number of objects will report back

zbintliff
2020-06-15 02:33
The auto generation part. Haven't fully proofed it out but its _really_ nice.

zbintliff
2020-06-15 02:33
Sorry for the word vommit. The lib is in an awesome place btw the new features are _really_ nice

matt.fellows
2020-06-15 03:40
oh yeah, we can thank one of the Alex?s for that contribution

matt.fellows
2020-06-15 03:40
thanks, that?s awesome to hear!

matt.fellows
2020-06-15 03:40
I won?t make you upset by saying _literally_ this week, I have restarted the PoC to remove the Ruby stuff

matt.fellows
2020-06-15 03:42
My goal is to preserve as much of the 1.x.x API as possible, but there are some clunky things in the API I?d really like to address. There is implementation code, and the ergonomics of the public facing API. It will take some time to get to a v2.x.x anyway (so don?t be too worried about that upgrade)

matt.fellows
2020-06-15 03:42
If you?re keen to get your hands on early draft, let me know - i?ll post here anyway

zbintliff
2020-06-15 21:06
Happy monday! Back with more questions. I found that in the autogeneration if the struct has a field that is a pointer and has omit empty tag the `min=1` tag is ignored. For example: ```type Example struct { FeldOne []*string `json:"fieldOne,omitempty" pact:"min=1"` }``` My tests were failing because the field was nil. When i removed the `omitempty` it seemed to work. I was digging through code it _seems_ like it's because it relies heavily on `json.Marshal` . I don't think this is a bug, but wanted to verify the behavior. I can also 100% open a GH issue. I'm not sure where the best place to interact on things like this.

bernardoguerr
2020-06-18 18:07
has joined #pact-go

bheemreddy181
2020-06-23 01:43
Is there good documentation for contract testing Go lambdas?

matt.fellows
2020-06-23 11:34
Not that I?m aware of. Is there a particular issue you?re having?

matt.fellows
2020-06-23 11:34
Is it a direct lambda invocation? Is it at the end of a queue? is it used in an HTTP context? You can see how writing a guide for this could be difficult, because lambda is just one of the runtimes

bheemreddy181
2020-06-23 17:00
makes sense

matt.fellows
2020-06-23 21:39
But what issues are you having? Happy to help!

matt.fellows
2020-06-30 06:45
Sorry Zach, I somehow missed this

matt.fellows
2020-06-30 06:46
Somebody raised a PR related to this today - https://github.com/pact-foundation/pact-go/issues/140. I?ll look into it later in the week, but thought I?d get it in front of you in case it?s helpful

jonathan-pact
2020-06-30 07:00
has joined #pact-go

oscar821210
2020-07-21 04:50
has joined #pact-go

abdul.hussain
2020-07-21 15:31
has joined #pact-go

abdul.hussain
2020-07-21 15:37
Should pacts tests sit alongside unit tests (my gin api handler unit tests are under `pkg/api/v1/..` ) or alongside integration tests at the top level?

matt.fellows
2020-07-22 00:24
On the consumer side, I would have them sit as a unit test

matt.fellows
2020-07-22 00:24
on the provider side it?s up to you. I usually run them as unit tests, because often you?re going to stub out a layer that requires access to code (e.g. you might stub out your repository etc.)

david025
2020-07-28 15:07
has joined #pact-go

damianattademo
2020-08-19 01:48
has joined #pact-go

alexfdz
2020-08-19 13:18
has joined #pact-go

heytaco
2020-08-25 03:57
has joined #pact-go

heytaco
2020-08-25 03:57
Hi there! My name is HeyTaco!, and you can use me to give people tacos to show your appreciation. My tacos will spread joy through Slack!

mark.doppelfeld
2020-09-30 07:44
has joined #pact-go

nazar.khmil
2020-10-05 10:34
has joined #pact-go

xandebianchi
2020-10-05 13:05
has joined #pact-go

dorin.enache
2020-10-05 15:01
has joined #pact-go

ledinhcuong99
2020-10-06 12:53
has joined #pact-go

dothetan.040490
2020-10-07 09:14
has joined #pact-go

dagostino.remy
2020-10-07 23:03
has joined #pact-go

dothetan.040490
2020-10-08 04:05
Hi everyone, I got a problem that cannot download pact from pactflow for provider test. I attached configuration screenshot. Please help me to solve this problem.

matt.fellows
2020-10-08 04:11
It's saying there are no pacts to verify because it can't find any in the broker. have you published pacts to the broker already and if so what tags have you used?

matt.fellows
2020-10-08 04:11
See howtolearn for a ci/cd workshop that goes thru this and the docs on tags

2020-10-08 04:11
Here are a number of useful hands-on labs that teach all of the key concepts https://docs.pact.io/implementation_guides/workshops

dothetan.040490
2020-10-08 04:28
I have published to pactflow already.

dothetan.040490
2020-10-08 04:28
I checked the version or even tags are correct.

matt.fellows
2020-10-08 05:11
Can you please share the tags you have published and/or screenshot of the pact you're expecting to verify? Also your provider is not currently specifying any tags. Can you please set loglevel to debug and share the output?

dothetan.040490
2020-10-08 05:37
Here is the published pact that I'm try to verify, and the log when execute provider test (I added tags in pact verify configuration) ```=== RUN TestPactProvider Come here 2020/10/08 12:30:19 [DEBUG] pact setup logging 2020/10/08 12:30:19 [DEBUG] pact setup 2020/10/08 12:30:19 [DEBUG] setting up a service manager 2020/10/08 12:30:19 [DEBUG] setting up a service manager 2020/10/08 12:30:19 [DEBUG] setting up a service manager 2020/10/08 12:30:19 [DEBUG] setting up a service manager 2020/10/08 12:30:19 [DEBUG] starting service creation monitor 2020/10/08 12:30:19 [DEBUG] starting service removal monitor 2020/10/08 12:30:19 [DEBUG] starting service creation monitor 2020/10/08 12:30:19 [DEBUG] starting service removal monitor 2020/10/08 12:30:19 [DEBUG] starting service removal monitor 2020/10/08 12:30:19 [DEBUG] starting service creation monitor 2020/10/08 12:30:19 [DEBUG] starting service creation monitor 2020/10/08 12:30:19 [DEBUG] starting service removal monitor 2020/10/08 12:30:19 [DEBUG] starting new proxy with opts {http 127.0.0.1:59744 0 [] /__setup } 2020/10/08 12:30:19 [DEBUG] starting reverse proxy on port 59746 2020/10/08 12:30:19 [DEBUG] waiting for port 59746 to become available on localhost after 10s 2020/10/08 12:30:19 [DEBUG] pact provider verification 2020/10/08 12:30:19 [DEBUG] client: verifying a provider 2020/10/08 12:30:19 [DEBUG] waiting for port 59746 to become available on localhost after 10s 2020/10/08 12:30:19 [DEBUG] starting verification service with args: [--format json --provider-base-url http://localhost:59746 --pact-broker-base-url https://VALID-DOMAIN.pactflow.io --broker-token {VALID_TOKEN} --provider_app_version 1.0-SNAPSHOT --provider Our Provider - edited --publish_verification_results true --consumer-version-tag master] pact.go:413: No pacts found to verify. Check the tags provided (master) for your broker (https://VALID-DOMAIN.pactflow.io) are correct --- FAIL: TestPactProvider (1.15s)```

marko.justinek
2020-10-08 05:38
so `VALID-DOMAIN` is valid?

dothetan.040490
2020-10-08 05:38
yes, I just hide it

dothetan.040490
2020-10-08 05:39
```=== RUN TestPactProvider Come here 2020/10/08 12:37:28 [DEBUG] pact setup logging 2020/10/08 12:37:28 [DEBUG] pact setup 2020/10/08 12:37:28 [DEBUG] setting up a service manager 2020/10/08 12:37:28 [DEBUG] setting up a service manager 2020/10/08 12:37:28 [DEBUG] setting up a service manager 2020/10/08 12:37:28 [DEBUG] setting up a service manager 2020/10/08 12:37:28 [DEBUG] starting service creation monitor 2020/10/08 12:37:28 [DEBUG] starting service removal monitor 2020/10/08 12:37:28 [DEBUG] starting service removal monitor 2020/10/08 12:37:28 [DEBUG] starting service removal monitor 2020/10/08 12:37:28 [DEBUG] starting service creation monitor 2020/10/08 12:37:28 [DEBUG] starting service creation monitor 2020/10/08 12:37:28 [DEBUG] starting service creation monitor 2020/10/08 12:37:28 [DEBUG] starting service removal monitor 2020/10/08 12:37:28 [DEBUG] starting new proxy with opts {http 127.0.0.1:59970 0 [] /__setup <nil>} 2020/10/08 12:37:28 [DEBUG] starting reverse proxy on port 59972 2020/10/08 12:37:28 [DEBUG] waiting for port 59972 to become available on localhost after 10s 2020/10/08 12:37:28 [DEBUG] pact provider verification 2020/10/08 12:37:28 [DEBUG] client: verifying a provider 2020/10/08 12:37:28 [DEBUG] waiting for port 59972 to become available on localhost after 10s 2020/10/08 12:37:28 [DEBUG] starting verification service with args: [--format json --provider-base-url http://localhost:59972 --pact-broker-base-url https://VALID_DOMAIN.pactflow.io --broker-token {VALID_TOKEN} --provider_app_version 1.0-SNAPSHOT --provider Our Provider - edited --publish_verification_results true] pact.go:413: No pacts found to verify --- FAIL: TestPactProvider (0.95s)``` here is the log without tags configuration.

abhi.nandan
2020-10-08 06:38
has joined #pact-go

matt.fellows
2020-10-08 12:23
OK, I hope it?s not the case - but could you please remove all spaces from your provider name and see if that fixes it? If so, could you also please raise a bug?

matt.fellows
2020-10-08 12:23
I?m wondering if _that?s_ the issue

przemyslaw.dabrowski
2020-10-08 12:36
has joined #pact-go

emiliano.righi
2020-10-08 13:25
has joined #pact-go

cariaga.bh
2020-10-08 21:03
has joined #pact-go

campellcl
2020-10-09 00:06
has joined #pact-go

dothetan.040490
2020-10-09 02:45
```=== RUN TestPactProvider Come here 2020/10/09 09:41:58 [DEBUG] pact setup logging 2020/10/09 09:41:58 [DEBUG] pact setup 2020/10/09 09:41:58 [DEBUG] setting up a service manager 2020/10/09 09:41:58 [DEBUG] setting up a service manager 2020/10/09 09:41:58 [DEBUG] starting service creation monitor 2020/10/09 09:41:58 [DEBUG] starting service creation monitor 2020/10/09 09:41:58 [DEBUG] setting up a service manager 2020/10/09 09:41:58 [DEBUG] setting up a service manager 2020/10/09 09:41:58 [DEBUG] starting service creation monitor 2020/10/09 09:41:58 [DEBUG] starting service removal monitor 2020/10/09 09:41:58 [DEBUG] starting service removal monitor 2020/10/09 09:41:58 [DEBUG] starting service removal monitor 2020/10/09 09:41:58 [DEBUG] starting service removal monitor 2020/10/09 09:41:58 [DEBUG] starting service creation monitor 2020/10/09 09:41:58 [DEBUG] starting new proxy with opts {http 127.0.0.1:61568 0 [] /__setup } 2020/10/09 09:41:58 [DEBUG] starting reverse proxy on port 61570 2020/10/09 09:41:58 [DEBUG] waiting for port 61570 to become available on localhost after 10s 2020/10/09 09:41:58 [DEBUG] pact provider verification 2020/10/09 09:41:58 [DEBUG] client: verifying a provider 2020/10/09 09:41:58 [DEBUG] waiting for port 61570 to become available on localhost after 10s 2020/10/09 09:41:58 [DEBUG] starting verification service with args: [--format json --provider-base-url http://localhost:61570 --pact-broker-base-url https://VALID_DOMAIN.pactflow.io --broker-token VALID_TOKEN --provider_app_version 1.0-SNAPSHOT --provider sample_provider --publish_verification_results true] pact.go:413: No pacts found to verify --- FAIL: TestPactProvider (1.39s)``` I changed names of consumer & provider, but issue still occurs :disappointed:

matt.fellows
2020-10-09 02:56
Can you please re-share your code here? (as a code snippet preferably)

dothetan.040490
2020-10-09 02:58
here is the code ```// Configuration / Test Data var dir, _ = os.Getwd() var pactDir = fmt.Sprintf("%s/../../pacts", dir) var logDir = fmt.Sprintf("%s/log", dir) var port, _ = utils.GetFreePort() // The Provider verification func TestPactProvider(t *testing.T) { fmt.Println("Come here") //go startInstrumentedProvider(t) pact := dsl.Pact{ Provider: "Our Provider - edited", LogDir: logDir, PactDir: pactDir, DisableToolValidityCheck: true, LogLevel: "DEBUG", } // Verify the Provider - Tag-based Published Pacts for any known consumers _, err := pact.VerifyProvider(t, types.VerifyRequest{ ProviderBaseURL: fmt.Sprintf("http://127.0.0.1:%d", port), Tags: []string{"master"}, FailIfNoPactsFound: true, // Use this if you want to test without the Pact Broker // PactURLs: []string{filepath.FromSlash(fmt.Sprintf("%s/goadminservice-gouserservice.json", os.Getenv("PACT_DIR")))}, BrokerURL: "https://VALID_DOMAIN.pactflow.io", BrokerToken: "VALID_TOKEN", PublishVerificationResults: true, ProviderVersion: "1.0-SNAPSHOT", PactLogDir: logDir, Provider: "sample_provider", }) if err != nil { t.Fatal(err) } }```

matt.fellows
2020-10-09 03:03
OK, sorry for the pain

matt.fellows
2020-10-09 03:03
can you please execute the `pact-provider-verifier` binary directly with the args ```--format json --provider-base-url http://localhost:61570 --pact-broker-base-url https://VALID_DOMAIN.pactflow.io --broker-token VALID_TOKEN --provider_app_version 1.0-SNAPSHOT --provider sample_provider --publish_verification_results true --verbose```

matt.fellows
2020-10-09 03:03
obviously replacing your specific tokens

matt.fellows
2020-10-09 03:27
if you can DM me, I can also try and reproduce locally and check pactflow logs. lemme know

elenitsaa043
2020-10-09 10:00
has joined #pact-go

matt.fellows
2020-10-09 10:39
:wave:hey friends

adriangabrieloros
2020-10-09 11:05
has joined #pact-go

sh.ilgam_pact
2020-10-11 16:12
has joined #pact-go

anastasiia.bielik
2020-10-12 11:13
has joined #pact-go

deepika.krishnakumar
2020-10-12 15:03
has joined #pact-go

anbansal27
2020-10-12 23:02
has joined #pact-go

prabhakar.thippa
2020-10-13 04:58
has joined #pact-go

giadinhluong
2020-10-13 06:24
has joined #pact-go

pavank
2020-10-13 08:41
has joined #pact-go

stephane.meng
2020-10-13 09:06
has joined #pact-go

abirlal.bose
2020-10-13 09:45
has joined #pact-go

dothetan.040490
2020-10-14 05:19
I was successful to get contracts from pactflow in provider side. However, I just started 1 service, it depends on others. Thus, provider test was fail because of others services not started. What should I to solve the problem now? Should I start whole system or just start 1 service and mock all dependencies?

matt.fellows
2020-10-14 05:27
Have a look at http://docs.pact.io and search for ?downstream systems?, there?s a whole thing on it

dothetan.040490
2020-10-14 05:28
thank you @matt.fellows. I read it now.

mateusz.mrzyglod
2020-10-14 09:32
has joined #pact-go

cathleen.yuan
2020-10-14 11:16
has joined #pact-go

ramana.jaladurgam
2020-10-14 16:10
has joined #pact-go

alik.berezovsky
2020-10-14 18:38
has joined #pact-go

a.robecke
2020-10-14 19:24
has joined #pact-go

mikahchapman
2020-10-14 21:47
has joined #pact-go

hem_kec
2020-10-15 00:44
has joined #pact-go

marco.cordeiro
2020-10-15 10:54
has joined #pact-go

betty.he
2020-10-15 14:32
has joined #pact-go

tamer
2020-10-16 09:08
has joined #pact-go

mario.gioiosa
2020-10-16 18:57
has joined #pact-go

alik.berezovsky
2020-10-18 17:59
@alik.berezovsky has left the channel

lior.baber
2020-10-19 07:33
has joined #pact-go

jeffbdye
2020-10-19 17:10
has joined #pact-go

jace
2020-10-19 19:22
has joined #pact-go

almaak
2020-10-20 09:35
has joined #pact-go

andra.moraru
2020-10-20 14:13
has joined #pact-go

camila.coder91
2020-10-20 17:06
has joined #pact-go

julzelements
2020-10-21 05:25
has joined #pact-go

kapil.mathur
2020-10-21 06:40
has joined #pact-go

mark.hudson
2020-10-21 10:45
has joined #pact-go

cluu
2020-10-21 17:16
has joined #pact-go

camila.campos
2020-10-21 21:35
has joined #pact-go

longlevan
2020-10-22 09:15
has joined #pact-go

justin.garfield
2020-10-22 16:15
has joined #pact-go

guppy0356.nakira
2020-10-23 00:34
has joined #pact-go

ercalbwar
2020-10-24 19:24
has joined #pact-go

andrewshtamburg
2020-10-25 13:04
has joined #pact-go

siad.ardroumli
2020-10-25 18:16
has joined #pact-go

srikanthpmailid
2020-10-26 01:02
has joined #pact-go

greg.tyler
2020-10-26 12:22
has joined #pact-go

photesthesis_geospiza
2020-10-26 15:10
has joined #pact-go

jackbwheatley
2020-10-27 21:02
has joined #pact-go

carlosalmeida.xon
2020-10-27 22:06
has joined #pact-go

nasir.amin
2020-10-28 11:07
has joined #pact-go

jimish.shah.-nd
2020-10-28 11:26
has joined #pact-go

adam_figgins
2020-10-28 14:20
has joined #pact-go

aperdomobo
2020-10-28 15:42
has joined #pact-go

diazguerra2
2020-10-28 16:06
has joined #pact-go

xsamore
2020-10-28 19:52
has joined #pact-go

simon
2020-10-28 20:49
has joined #pact-go

ruben.cagnie
2020-10-29 01:24
has joined #pact-go

272939217
2020-10-29 05:33
has joined #pact-go

driloni92
2020-10-29 09:05
has joined #pact-go

pauloavra
2020-10-29 12:33
has joined #pact-go

jikogay728
2020-10-30 17:20
has joined #pact-go

blmlcu
2020-10-31 14:51
has joined #pact-go

jamescourtoy
2020-11-02 21:04
has joined #pact-go

telmo.ferreira.costa
2020-11-03 11:32
has joined #pact-go

sergii.kopovskyi
2020-11-03 12:35
has joined #pact-go

silverton.gimenes
2020-11-03 17:58
has joined #pact-go

colber16
2020-11-03 18:34
has joined #pact-go

cvoong
2020-11-03 18:55
has joined #pact-go

jamescourtoy
2020-11-05 17:16
:wave: I'm currently evaluating using Pact at my company. We're a Node (JS) and Go shop, primarily, and I work on a team focused on AuthN / AuthZ. I've found using Pact to be pretty painless so far, but I'm running into issues with provider state. Now, I _believe_ that most of my pain points can be solved with 3.0 support for multiple provider states, and have worked that out on the NodeJS side already; however, I'm struggling on the Go side. While using the external provider verification CLI tooling will work for verifying consumer contracts written from a JS consumer, I am not aware of a way to write Go consumer 3.0 Pact files. Is there a solution I'm not aware of for this, or is it on the near-term roadmap at all ? It's hard to determine what current priorities are for various features / languages...

matt.fellows
2020-11-07 03:45
So I?m currently working on pact v3 support (see https://github.com/pact-foundation/pact-go/issues/142) however the bad news is that things are still experimental. I?m aiming to have a beta by Q4 2020.

matt.fellows
2020-11-07 03:45
If it?s just the provider side you need, I may be able to prioritise that to unblock you

matt.fellows
2020-11-07 03:46
> Now, I _believe_ that most of my pain points can be solved with 3.0 support for multiple provider states This is usually worked around fairly easily. Could you please elaborate on why you think that will solve your issue? Multiple states is more of a convenience thing if any

pbobba
2020-11-09 23:03
has joined #pact-go

jun.li
2020-11-09 23:05
has joined #pact-go

douweicai
2020-11-10 04:11
has joined #pact-go

christian.huber
2020-11-10 09:20
has joined #pact-go

vuttithatkrongyot
2020-11-10 10:57
has joined #pact-go

jamescourtoy
2020-11-10 16:59
> If it?s just the provider side you need, I may be able to prioritise that to unblock you It's actually the consumer-side that I'm more interested in since it would allow me to generate 3.0 contracts from a Go consumer. With the external provider verifier CLI I could run the provider-side tests against a running set of images with provider state endpoints, but need a way to generate the contracts themselves. At our company we have a majority of Go services with a smattering of Node services, and several separate SPA UI's which are JS. Go is a big part of our path to adoption of Pact. At any rate, thanks for even considering prioritization! Having consumers generate 3.0 spec files would make it much easier for me to promote adoption of Pact as our company's contract testing standard :slightly_smiling_face: > Could you please elaborate on why you think that will solve your issue? Sure! It's entirely possible that I'm not thinking about things in the right way, or leveraging everything available in 2.0. In one case, we aggregate responses from various downstream services (API gateways & BFF's). During my spike, I found it increasingly difficult to use bespoke strings for every permutation that results in a different contract. For instance, we have a "team join" permissions endpoint which aggregates information from "invites", "open-enrollment", and other services in order to make a decision on what sort of UX we send a user through. Thinking about this now, though, I could think about this in terms of user flow which would result in fewer "states". I could see the multiple provider states as more of a convenience here so that we could share them across interactions. In another case, we actually have an intermediary "edge" which is mostly invisible to providers, but provides headers which are necessary. A good example of this is with authorized sessions. The edge gateway is responsible for verifying any individual request's headers and adding user identity headers to a request. From the consumer's perspective, this data is typically sent in the form of a cookie which then translates to a valid user ID in the edge gateway headers that the provider consumes. I've dealt with this case by introducing a special header state in the Pact file such as "a valid session exists for the current user". The provider verification step can then translate that into the expected edge headers. However, now I'm stuck duplicating this in every interaction ? varying it periodically to deal with "session invalid" status codes.

jamescourtoy
2020-11-10 17:00
Apologies for the wall of text @matt.fellows , but I hope that gives you better context.

dan.iosif
2020-11-10 17:06
has joined #pact-go

rodrigo.costa20
2020-11-12 00:59
has joined #pact-go

matt.fellows
2020-11-12 03:43
no worries at all. I somehow missed your response too

matt.fellows
2020-11-12 03:52
I?ve just taken a look at the Pact Go code

matt.fellows
2020-11-12 03:53
Technically, message pacts is a v3 thing - so the current Go package does sort of support this. I need to confirm that multiple states will propagate for (1) (I think they will). The next issue is verifying on the provider side, which is JS (also not fully v3 compatible yet, or rather, we haven?t added support for messages in the v3 branch).

matt.fellows
2020-11-12 03:54
It may be the case that the current implementation will actually invoke all of the provider states, in which case, we can get that fairly quickly into the current ecosystem

matt.fellows
2020-11-12 03:54
Otherwise, even if I get the Go consumer code updated for you, you?ll still suffer from needing to actually _verify_ it in JS!

matt.fellows
2020-11-12 03:54
Leave it with me, i?ll look into it tonight

yong.gong188
2020-11-12 09:13
has joined #pact-go

anandhadeepak
2020-11-12 13:03
has joined #pact-go

david.dias
2020-11-12 20:04
has joined #pact-go

david.dias
2020-11-12 20:12
Hello, how I can make a matcher like /resource/:uuid ?

marko.justinek
2020-11-12 21:54
Could you use a regex matcher?

billal.patel
2020-11-13 10:31
has joined #pact-go

david.dias
2020-11-13 12:33
Sure, I think is the easiest one. The go package has dsl.UUID but I don't know how to combine matchers

matt.fellows
2020-11-13 12:45
Matchers can be nested. If you show us how you're wanting to use and I can help.

david.dias
2020-11-13 13:24
```WithRequest(dsl.Request{ Method: http.MethodGet, Path: dsl.Term("/v1/accounts/1", `\d+`), }).``` I want to switch this /1 and \d+ with the dsl.UUID(), all my endpoints are using UUID as id

david.dias
2020-11-13 16:20
Another strange thing is `Expected header "Content-Type" to match /application\/json/, but was nil`

david.dias
2020-11-13 16:20
but send the same request as pact is sending to provider api I'm getting the Content-Type header

louis.oliver
2020-11-16 10:33
has joined #pact-go

billal.patel
2020-11-16 14:45
@billal.patel has left the channel

ashishkujoy
2020-11-16 15:08
has joined #pact-go

pradeepchoube
2020-11-17 03:49
has joined #pact-go

meng-lingtao
2020-11-17 14:39
has joined #pact-go

pabvidcal
2020-11-17 15:30
has joined #pact-go

magesh.nagamani
2020-11-18 05:15
has joined #pact-go

jstoebel
2020-11-18 13:53
has joined #pact-go

daniel.sayer89
2020-11-19 10:33
has joined #pact-go

art.ptushkin
2020-11-19 10:34
has joined #pact-go

pact457
2020-11-19 10:36
has joined #pact-go

ajerthan.sivayoganath
2020-11-19 10:38
has joined #pact-go

philipchardwick
2020-11-19 11:05
has joined #pact-go

tanzmann
2020-11-19 11:09
has joined #pact-go

olivier.quere
2020-11-19 12:10
has joined #pact-go

wilfried.vandenberghe
2020-11-19 12:19
has joined #pact-go

alan.hanafy
2020-11-19 19:28
has joined #pact-go

michael.deutscher
2020-11-19 21:39
has joined #pact-go

gerry.power
2020-11-20 03:31
has joined #pact-go

alex900
2020-11-20 05:08
has joined #pact-go

tomas.panik
2020-11-20 08:28
has joined #pact-go

marc.ferland
2020-11-20 14:43
has joined #pact-go

sebastien.crapoulet
2020-11-20 15:24
has joined #pact-go

adutrillaux
2020-11-20 15:28
has joined #pact-go

he
2020-11-20 15:59
has joined #pact-go

ivgeni.slabkovski
2020-11-20 21:52
has joined #pact-go

serhatburakyildirim
2020-11-21 21:57
has joined #pact-go

alnasl
2020-11-22 18:46
has joined #pact-go

ashutosh23802
2020-11-23 06:20
has joined #pact-go

leonty
2020-11-23 10:33
has joined #pact-go

dariusz.piwko
2020-11-23 11:34
has joined #pact-go

praneeth.kumar
2020-11-23 16:18
has joined #pact-go

mark.white
2020-11-24 09:03
has joined #pact-go

ufuk.ozcelik
2020-11-24 14:58
has joined #pact-go

stefanos.varsanis
2020-11-24 16:48
has joined #pact-go

lalexander2810
2020-11-24 16:53
has joined #pact-go

sivaprasad9
2020-11-24 20:46
has joined #pact-go

scyr
2020-11-25 14:56
has joined #pact-go

timotheus.ruprecht
2020-11-25 22:12
has joined #pact-go

manali.mogre
2020-11-26 11:44
has joined #pact-go

erik.terpstra
2020-11-26 12:08
has joined #pact-go

kjayachandra2000
2020-11-26 20:40
has joined #pact-go

kjayachandra2000
2020-11-26 22:00
@kjayachandra2000 has left the channel

sushil.kumar
2020-11-27 01:45
has joined #pact-go

zhujian
2020-11-27 07:54
has joined #pact-go

h.octavian
2020-11-27 14:08
has joined #pact-go

noel
2020-11-28 23:12
has joined #pact-go

muraalee
2020-11-30 01:56
has joined #pact-go

pooja.sharma
2020-11-30 08:52
has joined #pact-go

mo
2020-11-30 09:24
has joined #pact-go

david.greene
2020-11-30 21:47
has joined #pact-go

bas
2020-12-01 09:00
has joined #pact-go

wainstead
2020-12-01 14:57
has joined #pact-go

jamescourtoy
2020-12-01 17:42
@matt.fellows Not a huge rush on our part, but I'm curious if you had a chance to look into the Go consumer-side code? I'm ok with verifying the Pacts using the Rust-based CLI verifier as well, so long as we can generate the consumer-side Pact files from a Go client.

jamescourtoy
2020-12-01 17:43
Also, I would love to be able to monitor progress on that in some way. I didn't notice it in the public roadmap anywhere.

zbintliff
2020-12-01 17:49
Hello! We have a _ton_ of code still on pact v0.0.13 and the migration to v1 is a pretty big effort since we need to touch every pact. Are there any migration scripts that can help us here?

jerobinson
2020-12-01 20:32
has joined #pact-go

matt.fellows
2020-12-01 20:39
:wave: Hi Zach!

matt.fellows
2020-12-01 20:40
Not yet, but you may want to avoid that migration - I?m not far away from having a native v3 version built

matt.fellows
2020-12-01 20:41
I?m aiming to have a beta out by xmas, but so far I?ve been able to get in 95% of the existing functionality across, plus all of the new v3 goodness

matt.fellows
2020-12-01 20:41
I?ll definitely write a migration guide from 1, i?ll have a look for 0.0.13 also (put on my list now)

zbintliff
2020-12-01 20:48
Ok, thanks! Its half our fault for letting it rot so long but we have a _ton_ jof pacts and a single "clients" repo. So all of our clients of our microservies are in there. meaning we have to migrate all or nothing

matt.fellows
2020-12-01 20:55
:wave:

matt.fellows
2020-12-01 20:55
So the main issue tracking the v3 upgrade is https://github.com/pact-foundation/pact-go/issues/142

matt.fellows
2020-12-01 20:56
My first pass was getting the basic end to end working - which happily is almost complete. I?ve got a PR for the Rust library (the shared engine for our languages) almost ready to ship for the provider side bindings

matt.fellows
2020-12-01 21:30
How far off are you from considering a spike to see how the new framework works? And also, what OS do you use?

matt.fellows
2020-12-01 21:31
The main activities for me at this point: ? Get the framework automatically downloading/installing the shared lib ? Tests for the new core engine (I was able to largely find a way to migrate existing bits and pieces) ? Release as beta

matt.fellows
2020-12-01 21:32
So I have actually added consumer message tests there, and it?s possibly/maybe workable

zbintliff
2020-12-01 21:32
run all our tests in deb stretch

zbintliff
2020-12-01 21:32
its not huge priorit for us. but getting bigger and bigger debt

matt.fellows
2020-12-01 21:33
It?s quite possible you could use just that specific bit of functionality now, because it doesn?t rely on the shared library - and the installation/version management of the lib is the last key bit of work before I can release a beta

matt.fellows
2020-12-01 21:33
Understand

matt.fellows
2020-12-01 21:33
is your whole code base homogenous as far as languages go?

zbintliff
2020-12-01 21:33
yep!

zbintliff
2020-12-01 21:33
with a makefile

matt.fellows
2020-12-01 21:34
cool, then I?d wait until early next year when this is out - this is first big move to our rust shared library, which is the strategic long term direction

zbintliff
2020-12-01 21:36
Oh, awesome

matt.fellows
2020-12-01 21:46
as an aside, have you ran into any ?I wish this feature existing? type thing with Pact Go yet?

zbintliff
2020-12-01 21:52
We need an overhaul and simplify everythinng. Which I think the project has done well we just can't get to it quite yet

zbintliff
2020-12-01 21:53
We have new engineers come in and pact is always hard to explain to them. But I think it gets better in new versions. just need to get there

jamescourtoy
2020-12-01 22:31
Nice! Excellent news, and thanks for the update :slightly_smiling_face:

matt.fellows
2020-12-01 23:37
When do you think you could test it out? I could provide an alpha tag and example for you to follow (but specifically for the message pact consumer)

matt.fellows
2020-12-01 23:37
That could be done in the next day or so

sumedhagamage
2020-12-02 03:33
has joined #pact-go

fealaer
2020-12-02 11:40
has joined #pact-go

fealaer
2020-12-02 11:58
@fealaer has left the channel

patrick.hendron
2020-12-02 14:44
has joined #pact-go

lpratt
2020-12-02 18:19
has joined #pact-go

sandragnzalez
2020-12-03 11:04
has joined #pact-go

kristian
2020-12-03 14:34
has joined #pact-go

me1466
2020-12-03 23:42
has joined #pact-go

wenfeng.li
2020-12-04 11:42
has joined #pact-go

jamescourtoy
2020-12-04 17:20
@matt.fellows I'm going to try and slot it into our next sprint ? we're doing sprint planning today. We typically do two-week sprints, so hopefully we will have time to do some testing either next week or the week after.

matt.fellows
2020-12-05 06:28
Cool! I'll get something out this week then, aim for the second week if you can

cdambo
2020-12-05 11:59
has joined #pact-go

gayatree.eee
2020-12-08 04:50
has joined #pact-go

c.pavan1986
2020-12-09 04:18
has joined #pact-go

william.pritchard
2020-12-09 15:28
has joined #pact-go

parveshchaudhary111
2020-12-09 17:54
has joined #pact-go

bheemreddy181
2020-12-09 18:52
Happy Holiday folks - Are there any examples around pact-go middleware for handling authorization ( Adding to incoming headers on the provider side )

jamescourtoy
2020-12-09 19:14
Thanks, @matt.fellows! The Go dev lead on my team is going to take a look at testing this out (when it's available) during some of our 20% "engineering time".

matt.fellows
2020-12-09 21:29
The go workshop has an example of that

matt.fellows
2020-12-10 02:20
Awesome, I?ll be looking at it tonight and will have something for you for next week :thumbsup:

w.sobasik
2020-12-10 10:39
has joined #pact-go


matt.fellows
2020-12-11 12:33
Few caveats worth noting: 1. The package is currently http://github.com/pact-foundation/pact-go/v3. It is likely to change, but should be a simple refactor down the track for you when its stable 2. The DSL is based on the current v2 one, so it will track fairly closely where possible to simplify upgrades etc. The new v3 matchers introduced are just an extension of the current ones, so there shouldn?t be many surprises. 3. The documentation is still all over the place - so if things aren?t clear let?s discuss here 4. The other HTTP interfaces (consumer/providers) are currently working, but the process to install the shared lib is currently manual (so basically, don?t use those features yet)

matt.fellows
2020-12-11 12:35
You?ll need to pin your go module to the specific versions for now, until I get a release process setup

jamescourtoy
2020-12-11 14:55
Thanks, Matt! I've forwarded this to my Go teammates and I'll get back with you in the next week or so on our experience :bow:

thanuxxxx
2020-12-12 22:41
has joined #pact-go

ian.hamilton
2020-12-13 06:53
has joined #pact-go

colm.j.murphy91
2020-12-13 07:02
has joined #pact-go

victoria.kruczek
2020-12-13 14:13
has joined #pact-go

wuddarwin
2020-12-14 05:23
has joined #pact-go

connor.aird
2020-12-14 15:52
has joined #pact-go

arman.najafian
2020-12-14 15:52
has joined #pact-go

praveen.lakkaraju
2020-12-14 16:12
has joined #pact-go

alejandro.germain
2020-12-14 16:26
has joined #pact-go

alejandro.germain
2020-12-14 16:30
(solved)

josh.ellinger
2020-12-15 01:22
has joined #pact-go

ufuk.ozcelik
2020-12-15 08:22
@ufuk.ozcelik has left the channel

nikitsenka
2020-12-15 09:35
has joined #pact-go

hibahawes
2020-12-15 09:53
has joined #pact-go

sarvar
2020-12-15 14:24
has joined #pact-go

suruchipatidar14
2020-12-16 05:35
has joined #pact-go

smatheson
2020-12-16 06:33
has joined #pact-go

olayemifolakemi
2020-12-16 15:23
has joined #pact-go

ania.kovalchuk
2020-12-17 00:09
has joined #pact-go

writetojoshma
2020-12-17 05:52
has joined #pact-go

rejeesh.g
2020-12-17 11:07
has joined #pact-go

lukas.kempec
2020-12-17 12:45
has joined #pact-go

vikas543
2020-12-17 16:28
has joined #pact-go

bpugh
2020-12-17 17:05
has joined #pact-go

jeff.burmood
2020-12-19 17:45
has joined #pact-go

kyle.florence
2020-12-19 19:21
has joined #pact-go

ankurmalik22
2020-12-19 21:14
has joined #pact-go

vsukumaran
2020-12-20 01:56
has joined #pact-go

omer.morad
2020-12-20 08:10
has joined #pact-go

ringo
2020-12-20 10:51
has joined #pact-go

omer.moradd
2020-12-20 18:01
has joined #pact-go

bheemreddy181
2020-12-20 19:41
Quick question on writing contract tests, are these good contract tests like if i have a request body like below - Can i write contracts for different request_types as they have different functionality on my provider side - but the response for each request type will look the same ? ```"body": { "request_type": "access" }```

matt.fellows
2020-12-20 23:25
Without more context, I would probably use a regex on that field (e.g. treat it as an enum), and have tests for different HTTP status codes (if necessary)

matt.fellows
2020-12-20 23:26
There is some guidance around this at https://docs.pact.io/consumer

bheemreddy181
2020-12-21 00:20
What kind of context you are looking at ? The problem is upto extent I go with writing these tests

matt.fellows
2020-12-21 00:23
I suppose without deep domain insight we can only go with general advice

matt.fellows
2020-12-21 00:23
If the only difference in that field is functional behaviour, I?d say it?s gone past ?contract? and into ?functional? testing, in which case those should be tests in the provider?s own code base

bheemreddy181
2020-12-21 00:31
I agree - there is some context where consumer says that what if tomorrow you drop one of those request-types or broken request types how will consumer know about these ? I felt the same where we are actually entering into functional testing

matt.fellows
2020-12-21 06:00
Well, that is contractually important: > Only make assertions about things that will affect the consumer if they change from those docs above. If indeed the values there are significant, then you do want to capture the various scenarios. I don?t know the context in which the API is used, but you could have various scenarios such as: _?when the request type is ?access? ??_ _?when the request type is ?logout? ??_

matt.fellows
2020-12-21 06:00
so in a way, they are right. There is a grey line between contract-testing and functional tests (much in the way that most tests types tend to have overlapping regions of others)

souravsen1
2020-12-21 11:28
has joined #pact-go

bheemreddy181
2020-12-21 17:10
At times it is hard to figure out the grey line around are going really above the grey line or are we really right near the grey line

andoni.arroyo
2020-12-21 17:51
has joined #pact-go

bheemreddy181
2020-12-21 23:03
I think go example workshop needs to have a middleware due of this authentication https://github.com/pact-foundation/pact-workshop-go/blob/master/consumer/client/client_pact_test.go#L21

bheemreddy181
2020-12-22 00:22
Or am i reading this wrong ?

matt.fellows
2020-12-22 00:27
yep, it does have middleware - do you need some pointers?

bheemreddy181
2020-12-22 00:27
when ever i run `make run-consumer` i get 401 error ```? pact-workshop-go git:(master) ? make run-consumer 2020/12/21 18:24:28 unauthorized exit status 1 make: *** [run-consumer] Error 1```

bheemreddy181
2020-12-22 00:28
i am not sure if i need to modify something or if i am missing something from documentation

matt.fellows
2020-12-22 00:28
right

matt.fellows
2020-12-22 00:28
which step are you in?

bheemreddy181
2020-12-22 00:30
step 4

matt.fellows
2020-12-22 00:36
you shouldn?t be able to get that error in step 4

matt.fellows
2020-12-22 00:36
are you in the branch `step4`?

matt.fellows
2020-12-22 00:37
(there is no token in step 4 yet, we introduce that in https://github.com/pact-foundation/pact-workshop-go/tree/step8)

matt.fellows
2020-12-22 00:38
Perhaps you still have the provider running from when you were in `master`?

matt.fellows
2020-12-22 00:42
(I did just noticed though that the consumer from step8 onwards was producing a bad actual bearer token value, and just pushed that up)

bheemreddy181
2020-12-22 00:42
Ah make sense got it

matt.fellows
2020-12-22 00:44
After the first few steps, you don?t really need to run those commands anymore (but still good for them to be working of course!)

theovanessen
2020-12-22 10:47
has joined #pact-go

stuart3166
2020-12-22 12:35
has joined #pact-go

winfante
2020-12-22 22:51
has joined #pact-go

lars.bonnes
2020-12-23 13:05
has joined #pact-go

eungjun.yi
2020-12-25 14:25
has joined #pact-go

ebanster
2020-12-27 13:18
has joined #pact-go

onur.baskirt
2020-12-28 10:48
has joined #pact-go

bheemreddy181
2020-12-28 18:27
I using the make file from Go workshop still see error with cli tool versions ```2020/12/28 12:20:22 [DEBUG] 3.6.2 satisfies constraints 3.6.2 >= 3.5.0, < 4.0.0 2020/12/28 12:20:22 [INFO] checking pact-provider-verifier within range >= 1.31.0, < 2.0.0 2020/12/28 12:20:22 [DEBUG] running binary pact-provider-verifier 2020/12/28 12:20:23 [DEBUG] checking version for binary pact-provider-verifier version 1.30.1 2020/12/28 12:20:23 [DEBUG] checking if version 1.30.1 within semver range >= 1.31.0, < 2.0.0 2020/12/28 12:20:23 [ERROR] CLI tools are out of date, please upgrade before continuing``` Am i missing something - this is install config i am using https://github.com/pact-foundation/pact-workshop-go/blob/step4/Makefile#L5

bheemreddy181
2020-12-28 20:47
^ this message can be ignored - my PATH was referring to an older version

bheemreddy181
2020-12-28 23:29
Quick question on dsl.match in go - As per the workshop test here https://github.com/pact-foundation/pact-workshop-go/blob/master/consumer/client/client_pact_test.go#L67 it looks like it looks for all fields in User struct , what if one of the field is optional ? how do we handle such cases do we need to be explicit for such cases or just say `Omitempty` on the struct

matt.fellows
2020-12-28 23:35
`Match` is really a simplified version of the usual matchers. If you have variations on the contract, Match is not going to be flexible enough.

matt.fellows
2020-12-28 23:36
But yes, we should be compliant with `omitempty` , but that won?t test both when it is and is not present

massimo.daros
2020-12-29 13:18
has joined #pact-go

chris.fullinwider
2020-12-29 18:15
has joined #pact-go

bheemreddy181
2020-12-29 20:29
Pact Header Matchers error out even if there is a header in the response ```2020/12/29 14:24:06 [TRACE] proxied server response HTTP/1.1 204 No Content Content-Type: application/json Date: Tue, 29 Dec 2020 20:24:06 GMT``` Sample response i see in the logs but the matcher fails ```Expected header "Content-Type" to match /application\/json/, but was nil``` Am i missing something here

bheemreddy181
2020-12-29 20:37
Or is the idea is to ignore headers when there is no content response ?

matt.fellows
2020-12-29 21:13
Looks like the regex is wrong. Can you please share the pact file or consumer test matcher?

bheemreddy181
2020-12-29 22:32
Here is the interaction ```{ "description": "blah", "providerState": "user does not exist", "request": { "method": "GET", "path": "/v1/snail_mail", "headers": { "Accept": "application/json; charset=utf-8", "Content-Type": "application/json; charset=utf-8" }, "matchingRules": { "$.headers.Accept": { "match": "regex", "regex": "application\\/json" }, "$.headers.Content-Type": { "match": "regex", "regex": "application\\/json" } } }, "response": { "status": 204, "headers": { "Content-Type": "application/json; charset=utf-8" }, "matchingRules": { "$.headers.Content-Type": { "match": "regex", "regex": "application\\/json" } } } }```

bheemreddy181
2020-12-29 22:38
And consumer matcher here ```pact. AddInteraction(). Given("user does not exist"). UponReceiving("blah"). WithRequest(request{ Method: "GET", Path: dsl.String("/v1/snail_mail"), Headers: requestCommonHeaders, }). WillRespondWith(dsl.Response{ Status: 204, Headers: responseCommonHeaders, })```

bheemreddy181
2020-12-29 22:38
```var responseCommonHeaders = dsl.MapMatcher{ "Content-Type": term("application/json; charset=utf-8", `application\/json`), }```

bheemreddy181
2020-12-29 22:38
This is taken from go workshop examples

matt.fellows
2020-12-30 01:04
:thinking_face:

matt.fellows
2020-12-30 01:05
Could be a framework thing. Let's face it, 204 literally means no content. So matching on that header is useless

matt.fellows
2020-12-30 01:05
I'd drop it from the consumer test altogether because it is meaningless

bheemreddy181
2020-12-30 01:50
Interestingly this doesn?t happen for 200 response codes so I assumed it is because of 204 no content

piotr.soltysiak
2020-12-30 16:55
has joined #pact-go

adrian.przybyla
2021-01-04 13:41
has joined #pact-go

dcorrales
2021-01-04 22:06
has joined #pact-go

jokubas.lekevicius
2021-01-04 22:10
has joined #pact-go

matt195
2021-01-05 16:35
has joined #pact-go

rafael.manzoni
2021-01-05 17:56
has joined #pact-go

animesh2712
2021-01-05 19:29
has joined #pact-go

info
2021-01-06 01:55
has joined #pact-go

pascal.libenzi
2021-01-06 10:57
has joined #pact-go

brett
2021-01-06 18:55
has joined #pact-go

josh.rosenfeld
2021-01-06 19:39
has joined #pact-go

carlo
2021-01-07 13:24
has joined #pact-go

andrewshtamburg
2021-01-07 16:03
@andrewshtamburg has left the channel

danny.porrello
2021-01-07 16:48
has joined #pact-go

dawood.abbas
2021-01-08 07:00
has joined #pact-go

victoria.kruczek
2021-01-10 16:36
@victoria.kruczek has left the channel

cksharma122
2021-01-10 17:19
has joined #pact-go

caiquedpfc
2021-01-11 04:05
has joined #pact-go

henrik.rudstrom
2021-01-11 18:30
has joined #pact-go

eric
2021-01-12 10:23
has joined #pact-go

fnguyen
2021-01-13 00:39
has joined #pact-go

pollet_22
2021-01-13 16:04
has joined #pact-go

dshattuck
2021-01-13 20:49
has joined #pact-go

thomas.rosati
2021-01-13 21:58
has joined #pact-go

rahulsmalpani
2021-01-14 07:56
has joined #pact-go

sacha.camfferman768
2021-01-14 09:42
has joined #pact-go

brandonbeard86
2021-01-14 22:10
has joined #pact-go

geetishnayak
2021-01-15 01:02
has joined #pact-go

shettyg
2021-01-15 14:18
has joined #pact-go

natarajang1
2021-01-15 15:29
has joined #pact-go

michel.neufeglise
2021-01-18 08:55
has joined #pact-go

bart.boersma
2021-01-18 10:48
has joined #pact-go

monica.wu
2021-01-19 06:25
has joined #pact-go

makobernal
2021-01-19 08:23
has joined #pact-go

jibrail.idris
2021-01-19 10:11
has joined #pact-go

jmvb.registros
2021-01-19 11:01
has joined #pact-go

tpham
2021-01-19 22:36
has joined #pact-go

vishal.grover
2021-01-20 03:12
has joined #pact-go

priya.saraf
2021-01-20 08:43
has joined #pact-go

fahad.aj.khan
2021-01-20 08:58
has joined #pact-go

nicole.jaenchen
2021-01-20 09:38
has joined #pact-go

dinakaran.ulaganathan
2021-01-20 13:59
has joined #pact-go

ptsiakos77
2021-01-20 21:55
has joined #pact-go

mhdtouban
2021-01-21 01:58
has joined #pact-go

veeraprathap.n
2021-01-21 04:10
has joined #pact-go

tsiakos
2021-01-21 09:24
has joined #pact-go

oleg
2021-01-21 13:05
has joined #pact-go

zbintliff
2021-01-21 20:55
Hello Again. We finally are prioritizing upgrading our pact from v0.12 to XXX. Wondering what you recommedn the XXX be? I see 1.12 is commongly used and I heard there is a v3 coming. Is there anywhere I can see about the new features of v3 and potential timelien?

matt.fellows
2021-01-22 06:53
:wave:

matt.fellows
2021-01-22 06:53
Hello!

matt.fellows
2021-01-22 06:54
I was hoping to have the v3 features live by xmas, but didn?t get the time in front of the computer (apparently it?s anti-social family behaviour)

matt.fellows
2021-01-22 06:54
I have an OSS day coming up in the next week or two, and I should be able to get a beta release of the new stuff out.

matt.fellows
2021-01-22 06:54
I would suggest moving straight to it, because why do it more than once.

matt.fellows
2021-01-22 06:55
How would you prioritise the need between combinations of: ? consumer ? provider ? http ? message

thomas.powell
2021-01-22 10:18
has joined #pact-go

zbintliff
2021-01-22 14:37
That is awesome, thank you. To make sure we are on the same page this is just a library upgrade and not a spec upgrade? So we can upgrade the consumers first and still work with existing contracts? We are coming from an old version so we've really only interacted with consumers and providers. Where the consumers defined the message. (we are still even using the ruby mock server for verification). I think we may wait for a bit look at everything and redesign our entire approach to pact so we can start anywhere but being able to see the whole picture may help with design and implimentation.

stefan.selent
2021-01-23 01:54
has joined #pact-go

matt.fellows
2021-01-23 02:03
Yes, it's a just a new version of Pact Go and you can stick with V2 or move to v3 spec when the time is appropriate.

matt.fellows
2021-01-23 02:04
I'll get the provider side done first because I think that will be easier for you to test and swap

matt.fellows
2021-01-23 02:04
It's also less effort I think on my side

paulo
2021-01-25 11:37
has joined #pact-go

kmckeever
2021-01-25 14:38
has joined #pact-go

robert.land
2021-01-25 19:25
has joined #pact-go

aparnachaudhari
2021-01-25 21:34
has joined #pact-go

aparnachaudhari
2021-01-25 21:36
Hello all! I am starting to look at pact-go to implement contract based testing on our existing microservices (I know thats not ideal - but we have to start somewhere!).. I am fairly new to golang and to pact. What would be a good place to start ?

matt.fellows
2021-01-25 22:14
Start with a consumer test :slightly_smiling_face:


matt.fellows
2021-01-25 22:14
We have a golang workshop if you have time. See howtolearn

2021-01-25 22:14
Here are a number of useful hands-on labs that teach all of the key concepts https://docs.pact.io/implementation_guides/workshops

matt.fellows
2021-01-25 22:15
Takes a couple of hours, but it?s worth it because you can self guide through all of the key concepts

gwhill7
2021-01-25 23:23
has joined #pact-go

bibinc99
2021-01-26 14:37
has joined #pact-go

luisc.barretog
2021-01-27 00:42
has joined #pact-go

laxmi.somni508
2021-01-27 10:27
has joined #pact-go

ryanding16
2021-01-27 20:25
has joined #pact-go

athurner
2021-01-28 13:55
has joined #pact-go

alex.mcnair
2021-01-28 18:35
has joined #pact-go

mailinglistsspammedme
2021-01-28 23:30
has joined #pact-go

steven.beaver.retail
2021-01-29 15:34
has joined #pact-go

ekberli.elbrus
2021-01-30 16:33
has joined #pact-go

matt.fellows
2021-02-01 01:28
For anybody interesting in testing strategies for APIs written in Go (not sure if Pact will be part of the talk, but Anton?s a smart guy!)

george.south
2021-02-01 21:12
has joined #pact-go

aparnachaudhari
2021-02-03 02:09
I am trying to install pact for go locally but am running into errors

aparnachaudhari
2021-02-03 02:11
```go get http://gopkg.in/pact-foundation/pact-go.v1 Error: # cd /Users/<username>/Projects/golang/src/github.com/pact-foundation/pact-go; git pull --ff-only There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details. git pull <remote> <branch> If you wish to set tracking information for this branch you can do so with: git branch --set-upstream-to=origin/<branch> master package http://github.com/pact-foundation/pact-go/command: exit status 1```

aparnachaudhari
2021-02-03 02:11
am I missing something here?

matt.fellows
2021-02-03 02:20
:man-shrugging:

matt.fellows
2021-02-03 02:20
looks like an issue with git?

aparnachaudhari
2021-02-03 02:22
am I needing to set upstream to https://github.com/pact-foundation/pact-go.git here?

matt.fellows
2021-02-03 02:23
It looks like maybe the existing package you have is corrupted or something


matt.fellows
2021-02-03 02:24
so one option could be to remove whatever is already there and try again

aparnachaudhari
2021-02-03 02:29
:disappointed: that did not help

matt.fellows
2021-02-03 02:33
what does `git remote -v` show in the pact-go directory show?

matt.fellows
2021-02-03 02:34
anyway, seems like a strange git problem

matt.fellows
2021-02-03 02:35
try this in the pact-go dir: ```git branch --set-upstream-to=origin/master master```

matt.fellows
2021-02-03 02:44
Those instructions could probably also be updated now that `go mod` is the defacto

twierzchowski
2021-02-03 07:05
has joined #pact-go

yassin.hajaj
2021-02-03 10:35
has joined #pact-go

dany.marques90
2021-02-03 12:48
has joined #pact-go

marcelo
2021-02-03 13:11
has joined #pact-go

aparnachaudhari
2021-02-03 16:43
Sorry had to stop last night, but considering I am still fairly new to go, I am trying to figure this out.

aparnachaudhari
2021-02-03 16:43
Will update here if I do

aparnachaudhari
2021-02-03 17:09
So it looks like I already had a corrupt package that I had to remove ```rm -rf src/gopkg.in/pact-foundation/pact-go.v1```

aparnachaudhari
2021-02-03 17:10
and then did a `go get` again.

aparnachaudhari
2021-02-03 17:10
Also, using the module name for `go get` make more sense I think ```go get http://github.com/pact-foundation/pact-go```

sandeeparthur
2021-02-03 19:46
has joined #pact-go

aparnachaudhari
2021-02-03 23:20
I am having a really hard time getting started off with writing a simple POC pact test between 2 of our existing microservices.. I am looking at https://docs.pact.io/implementation_guides/go/readme and https://github.com/pact-foundation/pact-workshop-go but it looks like it skims over a lot of stuff.. please bear in mind I am new to go .. which is not helping either

aparnachaudhari
2021-02-03 23:20
anyone know of any other resources - real world implementations I can look at ?

aparnachaudhari
2021-02-04 00:14
`2021/02/03 16:00:17 [ERROR] CLI tools are out of date, please upgrade before continuing` I am seeing this error locally when trying to run `go test -v -run TestProvider` from the pact-go examples folder

matt.fellows
2021-02-04 01:22
I?d say the workshop is going to be a better starting point. If you don?t know Go well, then that?s obviously another barrier. What language do you know well?

matt.fellows
2021-02-04 01:23
have a look at https://docs.pactflow.io/docs/tutorials/. There is a JS and Java tutorial there you can run in the browser. This should help with the basics of Pact, without needing to run anything on your laptop. It takes 15-20mins to run through in a browser

matt.fellows
2021-02-04 01:23
On your specific issue, this means you haven?t installed the binary dependencies required by Pact

matt.fellows
2021-02-04 01:24
Step (1) is downloading the CLI tools and adding to your `PATH` (https://github.com/pact-foundation/pact-go/#installation)

matt.fellows
2021-02-04 01:24
The error you?re seeing, is that Pact cannot find these tools. So you have either a) not downloaded and added them to the path or b) incorrectly set the PATH, and the process you are executing Pact within can?t find them

matt.fellows
2021-02-04 01:25
never fear, we?ll get you going

aparnachaudhari
2021-02-04 02:15
Python is my strong suite

matt.fellows
2021-02-04 02:22
hmm not sure if we have a python workshop/tutorial

matt.fellows
2021-02-04 02:22
howtoexamples


matt.fellows
2021-02-04 02:22
:point_up: there is a python example there, but no tutorial to accompany it

aparnachaudhari
2021-02-04 02:28
That was it! I had my PATH going to the incorrect `pact/bin`

aparnachaudhari
2021-02-04 06:38
Leaving this here for later, I see the error below? ``` Error on Verify: Actual interactions do not match expected interactions for mock MockService.```

aparnachaudhari
2021-02-04 06:41
If I am understanding this correctly, what its saying is that the function that I called in the pact.Verify is not making the same call as what I have in the WithRequest section?

octoberclub
2021-02-04 16:27
has joined #pact-go

slavick
2021-02-04 17:21
has joined #pact-go

imran.settuba
2021-02-04 18:57
has joined #pact-go

christopher.roberts
2021-02-05 01:02
has joined #pact-go

aparnachaudhari
2021-02-05 04:54
I am trying to understand https://docs.pact.io/pact_broker/docker_images/pactfoundation if I have to spin up a packbroker in our local infra as a docker image, am I running the db instance separately? We host our services on k8's

matt.fellows
2021-02-05 05:06
I would have the database run separately for sure.

matt.fellows
2021-02-05 05:06
It's a persistent store so you need to backup etc

matt.fellows
2021-02-05 05:07
Otherwise there is http://Pactflow.io as a SaaS

aparnachaudhari
2021-02-05 05:24
gotcha, yea thats what I figured. Is there any information how to set up the needed database schema in documents? May be I am not seeing it?

matt.fellows
2021-02-05 05:25
Probably best asking in #pact-broker

aparnachaudhari
2021-02-05 05:25
will do, thank you

matt.fellows
2021-02-05 05:25
Should be there somewhere. Just needs a user with all privileges and a databases created. The broker will then bootstrap itself


matt.fellows
2021-02-05 05:26
That help?

aparnachaudhari
2021-02-05 05:28
Thank you, also interesting.. just setting up `psql postgres -c "CREATE DATABASE pact_broker;` I think I was looking for the db schema.. i.e. tables etc..

aparnachaudhari
2021-02-05 05:28
I think I need to dig more into the docs


matt.fellows
2021-02-05 06:59
yes. You don?t need to setup the schema, the broker will do it automatically

r.darcel
2021-02-05 09:15
has joined #pact-go

ashish.joshi
2021-02-06 01:07
has joined #pact-go

przemek.sech296
2021-02-08 23:18
has joined #pact-go

vplows
2021-02-09 06:00
has joined #pact-go

rodney.stromlund
2021-02-09 16:18
has joined #pact-go

nada
2021-02-09 19:00
has joined #pact-go

siddhardhan
2021-02-09 20:21
has joined #pact-go

lars.hisken916
2021-02-10 08:08
has joined #pact-go

pauligoe10
2021-02-10 08:19
has joined #pact-go

tusharvarm
2021-02-10 09:38
has joined #pact-go

igorsharf
2021-02-10 10:39
has joined #pact-go

kieran
2021-02-10 17:13
has joined #pact-go

poward
2021-02-10 18:17
has joined #pact-go

ckhadilkar
2021-02-10 21:16
has joined #pact-go

neild
2021-02-11 18:53
has joined #pact-go

painenigowthami
2021-02-11 22:32
has joined #pact-go

stephenkilbourn
2021-02-11 23:02
has joined #pact-go

tcarlson
2021-02-11 23:05
has joined #pact-go

fnguyen
2021-02-12 01:34
@fnguyen has left the channel

r.strauch
2021-02-12 10:15
has joined #pact-go

ztlboy05
2021-02-12 14:57
has joined #pact-go

smith260194
2021-02-12 15:22
has joined #pact-go

dabfleming
2021-02-12 20:34
has joined #pact-go

dabfleming
2021-02-12 21:56
Hey, so I'm having some difficulty getting a consumer test setup, I'm trying to build up to what I need starting with some basic example code. It works validating the method & path of the request, but as soon as I add `Request.Body` to the `WithRequest()` call I'm having trouble. I keep seeing a 500 response from the pact server with no additional information about what's going wrong.

matt.fellows
2021-02-12 22:26
What does the log file say?

matt.fellows
2021-02-12 22:29
Usually the log file will show the request and why it mismatched

matt.fellows
2021-02-12 22:29
Could you also please share the code? That might help too

prasanthp
2021-02-13 00:45
has joined #pact-go

bhardwajdiwakar
2021-02-14 22:38
has joined #pact-go

hiteshpatadia
2021-02-15 06:29
has joined #pact-go

vikrant.sarkaniya
2021-02-15 13:31
has joined #pact-go

lemitrou
2021-02-15 14:20
has joined #pact-go

helloraj
2021-02-16 08:09
has joined #pact-go

dabfleming
2021-02-16 17:05
Ok, so making some progress, especially looking at the log file to see the info on the difference between expected vs actual. Is there a way to get pact to *not* care about additional key/values in the json of a response? Ex Actual JSON response: ```{ "foo": "string1", "bar": "string2" }``` And in my code: ```Body: dsl.EachLike(map[string]interface{}{ "foo": "string1" }, 1),``` Then in my log: ```Description of differences -------------------------------------- * Did not expect the key "bar" to exist at $.body[0]``` I want to match the stuff that I specify, but I basically don't care if there are extra values.

jamesmlucas
2021-02-16 19:29
has joined #pact-go

gabe707
2021-02-16 20:31
has joined #pact-go

wangpei9679
2021-02-16 21:29
has joined #pact-go

matt.fellows
2021-02-16 23:02
so yes, Pact does not care about additional attributes (see documentation about our implementation of Postel?s Law)

matt.fellows
2021-02-16 23:02
what?s going on here is that you?re saying the root of the JSON response should be an array

matt.fellows
2021-02-16 23:03
i.e. ```[ { "foo": "string1" } ]```

geir
2021-02-16 23:03
has joined #pact-go

matt.fellows
2021-02-16 23:05
is that right?

dabfleming
2021-02-16 23:05
My bad in trying to simplify my example... also I think I'm mixing request and response a bit.. I'll try and get a cleaner example in a bit.

matt.fellows
2021-02-16 23:05
ok thanks

matt.fellows
2021-02-16 23:05
it should be possible, if you can share the code I?m sure we can get to the bottom of it

soruma.net
2021-02-17 05:58
has joined #pact-go

therimpact
2021-02-17 12:30
has joined #pact-go

dabfleming
2021-02-17 15:24
Ok, so to try and clear this up... here's a better copy of what's going on... The request coming from my consumer: ```[ { "important": "foo", "unimportant": null } ]``` Go Code: ```pact. AddInteraction(). UponReceiving("This request"). WithRequest(dsl.Request{ Method: "POST", Path: dsl.String("/path/to/endpoint"), Headers: dsl.MapMatcher{...}, Body: dsl.EachLike(map[string]interface{}{ "important": "foo", // --- "unimportant": nil, // We don't care about `unimportant` -- we don't even care if // it is in the request. But if we remove it from the spec // pact fails the test complaining `* Did not expect the key "unimportant" to exist at $.body[0]` }, 1), }). WillRespondWith(...)```

mark.doppelfeld
2021-02-17 19:34
Hi, in our company we are forced to run our own pact broker and due to network setup this is not reachable via our standard http_proxy but needs to be excluded via no_proxy. With that approach I do can get http access to it. When trying to do a ```pact.VerifyMessageProvider``` I do get an http 503 which I assume comes from handling the proxy/no_proxy not in the way I need it to be. Any chance to configure this settings somehow? A colleague of mine, sitting in another network segment without proxy has no issues doing the verification. I tried to search here and the google way, but couldn't find anything that seems to match my situation. Thanks & best

dabfleming
2021-02-17 21:33
I apologize if I've missed something, but is there a way to publish a pact to a broker without first writing the file to disk? Seems like you have to do: ```pact.WritePact() pub := dsl.Publisher{} pub.Publish(types.PublishRequest{...})``` It would make a lot more sense to me if I could just do something like `pact.PublishTo(brokerURL)`

andrzej.igielski
2021-02-17 21:41
has joined #pact-go

matt.fellows
2021-02-17 21:42
Ah, so pact won't let you ignore something in a request if your code actually sends it. You must either include it in the spec, or not have your code send it

matt.fellows
2021-02-17 21:42
Additional values in the real response from the provider is ok

matt.fellows
2021-02-17 21:42
We follow Postels law here: be conservative in what you send, be liberal in what you expect

dabfleming
2021-02-17 21:43
Ok, gotcha. That makes sense.

matt.fellows
2021-02-17 21:44
Otherwise we can't be sure that field doesn't change behaviour in some important way

matt.fellows
2021-02-17 21:44
It's not, but that's a fair enough idea

matt.fellows
2021-02-17 21:45
We could look to change in next major release

matt.fellows
2021-02-17 21:45
If you care enough, please raise a feature request and we can look

dabfleming
2021-02-17 21:46
Yeah, when dealing with a broker it's a little awkward to have to write a file to disk as a middle step.

matt.fellows
2021-02-17 23:19
hmmm that?s a good question

matt.fellows
2021-02-17 23:19
I believe the go client should respect proxy configuration by default


matt.fellows
2021-02-17 23:19
but perhaps it needs a way to configure the http client more completely?

mikewagner21
2021-02-18 03:15
has joined #pact-go

khandelwalbhushan
2021-02-18 08:10
has joined #pact-go

mark.doppelfeld
2021-02-18 09:19
It seems so . I had a look at the TLS config thing and passing proxy / no_proxy information might be helpful. How shall I proceed with this?

aniket.agarwal
2021-02-18 09:21
has joined #pact-go

matt.fellows
2021-02-18 09:40
I'm assuming you have the correct http proxy settings in the environment?

matt.fellows
2021-02-18 09:40
This seems to suggest the solution if Env Vara don't fix: https://stackoverflow.com/questions/44291191/bypassing-http-proxy-in-golang

matt.fellows
2021-02-18 09:41
Actually, scrap that

matt.fellows
2021-02-18 09:41
It will actually be a Ruby issue

matt.fellows
2021-02-18 09:41
Can you please print out any logs you have?

arpit.modani
2021-02-18 09:43
has joined #pact-go

byronth
2021-02-18 11:45
has joined #pact-go

isa.levine
2021-02-18 23:37
has joined #pact-go

r.strauch
2021-02-19 08:41
@r.strauch has left the channel

brian.pfretzschner
2021-02-19 10:15
has joined #pact-go

bheemreddy181
2021-02-19 17:48
Just curious when we ask provider to verify the pact with a give pact url i feel provider is verifying other versions of consumer as well

bheemreddy181
2021-02-19 17:51
if you look at when master pact was pusblished vs when the pact was verified i feel the provider is sending verification to all pact / it may be verifying all pacts

dabfleming
2021-02-19 19:32
From the Go lib... ```// PactFileWriteMode specifies how to write to the Pact file, for the life // of a Mock Service. // "overwrite" will always truncate and replace the pact after each run // "merge" will append to the pact file, which is useful if your tests // are split over multiple files and instantiations of a Mock Server // See https://github.com/pact-foundation/pact-ruby/blob/master/documentation/configuration.md#pactfile_write_mode PactFileWriteMode string``` But the linked docs are: > Default value: `:overwrite` Options: `:overwrite`, `:update`, `:smart`, `:none` No mention of `merge` as in the go docs. Merge seems to work when I tested, do the docs need an update? Since this is acting on the broker I'd assume these are standard across all implementations.

bheemreddy181
2021-02-19 20:11
Provider Implementation

bheemreddy181
2021-02-19 20:11
logs

bheemreddy181
2021-02-19 20:11
i feel like when there is an input pact_url the master tag should be completely ignored

matt.fellows
2021-02-19 22:47
It uses what you configure, so if you pass in both it's going to verify both

matt.fellows
2021-02-19 22:48
I'd suggest if you don't want that behaviour to guard against it. We usually use environment variables to toggle that behaviour e.g. if a Pact URL is present (for a triggered webhook) then we don't fetch

matt.fellows
2021-02-19 22:49
We can't assume any behaviour here, so that's why it validates all

matt.fellows
2021-02-19 22:52
It's actually a local operation in the pact file

matt.fellows
2021-02-19 22:53
Good question tho. Can you please raise an issue?

bheemreddy181
2021-02-19 22:53
i feel like if pact_url is set then it shouldn't pull the master tag or other tests

matt.fellows
2021-02-19 22:53
But why?

matt.fellows
2021-02-19 22:53
We can't infer why you'd like to do that. It's completely legitimate to do both and entirely in your control

bheemreddy181
2021-02-19 22:54
PACT_URL is present when webhook triggers that means it want only that pact to be verified

matt.fellows
2021-02-19 22:54
Sure, but you can also use it in many other contexts.

bheemreddy181
2021-02-19 22:54
why is this different from ruby vs go

matt.fellows
2021-02-19 22:55
Is it?

matt.fellows
2021-02-19 22:55
:thinking_face:

bheemreddy181
2021-02-19 22:55
see here for example

matt.fellows
2021-02-19 22:55
If Ruby does that, I disagree with it and am surprised if it's the case. Pact JS has the exact same behaviour as does Pact JVM

bheemreddy181
2021-02-19 22:56
may be we are running different tasks in ruby for each then

matt.fellows
2021-02-19 22:56
Is it causing a problem?

bheemreddy181
2021-02-19 22:56
you mean verifying all contracts ?

matt.fellows
2021-02-19 22:56
Yeah

bheemreddy181
2021-02-19 22:57
it is not giving proper insights on the UI and the slack notification tells we verified all contracts

matt.fellows
2021-02-19 22:57
In any case, all that is required to change is an if/else statement

matt.fellows
2021-02-19 22:57
What you mean by insights in the UI?

bheemreddy181
2021-02-19 22:58
So you mean if PACT_URL is present don't set the master tags ?

bheemreddy181
2021-02-19 23:02
Another question here


bheemreddy181
2021-02-19 23:02
from this why all three pacts were verified ?

bheemreddy181
2021-02-19 23:03
isn't it only verify the test pacts ?

bheemreddy181
2021-02-19 23:03
or is it sending verification_results to all ?

matt.fellows
2021-02-19 23:04
I can't tell why it's verifying from that. But if the contents are the same across versions then it will appear as though it verified multiple when in fact the result is applied to all

bheemreddy181
2021-02-19 23:06
i feel the results should be applied to the ones which are verified only rather than applying to all the pact with same content

bheemreddy181
2021-02-19 23:06
what do you think ?

matt.fellows
2021-02-20 01:29
That?s one of the biggest benefits though. If the contract content hasn?t changed, a consumer won?t be blocked next time they call `can-i-deploy`

matt.fellows
2021-02-20 01:30
conceptually, you think you?re publishing a new contract. But the broker doesn?t see it this way. It says ?I?ve seen this contract befor, so I?m just going to associate the consumer version with it?. Because the contract has been verified, any consumer version that has the same contract is deployable

matt.fellows
2021-02-20 01:30
Otherwise, each time a consumer goes to deploy and publishes a contract, it will have to wait for a provider to verify it, even though we know the contract is compatible with the deployed provider

matt.fellows
2021-02-20 02:07
Back on the original topic though, and for clarity - you're doing the right thing with respect to the flow

chitra.adikesavan
2021-02-20 15:50
has joined #pact-go

mark.doppelfeld
2021-02-20 18:23
That's all I got

mark.doppelfeld
2021-02-20 18:23
``` STDERR: Error reading file from http://pact-broker.xxxxx.yyyyy/pacts/provider/pao-ip-pool-manager/consumer/pao-switch-controller/version/1.2.0 HTTP request failed: status=503 /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.1/lib/pact/consumer_contract/pact_file.rb:67:in `block in get_remote_with_retry' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.1/lib/pact/consumer_contract/pact_file.rb:60:in `times' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.1/lib/pact/consumer_contract/pact_file.rb:60:in `get_remote_with_retry' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.1/lib/pact/consumer_contract/pact_file.rb:41:in `render_pact' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.1/lib/pact/consumer_contract/pact_file.rb:22:in `read' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/provider/pact_source.rb:16:in `pact_json' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/provider/pact_spec_runner.rb:115:in `collect' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/provider/pact_spec_runner.rb:115:in `pact_jsons' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/provider/pact_spec_runner.rb:78:in `configure_rspec' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/provider/pact_spec_runner.rb:32:in `run' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/cli/run_pact_verification.rb:69:in `run_with_pact_uri_object' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/cli/run_pact_verification.rb:50:in `run_specs' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/cli/run_pact_verification.rb:21:in `call' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/cli/run_pact_verification.rb:13:in `call' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/app.rb:171:in `verify_pact' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/app.rb:43:in `block in call' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/app.rb:42:in `collect' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/app.rb:42:in `call' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/app.rb:34:in `call' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/cli/verify.rb:47:in `verify' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/cli/custom_thor.rb:17:in `start' /home/mdoppelfeld/development/pact/lib/app/pact-provider-verifier.rb:33:in `<main>' /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.1/lib/pact/consumer_contract/pact_file.rb:67:in `block in get_remote_with_retry': HTTP request failed: status=503 (Pact::PactFile::HttpError) from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.1/lib/pact/consumer_contract/pact_file.rb:60:in `times' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.1/lib/pact/consumer_contract/pact_file.rb:60:in `get_remote_with_retry' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.1/lib/pact/consumer_contract/pact_file.rb:41:in `render_pact' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.1/lib/pact/consumer_contract/pact_file.rb:22:in `read' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/provider/pact_source.rb:16:in `pact_json' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/provider/pact_spec_runner.rb:115:in `collect' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/provider/pact_spec_runner.rb:115:in `pact_jsons' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/provider/pact_spec_runner.rb:78:in `configure_rspec' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/provider/pact_spec_runner.rb:32:in `run' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/cli/run_pact_verification.rb:69:in `run_with_pact_uri_object' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/cli/run_pact_verification.rb:50:in `run_specs' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/cli/run_pact_verification.rb:21:in `call' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/cli/run_pact_verification.rb:13:in `call' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/app.rb:171:in `verify_pact' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/app.rb:43:in `block in call' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/app.rb:42:in `collect' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/app.rb:42:in `call' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/app.rb:34:in `call' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/cli/verify.rb:47:in `verify' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start' from /home/mdoppelfeld/development/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/cli/custom_thor.rb:17:in `start' from /home/mdoppelfeld/development/pact/lib/app/pact-provider-verifier.rb:33:in `<main>'```

andrzej.igielski
2021-02-20 19:28
@andrzej.igielski has left the channel

ankita.soni
2021-02-22 07:26
has joined #pact-go

jacek.helper
2021-02-22 08:03
has joined #pact-go

dany.marques90
2021-02-22 13:54
@dany.marques90 has left the channel

seanw122
2021-02-22 15:36
has joined #pact-go

akennedy
2021-02-22 15:54
has joined #pact-go

esimpson
2021-02-22 16:42
has joined #pact-go

dagrawal
2021-02-22 17:24
has joined #pact-go

venkata.pro
2021-02-22 21:47
has joined #pact-go

aparnachaudhari
2021-02-23 02:34
I am running into a race condition where my provider tests fail because the pact.test incoming connections need permissions when run locally.

aparnachaudhari
2021-02-23 02:35
*`Do you want the application "pacts.test" to accept incoming network connections?`* is what I am shown after ? My provider service spins up ? Pact test already runs and fails with `502`

aparnachaudhari
2021-02-23 02:35
any guidance?

matt.fellows
2021-02-23 03:25
I get that warning in one of my Mac's but it doesn't cause failures. Double check it is indeed the cause via trace logging

matt.fellows
2021-02-23 03:26
I think you can tell Mac to disable it, because I've somehow done it on my main one

jordan.levin
2021-02-23 19:13
has joined #pact-go

aparnachaudhari
2021-02-23 22:33
unfortunately our firewall permissions are blocked on our machines and I am unable to make any changes

aparnachaudhari
2021-02-23 22:34
I am trying to figure out what I can do to get around this

aparnachaudhari
2021-02-23 22:35
cause I run into 502 when running the pact-go example provider_test.go too

matt.fellows
2021-02-24 00:07
How does it work on the consumer side? The consumer side starts up a server as well which presumably has the same issue? Also, how do you test your provider code locally if you can?t start a port?

matt.fellows
2021-02-24 00:07
I can?t see how this is a Pact specific issue I?m sorry, so not sure how to help you from here

aparnachaudhari
2021-02-24 00:08
no my comment above was about that - this does not seem a pact related issue, this seems to be a firewall issue on my machine

matt.fellows
2021-02-24 00:08
yeah, unless I can reproduce it, the problem is very much related to your specific environment. Is there somebody who knows Go well enough to help you or a sysadmin you can speak with to understand the constraints? Once we know if it?s something we can do on our side, i?d be happy to have an issue raised and find an approach to fixing

francesco.latorre
2021-02-24 05:59
has joined #pact-go

aniket.g2185
2021-02-24 09:13
has joined #pact-go

aniket.g2185
2021-02-24 09:21
Hello @matt.fellows, firstly thanks for your amazing contributions to PACT :slightly_smiling_face: , wanted to check if `valueFromProviderState` is supported in Go's provider lib

matt.fellows
2021-02-24 09:38
Thank you!

matt.fellows
2021-02-24 09:39
Consumer or provider side?

matt.fellows
2021-02-24 09:39
It soon will be on provider side with a v3 branch almost ready for prime tine

matt.fellows
2021-02-24 09:39
Consumer will be a little while away

aniket.g2185
2021-02-24 09:40
As of now looking for provider side, consumer is JVM based but we have few Go based consumers as well

matt.fellows
2021-02-24 09:41
Ok cool, I should have something for you in next couple of days, just sorting out an osx linking issue

matt.fellows
2021-02-24 09:41
Can I ping you when it's ready for some testing?

aniket.g2185
2021-02-24 09:41
Absolutely, I would be able to test out some scenarios

sundaresank360
2021-02-24 12:12
has joined #pact-go

jhawthor
2021-02-24 15:18
has joined #pact-go

chris.r.thomas
2021-02-24 16:54
has joined #pact-go

peter.cook
2021-02-24 17:05
has joined #pact-go

jayeshguru81
2021-02-24 18:34
has joined #pact-go

ben.kirberger
2021-02-24 19:16
has joined #pact-go

m.stephkan
2021-02-25 05:30
has joined #pact-go

stephen.tjasink
2021-02-25 08:23
has joined #pact-go

beatrizwaclawek
2021-02-25 20:27
has joined #pact-go

zhoutianli1234
2021-02-25 21:09
has joined #pact-go

travis.day
2021-02-26 04:06
has joined #pact-go

andrew.cunningham
2021-02-26 11:13
has joined #pact-go

andrew.cunningham
2021-02-26 11:54
@andrew.cunningham has left the channel

brianmasschaele
2021-02-27 13:27
has joined #pact-go

pedroefajardo_pactio
2021-02-27 17:18
has joined #pact-go

dominic_herrmann
2021-03-01 06:54
has joined #pact-go

matthew.long
2021-03-02 14:08
has joined #pact-go

tmoncm
2021-03-02 17:17
has joined #pact-go

phoenixcampos01
2021-03-02 21:25
has joined #pact-go

hugh.paul.mcgowan
2021-03-03 17:52
has joined #pact-go

normanrs
2021-03-04 11:18
has joined #pact-go

jayson.bailey
2021-03-04 19:18
has joined #pact-go

mjsmcp
2021-03-08 23:46
has joined #pact-go

javier.garcia_cotado
2021-03-09 21:52
has joined #pact-go

akos.csurai
2021-03-10 13:39
has joined #pact-go

akos.csurai
2021-03-10 14:11
@akos.csurai has left the channel

testme2020testme
2021-03-10 14:12
has joined #pact-go

tommy.mirchandani
2021-03-10 17:13
has joined #pact-go

varinderjitkaur13
2021-03-11 01:46
has joined #pact-go

bheemreddy181
2021-03-11 03:23
Can we use pact when we have internal packages which are used as interfaces to interact with provider services from multiple consumer services ? I assume it we can?t

matt.fellows
2021-03-11 03:24
do you mean like client libs?

bheemreddy181
2021-03-11 03:58
Yes client libs ?

bheemreddy181
2021-03-11 04:00
I assume the idea is not to write client libs and write the interfaces directly in the application so that requests and responses are pretty much defined for each application uniquely


bheemreddy181
2021-03-11 04:01
So that it explains easier what requests are sent and responses are read

bheemreddy181
2021-03-11 04:08
Ah there is a trade off but can be done

bheemreddy181
2021-03-11 04:09
Is this the same case for Ruby client gems as well ?

matt.fellows
2021-03-11 04:10
I can?t think of a reason it wouldn?t

bheemreddy181
2021-03-11 04:10
Makes sense

bheemreddy181
2021-03-11 04:10
But the major benefit of contract testing is missing here I feel

bheemreddy181
2021-03-11 04:11
Something is better than nothing

matt.fellows
2021-03-11 04:12
yeah, the latter

matt.fellows
2021-03-11 04:12
Also search https://docs.pact.io/slack/general.html for ?client library?. The threads sadly don?t format well here, but you might find some useful historical conversations

bheemreddy181
2021-03-11 04:13
Any graphQL examples do you have handy for Ruby or Go ?

aniket.g2185
2021-03-11 04:13
Hey @matt.fellows, you have any updates on this by any chance?

matt.fellows
2021-03-11 04:14
hmmm no sorry

matt.fellows
2021-03-11 04:15
-> https://docs.pact.io/slack/general.html#1610034769.384400 is also useful. I think you could apply contract tests using this strategy: https://docs.pact.io/slack/general.html#1610103444.390600

matt.fellows
2021-03-11 04:15
Actually timing is good, I?m working on this today

matt.fellows
2021-03-11 04:16
I ran into an issue where the provider libs weren?t working with Mac. I figured it out

aniket.g2185
2021-03-11 04:16
Wow awesome :ok_hand:


aniket.g2185
2021-03-11 04:17
K cool, I will look for it

aniket.g2185
2021-03-11 04:18
So I need to use it as v3 right?

matt.fellows
2021-03-11 04:18
yeah


aniket.g2185
2021-03-11 04:19
Cool

matt.fellows
2021-03-11 04:19
Do note that the namespace/packages are likely to change, but the interface is unlikely to change significantly

aniket.g2185
2021-03-11 04:19
Ok sure

matt.fellows
2021-03-11 04:23
Let me know how you go. I?ll be offline for a bit, but back online later

aniket.g2185
2021-03-11 04:27
Yep, I would need some time as well

krcl.dev
2021-03-11 05:11
has joined #pact-go

aniket.g2185
2021-03-11 06:17
@matt.fellows, I did a go get on the latest commit from the branch you mentioned

aniket.g2185
2021-03-11 06:18
I am getting some `clang` error regarding mock server directory

aniket.g2185
2021-03-11 06:19
Sorry its about `libpact_verifier_ffi.dylib`

matt.fellows
2021-03-11 06:21
ok sorry

matt.fellows
2021-03-11 06:21
I think I know what it will be

matt.fellows
2021-03-11 06:21
maybe :stuck_out_tongue:

matt.fellows
2021-03-11 06:22
So basically, the new package needs to get the FFI bindings from https://github.com/pact-foundation/pact-reference/releases

aniket.g2185
2021-03-11 06:23
Another file is `libpact_mock_server_ffi.dylib`

matt.fellows
2021-03-11 06:23
yep, same problem

matt.fellows
2021-03-11 06:23
Originally, I wanted to do that at runtime - but alas, with CGO I don?t think I can make that work. The code won?t run unless the lib is there, but want the code to be able to fetch the lib

matt.fellows
2021-03-11 06:23
so I?ve briefly added a command to download and install the lib

matt.fellows
2021-03-11 06:23
This works locally, but I haven?t yet tested what this looks like when consumed

matt.fellows
2021-03-11 06:24
can you please post the error?

matt.fellows
2021-03-11 06:24
actually, is there a `pact-go` command now available on your path?

aniket.g2185
2021-03-11 06:25
Yes

matt.fellows
2021-03-11 06:25
cool

matt.fellows
2021-03-11 06:26
OK, here is where the fun begins :stuck_out_tongue:

aniket.g2185
2021-03-11 06:26
:grinning:

aniket.g2185
2021-03-11 06:26
Do you want me to download ffi artifacts from releases and place it manually?

matt.fellows
2021-03-11 06:26
(I should note, there is a simple workaround in the meantime, but I?m keen to know how this works as is)

matt.fellows
2021-03-11 06:27
that?s the workaround! :stuck_out_tongue:

aniket.g2185
2021-03-11 06:27
Yeah I might have to add that in my install tools section of makefile

matt.fellows
2021-03-11 06:27
first, could you please run `pact-go -l DEBUG install` from the base of your project?

aniket.g2185
2021-03-11 06:27
Ok

aniket.g2185
2021-03-11 06:28
Oh it seems this command did download those files

matt.fellows
2021-03-11 06:29
good, that was the plan

matt.fellows
2021-03-11 06:29
the question is.. is it in the right place!

aniket.g2185
2021-03-11 06:29
But it download under my project folder

aniket.g2185
2021-03-11 06:29
Not the path where pact says its missing

matt.fellows
2021-03-11 06:29
ok, where does pact say it wants it - relative to the pact-go project?

aniket.g2185
2021-03-11 06:29
Yep

aniket.g2185
2021-03-11 06:30
Under go pkg

matt.fellows
2021-03-11 06:30
ok cool

matt.fellows
2021-03-11 06:30
cd into that project base directory and try again :stuck_out_tongue:

aniket.g2185
2021-03-11 06:30
Sure

aniket.g2185
2021-03-11 06:32
It says your pact lib version is out of date

aniket.g2185
2021-03-11 06:32
Cos the version I pulled by go get is 1.4.4

matt.fellows
2021-03-11 06:32
can you please print the output?

aniket.g2185
2021-03-11 06:33
Also mkdir is permission denied

aniket.g2185
2021-03-11 06:33
It's not able to create lib folder

matt.fellows
2021-03-11 06:33
I?m wondering if it?s simpler to specify a path - e.g. `/opt/pact` and just ensure the libs are installed there, instead of trying to be too clever

matt.fellows
2021-03-11 06:34
or `/usr/local/pact` on Mac - I should confirm by the way, what OS are you using?

aniket.g2185
2021-03-11 06:34
It's weird though, go path is under my user, why should it say permission denied

aniket.g2185
2021-03-11 06:35
I am on mac

aniket.g2185
2021-03-11 06:36
There is no write permission to that dir

matt.fellows
2021-03-11 06:36
strange

matt.fellows
2021-03-11 06:37
ok

matt.fellows
2021-03-11 06:37
give me a moment, I?ll see if I can make the `/opt/pact` change

aniket.g2185
2021-03-11 06:38
Sure :+1:

matt.fellows
2021-03-11 06:41
OK, it now goes into `/opt/pact`

matt.fellows
2021-03-11 06:42
I know whatever directory I choose, someone will have an opinion about it. It might end up in `/tmp` despite it being ephemeral :grimacing:

aniket.g2185
2021-03-11 06:43
K let me get the latest

matt.fellows
2021-03-11 06:44
np

matt.fellows
2021-03-11 06:44
so I need to update the installer, so let?s just ignore that for now

matt.fellows
2021-03-11 06:44
Let me manually do the steps, and share with you

matt.fellows
2021-03-11 06:46
cool. So if I don?t have the libs installed, I get this: ```mkdir -p ./examples/v3/pacts # LOG_LEVEL=trace go test -v -tags=consumer -count=1 http://github.com/pact-foundation/pact-go/examples/v3/... LOG_LEVEL=trace go test -v -timeout=10s -tags=provider -count=1 http://github.com/pact-foundation/pact-go/examples/v3/... -run TestV3HTTPProvider # http://github.com/pact-foundation/pact-go/v3/internal/native/mock_server Apple clang version 12.0.0 (clang-1200.0.32.29) Target: x86_64-apple-darwin19.6.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin clang: error: no such file or directory: '/opt/pact/libpact_mock_server_ffi.dylib' # http://github.com/pact-foundation/pact-go/v3/internal/native/verifier Apple clang version 12.0.0 (clang-1200.0.32.29) Target: x86_64-apple-darwin19.6.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin clang: error: no such file or directory: '/opt/pact/libpact_verifier_ffi.dylib' FAIL http://github.com/pact-foundation/pact-go/examples/v3 [build failed] FAIL make: *** [pactv3] Error 2``` But then if I run the following: ```? pact-go git:(feat/v3-ffi-verifier) ? ./bin/pact-go -l DEBUG install <aws:cloudsploit-dev> 2021/03/11 17:46:44 [DEBUG] checking version for lib libpact_verifier_ffi semver range >= 0.0.2, < 1.0.0 2021/03/11 17:46:44 [DEBUG] package libpact_verifier_ffi not found 2021/03/11 17:46:44 [DEBUG] downloading library from https://github.com/pact-foundation/pact-reference/releases/download/pact_verifier_ffi-v0.0.2/libpact_verifier_ffi-osx-x86_64.dylib.gz to /opt/pact/libpact_verifier_ffi.dylib 2021/03/11 17:46:45 [DEBUG] downloading library from https://github.com/pact-foundation/pact-reference/releases/download/libpact_mock_server_ffi-v0.0.15/libpact_mock_server_ffi-osx-x86_64.dylib.gz to /opt/pact/libpact_mock_server_ffi.dylib 2021/03/11 17:46:46 [INFO] setting install_name on library libpact_verifier_ffi for osx 2021/03/11 17:46:46 [DEBUG] output from command [] 2021/03/11 17:46:46 [INFO] setting install_name on library libpact_mock_server_ffi for osx 2021/03/11 17:46:46 [DEBUG] output from command [] 2021/03/11 17:46:46 [DEBUG] checking version for lib libpact_verifier_ffi semver range >= 0.0.2, < 1.0.0 2021/03/11 17:46:46 [DEBUG] checking version for lib libpact_mock_server_ffi semver range >= 0.0.15, < 1.0.0```

matt.fellows
2021-03-11 06:47
and then my tests run

matt.fellows
2021-03-11 06:47
brb

aniket.g2185
2021-03-11 06:48
I believe the permission issue is specific to my machine

aniket.g2185
2021-03-11 06:49
Let me sort that out

aniket.g2185
2021-03-11 06:49
For now I had to use `sudo`

matt.fellows
2021-03-11 06:51
yeah, I must have `chown`?d my `/opt`

matt.fellows
2021-03-11 06:51
on linux it should be for users, but on a mac it seems not

matt.fellows
2021-03-11 06:52
I?m now leaning towards just adding it to home directories!

aniket.g2185
2021-03-11 06:53
Our CI runs on Linux, so should not be a problem there, but locally all devs would have to chown or use sudo

aniket.g2185
2021-03-11 06:54
Also pact-go seems to be creating libs folder , but now it's looking for libs under /opt/pact

aniket.g2185
2021-03-11 06:54
Not /opt/libs

matt.fellows
2021-03-11 06:56
it should be going into `/opt/pact`

aniket.g2185
2021-03-11 06:56
Now it says cannot open file for architecture x86_64

aniket.g2185
2021-03-11 06:57
Linker command failed

matt.fellows
2021-03-11 06:57
I have verbose linking on to help diagnose

matt.fellows
2021-03-11 06:57
so what does `ls -l /opt/pact` give you?

aniket.g2185
2021-03-11 06:59
Let me chown the files

aniket.g2185
2021-03-11 07:02
Let me sign in from my Mac to share with you the message

matt.fellows
2021-03-11 07:03
oh, are you on mobile or something?

aniket.g2185
2021-03-11 07:03
Yes

matt.fellows
2021-03-11 07:03
ah!

aniket.g2185
2021-03-11 07:07
```# http://github.com/pact-foundation/pact-go/v3/internal/native/mock_server Apple clang version 12.0.0 (clang-1200.0.32.28) Target: x86_64-apple-darwin19.6.0 Thread model: posix InstalledDir: /Users/aniket.gadre/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin "/Users/aniket.gadre/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Users/aniket.gadre/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch x86_64 -platform_version macos 10.15.0 10.15.6 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -o $WORK/b462/_cgo_.o -L/usr/local/lib $WORK/b462/_cgo_main.o $WORK/b462/_x001.o $WORK/b462/_x002.o $WORK/b462/_x003.o /opt/pact/libpact_mock_server_ffi.dylib -lSystem /Users/aniket.gadre/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.osx.a # http://github.com/pact-foundation/pact-go/v3/internal/native/verifier Apple clang version 12.0.0 (clang-1200.0.32.28) Target: x86_64-apple-darwin19.6.0 Thread model: posix InstalledDir: /Users/aniket.gadre/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin "/Users/aniket.gadre/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Users/aniket.gadre/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch x86_64 -platform_version macos 10.15.0 10.15.6 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -o $WORK/b463/_cgo_.o -L/usr/local/lib $WORK/b463/_cgo_main.o $WORK/b463/_x001.o $WORK/b463/_x002.o $WORK/b463/_x003.o /opt/pact/libpact_verifier_ffi.dylib -lSystem /Users/aniket.gadre/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.osx.a # http://gitlab.myteksi.net/dakota/customer-experience/handlers.test Apple clang version 12.0.0 (clang-1200.0.32.28) Target: x86_64-apple-darwin19.6.0 Thread model: posix InstalledDir: /Users/aniket.gadre/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin "/Users/aniket.gadre/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Users/aniket.gadre/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch x86_64 -platform_version macos 10.15.0 10.15.6 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -o $WORK/b332/handlers.test -L/usr/local/lib -S -no_pie -pagezero_size 4000000 /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/go.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000000.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000001.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000002.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000003.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000004.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000005.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000006.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000007.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000008.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000009.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000010.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000011.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000012.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000013.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000014.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000015.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000016.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000017.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000018.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000019.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000020.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000021.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000022.o /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-link-002309112/000023.o /opt/pact/libpact_mock_server_ffi.dylib /opt/pact/libpact_verifier_ffi.dylib -lpthread -framework CoreFoundation -framework Security -lSystem /Users/aniket.gadre/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.osx.a dyld: Library not loaded: ../../libs/libpact_mock_server_ffi.dylib Referenced from: /var/folders/hf/s_d1x8qj3_78_gf6zm1gn3d40000gr/T/go-build392475533/b332/handlers.test Reason: image not found```

matt.fellows
2021-03-11 07:08
ah! I think I know what?s happening

matt.fellows
2021-03-11 07:08
did you copy those files there by any chance?

matt.fellows
2021-03-11 07:08
either way, delete those files and run the install step again


aniket.g2185
2021-03-11 07:09
I had to rename the folder cos `go-pact` created `lib` folder instead of `pact`

matt.fellows
2021-03-11 07:10
have you pulled the latest?

matt.fellows
2021-03-11 07:10
I just ran it here, and it creates them in `/opt/pact/`

aniket.g2185
2021-03-11 07:10
I hope it will come as part of `go get` ?

matt.fellows
2021-03-11 07:10
to the best of my knowledge, that?s not possible

aniket.g2185
2021-03-11 07:10
I pulled the latest commit from `go get`

matt.fellows
2021-03-11 07:11
if you know how though, I?m all ears

aniket.g2185
2021-03-11 07:11
`go get http://github.com/pact-foundation/pact-go@5f21f62` , instead of version , provide commit hash

matt.fellows
2021-03-11 07:12
> I hope it will come as part of `go get` ? Oh, sorry I thought you meant `go get` could download and install the lib deps. That would have been nice

aniket.g2185
2021-03-11 07:12
ah ok, haha

aniket.g2185
2021-03-11 07:14
how can I update `pact-go` ?

aniket.g2185
2021-03-11 07:14
its still pulling under libs

aniket.g2185
2021-03-11 07:15
`ls` tells me it was updated 30 mins back

matt.fellows
2021-03-11 07:16
mmm

matt.fellows
2021-03-11 07:16
the binary or the package?

aniket.g2185
2021-03-11 07:16
binary

matt.fellows
2021-03-11 07:17
good question

matt.fellows
2021-03-11 07:17
Strange that go get doesn?t do that?

matt.fellows
2021-03-11 07:17
`go build -a` seems to be the answer, but double check that :stuck_out_tongue:


aniket.g2185
2021-03-11 07:18
`go get` seems to be doing that but then I expect it to download libs under /opt/pact

matt.fellows
2021-03-11 07:20
maybe just do it by hand?

matt.fellows
2021-03-11 07:20
`go build <path to pact-go> -o pact-go`

matt.fellows
2021-03-11 07:22
I have to run in a second I?m afraid - dinner time and I?m pushing it uphill against wife and kids - but keen to get the install bit runnig

aniket.g2185
2021-03-11 07:22
no worries, I will get this sorted

matt.fellows
2021-03-11 07:23
kk

matt.fellows
2021-03-11 07:23
I?ll be back online a little later (couple of hours) to follow up

aniket.g2185
2021-03-11 07:23
sure

matt.fellows
2021-03-11 07:23
Sorry about the hassles, but you?re helping make this easier for others - so :pray:

matt.fellows
2021-03-11 07:23
it?s worth it!

matt.fellows
2021-03-11 07:23
(and I/we are very grateful)

aniket.g2185
2021-03-11 07:37
No worries mate

aniket.g2185
2021-03-11 07:37
btw I built the lib from source and its still trying to pull the files under `lib` folder

matt.fellows
2021-03-11 07:40
Gah!

aniket.g2185
2021-03-11 07:41
wow, my installer.go is not even showing updated code :smile:

aniket.g2185
2021-03-11 07:41
let me see whats happening

matt.fellows
2021-03-11 07:41
:thinking_face:

matt.fellows
2021-03-11 07:41
I was about to say open that file

matt.fellows
2021-03-11 07:41
Just also check it's in the v3 subfolder

aniket.g2185
2021-03-11 07:41
yes , it is in v3

aniket.g2185
2021-03-11 07:42
my bad

aniket.g2185
2021-03-11 07:42
:disappointed:

aniket.g2185
2021-03-11 07:42
I pulled a wrong commit

aniket.g2185
2021-03-11 07:51
I got the correct commit, I built the binary and its still pulling under `lib` , oh man

matt.fellows
2021-03-11 08:22
:exploding_head:

matt.fellows
2021-03-11 08:23
Have a look at the source, maybe I've got something wrong?

matt.fellows
2021-03-11 08:23
Maybe it's not detected the OS correctly

aniket.g2185
2021-03-11 09:17
yeah I suspect same thing, let me get back to you on this in sometime as I am stepping out

aniket.g2185
2021-03-11 12:08
@matt.fellows, I see you have created one more branch `feat-v3-ffi-verifier-tmp` which has one more commit setting path for OSX

aniket.g2185
2021-03-11 12:14
Its executing the tests now

matt.fellows
2021-03-11 12:21
ah, I?m mucking about with lib paths and things

matt.fellows
2021-03-11 12:21
are you using it or the other one?

aniket.g2185
2021-03-11 12:26
it worked when I got the latest commit from branch `feat-v3-ffi-verifier-tmp`

aniket.g2185
2021-03-11 12:26
btw logging looks pretty messed up

aniket.g2185
2021-03-11 12:27
```12:25:42 [INFO] Running provider state change handler 'a new user' for 'a request for onboarding configuration' Given a new user 2021/03/11 20:25:42 [INFO] executing state handler middleware```

aniket.g2185
2021-03-11 12:27
if you see , its logging in 2 diff formats

matt.fellows
2021-03-11 12:28
yes, one is coming from the library, and one from Pact Go

matt.fellows
2021-03-11 12:28
It?s on the list to find a way to amalgamate it

matt.fellows
2021-03-11 12:28
preferably, logging is disabled by the shared library, and we get back a response to log within the pact-go framework


matt.fellows
2021-03-11 12:29
(no diff yet!)

aniket.g2185
2021-03-11 12:33
oh then I was again pulling the wrong commit (2nd last one) :pensive:

matt.fellows
2021-03-11 12:34
:laughing:

aniket.g2185
2021-03-11 12:34
```12:25:42 [INFO] Sending request to provider at http://localhost:56808/```

aniket.g2185
2021-03-11 12:34
which url is this?

matt.fellows
2021-03-11 12:34
it?s a local proxy, same as the current `master` branch

matt.fellows
2021-03-11 12:34
it?s responsible for magic, for example, the provider state handlers and other hooks

matt.fellows
2021-03-11 12:35
it also allows us to use native go TLS/HTTP client features, which otherwise wouldn?t be available to us (because the request would be initiated from the underlying library code)

aniket.g2185
2021-03-11 12:35
ohh so it goes via this proxy to update request which then hits actual provider url

matt.fellows
2021-03-11 12:35
?it?s also responsible for the message pact handling

matt.fellows
2021-03-11 12:35
correct

matt.fellows
2021-03-11 12:36
it comes out as INFO now, as the rust lib we are using is not aware of the proxy, so thinks it?s actually the final target

matt.fellows
2021-03-11 12:36
again, hope to clean this up

matt.fellows
2021-03-11 12:36
but, it?s working???

aniket.g2185
2021-03-11 12:36
ok, it might confuse users in thinking they are hitting wrong port :smile:

matt.fellows
2021-03-11 12:37
correct, so more logging (to essentially prepare for that confusion) or less (hide the rust output and control from go) could solve it

aniket.g2185
2021-03-11 12:38
I haven't yet tried the parameterized state provider, was trying to get easy one working first

aniket.g2185
2021-03-11 12:39
which component is written in Rust ? The proxy ?

matt.fellows
2021-03-11 12:39
yep, that?s sensible

matt.fellows
2021-03-11 12:39
the core library that is being imported. In this case, the engine that reads the pact files, replays them against the service, and reports back the output

matt.fellows
2021-03-11 12:40
we have 12 languages to support, and that logic is actually quite complicated. So a shared core is the model we currently have (uses Ruby), but moving to a Rust one

matt.fellows
2021-03-11 12:40
much faster, and has a bunch of other benefits

matt.fellows
2021-03-11 12:40
I advocated for Go, but didn?t have the time to do it myself :stuck_out_tongue:

matt.fellows
2021-03-11 12:40
so I lost

matt.fellows
2021-03-11 12:40
but, it?s actually quite good

aniket.g2185
2021-03-11 12:41
Rust is awesome ! :smile: I think I should look for ways to contribute


aniket.g2185
2021-03-11 12:42
``` a request for onboarding configuration returns a response which has status code 200 (OK) includes headers "Content-Type" with value "application/json; charset=UTF-8" (OK) has a matching body (OK) 12:25:42 [ERROR] Failed to load pact - Failed to load pact '<MY_SERVICE_PATH>/handlers/../pacts/android-app-customer-experience.json' - Request failed - builder error: relative URL without a base```

aniket.g2185
2021-03-11 12:42
I see this weird thing, PACT test executed fine but later I see an error to load pact file, which was actually loaded fine

matt.fellows
2021-03-11 12:42
hmm

matt.fellows
2021-03-11 12:43
what?s the code look like?

aniket.g2185
2021-03-11 12:46
sorted, it originated from `pactUrls` field, not sure if in `v2` this field accepted file path as well

matt.fellows
2021-03-11 12:47
yep, it should take both I think.

aniket.g2185
2021-03-11 12:47
cos I see both `PactFiles` and `PactUrls` field for `VerifyRequest`

aniket.g2185
2021-03-11 12:47
along with `PactDirs`

matt.fellows
2021-03-11 12:48
Files -> actual local files Urls -> remote files Dirs -> directories containing files PactBrokerUrl -> find dynamically from a broker

matt.fellows
2021-03-11 12:48
it?s a bit more verbose, but that?s the library :man-shrugging:

matt.fellows
2021-03-11 12:48
it should be documented ? think

aniket.g2185
2021-03-11 12:48
makes sense, I believe in V2 local file path worked for Url as well, now it complains

aniket.g2185
2021-03-11 12:48
not sure though

matt.fellows
2021-03-11 12:50
yes, I think that?s right

aniket.g2185
2021-03-11 15:25
the provider state param I am receiving is `nil`

aniket.g2185
2021-03-11 15:26
```"a user whose application can be updated": func(s v3.ProviderStateV3) error { ... }```

aniket.g2185
2021-03-11 15:26
s is `nil` here

krishnaraoveera1294
2021-03-11 17:53
has joined #pact-go

matt.fellows
2021-03-11 22:14
hmm, what does the pact file look like?

raghavendra.kalakonda
2021-03-11 23:08
has joined #pact-go

aniket.g2185
2021-03-12 00:41
```{ "description": "a request to update the existing onboarding application", "request": { "method": "PUT", "path": "/onboarding/applications/1", "headers": { "Content-Type": "application/json; charset=UTF-8" }, "body": { "fields": [ { "value": "Alice", "key": "Name" } ] }, "matchingRules": { "body": { "$.fields": { "matchers": [ { "match": "type" } ], "combine": "AND" }, "$.fields[*].key": { "matchers": [ { "match": "type" } ], "combine": "AND" }, "$.fields[*].value": { "matchers": [ { "match": "type" } ], "combine": "AND" } } }, "generators": { "path": { "type": "ProviderState", "expression": "/onboarding/applications/${uuid}", "dataType": "STRING" } } }, "response": { "status": 200, "headers": { "Content-Type": "application/json; charset=UTF-8" }, "body": { "channel": "MY_INFO", "uuid": 1, "forms": [ { "name": "Personal Info", "fields": [ { "editable": true, "dataType": "a", "name": "Name", "value": "Alice", "key": "name", "required": true } ], "key": "personalInfo" } ] }, "matchingRules": { "body": { "$.uuid": { "matchers": [ { "match": "type" } ], "combine": "AND" }, "$.forms": { "matchers": [ { "match": "type" } ], "combine": "AND" }, "$.forms[*].key": { "matchers": [ { "match": "type" } ], "combine": "AND" }, "$.forms[*].name": { "matchers": [ { "match": "type" } ], "combine": "AND" }, "$.forms[*].fields": { "matchers": [ { "match": "type" } ], "combine": "AND" }, "$.forms[*].fields[*].name": { "matchers": [ { "match": "type" } ], "combine": "AND" }, "$.forms[*].fields[*].key": { "matchers": [ { "match": "type" } ], "combine": "AND" }, "$.forms[*].fields[*].value": { "matchers": [ { "match": "type" } ], "combine": "AND" }, "$.forms[*].fields[*].dataType": { "matchers": [ { "match": "regex", "regex": "[string|enum|date|bool]" } ], "combine": "AND" }, "$.forms[*].fields[*].editable": { "matchers": [ { "match": "type" } ], "combine": "AND" }, "$.forms[*].fields[*].required": { "matchers": [ { "match": "type" } ], "combine": "AND" } }, "header": { "Content-Type": { "matchers": [ { "match": "regex", "regex": "application/json(;\\s?charset=[\\w\\-]+)?" } ], "combine": "AND" } } }, "generators": { "body": { "$.uuid": { "type": "ProviderState", "expression": "uuid", "dataType": "INTEGER" }, "$.forms[*].fields[*].dataType": { "type": "Regex", "regex": "[string|enum|date|bool]" } } } }, "providerStates": [ { "name": "a user whose application is in draft state", "params": { "uuid": "1" } } ] }```

aniket.g2185
2021-03-12 00:42
Its a path param being parameterized with below code ``` .pathFromProviderState(applicationsEndpoint + "/${uuid}", applicationsEndpoint + "/1")```

aniket.g2185
2021-03-12 00:55
If I print s this is what I get ```2021/03/12 08:54:44 State invoked with s as {a user whose application is in draft state <nil>} ```

aniket.g2185
2021-03-12 00:55
so it seems params are nil

matt.fellows
2021-03-12 01:33
Thank you. Should hopefully be an easy fix

aniket.g2185
2021-03-12 02:48
Console logs generated by Pact in GO are overwhelming

matt.fellows
2021-03-12 02:50
which ones specifically?

matt.fellows
2021-03-12 02:50
I currently have the -v flag on for linking whilst we sort through that

matt.fellows
2021-03-12 02:50
you can specify the log level to reduce the noise of course

aniket.g2185
2021-03-12 03:23
This is from V2, I am back to V2 till V3 issue is sorted :smile: The logs I am talking about are the ones printing out every match for body, header , status

aniket.g2185
2021-03-12 03:23
```=== RUN TestCustomerExperienceServiceProvider/has_status_code_200#01 pact.go:629: Verifying a pact between android-app and customer-experience Given a user whose application is in draft state a request for onboarding configuration with GET /onboarding/configurations returns a response which has status code 200 === RUN TestCustomerExperienceServiceProvider/has_a_matching_body#02 pact.go:629: Verifying a pact between android-app and customer-experience Given a user whose application is in draft state a request for onboarding configuration with GET /onboarding/configurations returns a response which has a matching body === RUN TestCustomerExperienceServiceProvider/"Content-Type"_which_matches_/application\/json(;\s?charset=[\w\-]+)?/#02 pact.go:629: Verifying a pact between android-app and customer-experience Given a user whose application is in draft state a request for onboarding configuration with GET /onboarding/configurations returns a response which includes headers "Content-Type" which matches /application\/json(;\s?charset=[\w\-]+)?/ === RUN TestCustomerExperienceServiceProvider/has_status_code_200#02```

aniket.g2185
2021-03-12 03:23
These are being printed for test which ran fine, is there any way I can print logs only if it fails ?

aniket.g2185
2021-03-12 03:25
Also I do not see a good summary of which one fails and which one passed

matt.fellows
2021-03-12 03:29
I think by default go will only print logs if it fails, unless you pass `-v`

aniket.g2185
2021-03-12 03:29
Oh let me check on verbose setting

aniket.g2185
2021-03-12 06:55
@matt.fellows, are you planning to fix this anytime soon ?

andries.spies
2021-03-12 07:25
has joined #pact-go

matt.fellows
2021-03-12 07:42
It looks like it might be a downstream issue

matt.fellows
2021-03-12 07:43
Upstream, sorry

matt.fellows
2021-03-12 07:43
The values aren't coming thru

matt.fellows
2021-03-12 07:43
So, yes, but its a next week thing I'd say

aniket.g2185
2021-03-12 07:43
Sure , no worries

matt.fellows
2021-03-12 07:43
:+1:

aniket.g2185
2021-03-12 09:43
any idea about below error ? Not sure why is it complaining about having more elements despite using `minArrayLike` ```Diff -------------------------------------- Key: - is expected + is actual Matching keys and values are not shown { "fields": [ ... , - Pact::UnexpectedIndex, - Pact::UnexpectedIndex, + Hash, + Hash, ] } ] Description of differences -------------------------------------- * Actual array is too long and should not contain a Hash at $.forms[0].fields[1] * Actual array is too long and should not contain a Hash at $.forms[0].fields[2]```

aniket.g2185
2021-03-12 09:57
sorted

kamil.klima
2021-03-12 11:38
has joined #pact-go

matt.fellows
2021-03-13 02:36
OK i?ve fixed the issue. I?d like to address it in the upstream lib, but that should be transparent to you so it should be usable

matt.fellows
2021-03-13 02:36
one thing to note, is that the state setup signature has changed (now accepts a ?setup? boolean, so you can do a setup and teardown action on the specific state)

matt.fellows
2021-03-13 02:36
latest change pushed (also the installer should be better too)

aniket.g2185
2021-03-13 02:37
Awesome @matt.fellows, let me give it a try

matt.fellows
2021-03-13 02:51
No hurries. I had a little play this morning and got it to work. Needs tidying up, tests etc but the example works

aniket.g2185
2021-03-13 03:45
I am not so clear about this section ```// Optionally (if there are generators in the pact) return provider state values to be used in the verification (only ) return v3.ProviderStateV3Response{"id": "bar"}, nil```

matt.fellows
2021-03-13 03:45
Just return nil for now

matt.fellows
2021-03-13 03:46
Needs more docs, new feature in v3 pact

aniket.g2185
2021-03-13 03:47
ok

aniket.g2185
2021-03-13 03:49
can the `params` interface casted to `map[string]string` ?

matt.fellows
2021-03-13 03:49
Probably not safely, depends on the values

matt.fellows
2021-03-13 03:49
It's a JSON blob

matt.fellows
2021-03-13 03:49
Why?

aniket.g2185
2021-03-13 03:50
I tried to cast it into json, didn't work

aniket.g2185
2021-03-13 03:52
This is what I get when I print the interface value `value of s.Params map[uuid:1]`

aniket.g2185
2021-03-13 03:53
I tried casting it to ```type params struct { UUID string }```

aniket.g2185
2021-03-13 03:53
let me try again, I will get back in sometime

matt.fellows
2021-03-13 03:55
Maybe `interface` would be better, or the raw string/bytes

matt.fellows
2021-03-13 03:55
?

aniket.g2185
2021-03-13 03:56
I tried this ``` type params struct { UUID string `json:"uuid"` } if p, ok := s.Parameters.(params); ok { ... }```

matt.fellows
2021-03-13 04:12
Did it work?

matt.fellows
2021-03-13 04:12
If you like, hack the censored code locally to see what is the nicest experience and we can change it

matt.fellows
2021-03-13 04:43
Censored = vendored (autocorrect)

aniket.g2185
2021-03-13 06:42
`map[string]interface{}` works

aniket.g2185
2021-03-13 06:53
I am able to fetch value from provider state but it seems my call to API is failing

aniket.g2185
2021-03-13 06:56
I have this generator ```"generators": { "path": { "type": "ProviderState", "expression": "/applications/${uuid}", "dataType": "STRING" } }``` and it seems call to my API is made with `${uuid}` as the path param instead of actual UUID. Is this what you were talking about which needs to be returned from provider State?

matt.fellows
2021-03-13 07:46
Yes!

matt.fellows
2021-03-13 07:47
So I haven't actually used this feature so I'm a little hazy. I hope that you can just return a map with the `uuid` value to use in the actual API call

matt.fellows
2021-03-13 07:47
I'd love to know if it works!

aniket.g2185
2021-03-13 09:06
It doesn't

aniket.g2185
2021-03-13 09:11
I did return a map with uuid and its value but call is sill being made with `${uuid}`

matt.fellows
2021-03-13 09:18
Thx. I'll try and look tonight. I somewhat considered it but haven't tested it yet. Hopefully something simple tho. If you enable trace logging you might see more (bit can't guarantee that either)

aniket.g2185
2021-03-13 09:54
I will take a dig at it as well

aniket.g2185
2021-03-13 09:56
BTW V3 doesn't have a log file configuration like V2, has it been move to somewhere else or that kind of logging has been removed?

matt.fellows
2021-03-13 10:16
Found it. Needed an explicit content-type header - just pushed a minor fix for that

matt.fellows
2021-03-13 10:16
> BTW V3 doesn?t have a log file configuration like V2, has it been move to somewhere else or that kind of logging has been removed? I?d like to preserve that functionality, but need to work with the upstream lib to achieve it. As noted before, currently the library is also logging to stdout which I?d like to avoid

aniket.g2185
2021-03-13 10:17
When you say upstream lib is that the core lib being built in Rust ?

matt.fellows
2021-03-13 10:17
correct

aniket.g2185
2021-03-13 10:22
I am just going thru the code, is there any reason for exporting methods `BeforeEachMiddleware` and `AfterEachMiddleware` of `HttpVerifier` ?

matt.fellows
2021-03-13 10:23
no

matt.fellows
2021-03-13 10:23
lots of tidying up to do!

aniket.g2185
2021-03-13 10:25
also while appending middleware to the slice of middleware they have been appended in sequence `beforeEach` `afterEach` `StateHandlers` and `requestFilter` .. I believe `afterEach` should be added at last? or the sequence of execution is being taken care at some other place ?

matt.fellows
2021-03-13 10:27
ah, you?re testing my memory now!

aniket.g2185
2021-03-13 10:27
hahaha

aniket.g2185
2021-03-13 10:27
this is what comment says ```// Order of events: BeforeEach, stateHandlers, requestFilter(pre <execute provider> post), AfterEach``` but middleware are not added in that sequence

matt.fellows
2021-03-13 10:28
I believe they do run in the correct order. They run inside out, and only on the correct phase.

matt.fellows
2021-03-13 10:28
but? we can check!

aniket.g2185
2021-03-13 10:28
sure, I will check that

aniket.g2185
2021-03-13 10:28
let me try

aniket.g2185
2021-03-13 10:31
yep seems they are good :thumbsup:

matt.fellows
2021-03-13 10:31
phew

matt.fellows
2021-03-13 10:31
They do need tweaking for the new setup, because a state handler now also has 2 phases that needs to be considered

matt.fellows
2021-03-13 10:31
(setup, teardown)

aniket.g2185
2021-03-13 10:32
any specific reason to have setup , teardown for StateHandler ?

aniket.g2185
2021-03-13 10:32
I always saw stateHandler as setup

matt.fellows
2021-03-13 10:32
so, people ask for it


matt.fellows
2021-03-13 10:34
Sometimes, people want a specific state to setup, and then tear it down.

matt.fellows
2021-03-13 10:34
a general ?afterEach? hook doesn?t know what state is being used and isn?t local to the caller, so it makes for messier code

matt.fellows
2021-03-13 10:34
personally, I?ve never needed it

matt.fellows
2021-03-13 10:34
but :man-shrugging:

matt.fellows
2021-03-13 10:35
So in a way, the other lifecycle hooks might not be that useful!

matt.fellows
2021-03-13 10:36
This is the sequence I get

aniket.g2185
2021-03-13 10:37
yeah correct, the current `beforeEach` and `afterEach` are more generic and not specific to `stateHandler` , but I think it depends a bot on how you structure code and whether you can still make use of normal `afterEach` for teardown

aniket.g2185
2021-03-13 10:37
Yep, hooks are working fine, I tested as well

matt.fellows
2021-03-13 10:37
yep. So, we?ll give people the options and they can choose what makes most sense

matt.fellows
2021-03-13 10:37
I tend to use a standard ?afterEach? and just reset the table if needed, then specific states can do as they please

aniket.g2185
2021-03-13 10:39
What's the better way to do it, use actual DB or Mock it ?

matt.fellows
2021-03-13 10:39
It depends. If you have docker, that?s a good option

matt.fellows
2021-03-13 10:40
I tend to mock the DB because it?s faster. As long as you can preserve the interface to the db and have other tests for those layers, then it?s much simpler (IMO)

aniket.g2185
2021-03-13 10:40
for eg, u need lot of static tables loaded in DB before its useable, that would run all the SQL scripts every time you bring up a clean DB

matt.fellows
2021-03-13 10:40
In apps that maybe are harder to mock, externalise to Docker is my other goto

matt.fellows
2021-03-13 10:40
yeah

matt.fellows
2021-03-13 10:41
that?s where a specific state teardown might be useful, so you don?t have to clean the docker container each test

aniket.g2185
2021-03-13 10:42
As of now there is no global setup and teardown method right? which runs only once ? I think that can be handled the way normal Go test would do it

matt.fellows
2021-03-13 10:46
Yes, exactly why it?s not there :slightly_smiling_face:

aniket.g2185
2021-03-13 10:48
in V3 where can I set the log level ?

matt.fellows
2021-03-13 10:48
`v3.SetLogLevel("TRACE")`

aniket.g2185
2021-03-13 10:48
ah ok, thanks!

matt.fellows
2021-03-13 10:48
np

matt.fellows
2021-03-13 10:48
sorry I haven?t done docs yet

matt.fellows
2021-03-13 10:48
I also know the types are horrid e.g. `v3.ProviderStateV3` is not nice

matt.fellows
2021-03-13 10:49
Basically, I?ve been creating a side-by-side implementation of the existing one to keep things as close as possible to make migration easier - but that mean I needed to namespace things temporarily

aniket.g2185
2021-03-13 10:51
yep , but I think it should be ok if you have `ProviderState` type under v2 as well as v3, no ?

matt.fellows
2021-03-13 10:52
yeah, the new package will support v2 and v3 if that?s what you?re asking?

aniket.g2185
2021-03-13 10:52
yeah I mean even if it supports both, there shouldn't be conflict in types as they are under diff packages

aniket.g2185
2021-03-13 10:53
I mean it can just be `v3.ProviderState` than `v3.ProviderStateV3`

matt.fellows
2021-03-13 10:54
oh right, yes. I?m not sure they?ll be in separate sub-level packages yet, or typed explicitly (I?m leaning toward packages but there is a lot of overlapping code that I want to re-use)

matt.fellows
2021-03-13 10:54
we?ll see

aniket.g2185
2021-03-13 10:55
hmm, got it

matt.fellows
2021-03-13 10:56
of course, feedback would be helpful

matt.fellows
2021-03-13 10:56
I suspect some people will have the old package run in parallel with the new - so that could be a reason to namespace it

matt.fellows
2021-03-13 10:57
but really, I?d like to sunset the old package completely, but still support the v2 and v3 pacts

matt.fellows
2021-03-13 10:57
are you planning to run in parallel?

aniket.g2185
2021-03-13 10:57
I wanted to contribute to pact-go since long, now that I am fully working on Go, it should be a good time I guess

matt.fellows
2021-03-13 10:58
I better cleanup this code base then :wink:

matt.fellows
2021-03-13 10:58
where do you work, if you don?t mind me asking?

aniket.g2185
2021-03-13 10:58
My all micro-services are in Go, so if I can use consumer side v3 as well, I would prefer to stick to V3

matt.fellows
2021-03-13 10:58
3 hours behind Aus time, are you in southeast Asia somewhere? Singapore?

aniket.g2185
2021-03-13 10:58
the current one I am working on , consumer is android app, so I can use Java/Kotlin there

aniket.g2185
2021-03-13 10:59
Yeah I am based in SG

matt.fellows
2021-03-13 10:59
cool

aniket.g2185
2021-03-13 11:00
Where are you in AUS ?

matt.fellows
2021-03-13 11:06
Melbourne

matt.fellows
2021-03-13 11:07
where are you working in Singapore? I?ve never been, but have a bunch of friends/family that have been there for work

matt.fellows
2021-03-13 11:08
my best mate?s partner is from there

aniket.g2185
2021-03-13 11:08
I am working at `Grab` , started as Taxi hailing company , but are now in payments and lot of other domains

matt.fellows
2021-03-13 11:09
oh cool

matt.fellows
2021-03-13 11:09
do you know Kevin Littlejohn?

aniket.g2185
2021-03-13 11:10
I guess I attended one of his sessions, he works for APEX team

aniket.g2185
2021-03-13 11:10
I am pretty new to Grab, just 3 months in

matt.fellows
2021-03-13 11:10
APEX?

matt.fellows
2021-03-13 11:10
He used to work at DiUS (the company I work for) and we?ve worked / overlapped at other customers too (e.g. NAB - big 4 bank here)

matt.fellows
2021-03-13 11:10
really good guy though

aniket.g2185
2021-03-13 11:11
Wow thats nice, Didn't he promote PACT in Grab :smile: I am pushing for it , atleast for my project

aniket.g2185
2021-03-13 11:12
APEX - Is a developer/QA/SRE experience team, they build frameworks and other stuff for devs

aniket.g2185
2021-03-13 11:13
They use a lot of GRPC here, but I guess I have read your comments on how GRPC <> Contract and I agree to that

aniket.g2185
2021-03-13 11:23
```func (v *Verifier) Verify(args []string) int { log.Println("[DEBUG] executing verifier FFI with args", args) cargs := C.CString(strings.Join(args, "\n")) defer freeString(cargs) result := C.verify(cargs) return int(result) }``` Is this method calling the `Rust` code ?

matt.fellows
2021-03-13 11:23
yes!

matt.fellows
2021-03-13 11:23
thanks for advocating for us! If you?d like me to do a talk to the Grab engineering team I?d be more than happy to

matt.fellows
2021-03-13 11:24
as for gRPC, i?m not sure what you?ve read, but the current plan: 1. Create general https://github.com/pact-foundation/pact-specification/issues/83 for pact (requires projects to be using the rust core) 2. Create a gRPC and protobuf plugin(s)

matt.fellows
2021-03-13 11:25
It?s going to be a few months before good traction is made there, but I?m doing the work to get Go prepped into the Rust core so that adding the plugin interface should be a piece of cake

matt.fellows
2021-03-13 11:26
Ok my laptop battery just died. I'm off for the night, but appreciate your help here! Let me know how you get on and if you'd like me to chat with your team :pray:

aniket.g2185
2021-03-13 11:27
I am bit confused about this verifier thing, when does the hooks and Provider state execute ?

aniket.g2185
2021-03-13 11:27
No worries, GN mate

aniket.g2185
2021-03-13 12:47
Let me know if my understanding is correct about how verification process works 1. Pact core verification method makes the Rest call targeted at proxy 2. Call hits the proxy , which then executes Hooks, StateHandlers, RequestFilter 3. Call is forwarded to hit actual provider 4. Response comes back to proxy and after hook executes 5. Response goes back to core (and the required matchers are executed)

matt.fellows
2021-03-13 22:56
You got it

matt.fellows
2021-03-13 22:56
Or at least, that's the general gist of it

lswanborough
2021-03-15 00:50
has joined #pact-go

don.tobias
2021-03-15 19:35
has joined #pact-go

sagar.kathuria
2021-03-17 04:25
has joined #pact-go

shao.sum
2021-03-17 08:35
has joined #pact-go

riddhichopra
2021-03-18 01:28
has joined #pact-go

anu.de
2021-03-18 02:28
has joined #pact-go

sreyaslj
2021-03-18 04:25
has joined #pact-go

arvind1017
2021-03-18 22:48
has joined #pact-go

sushilvc84
2021-03-19 00:30
has joined #pact-go

tejakoshti7
2021-03-19 06:26
has joined #pact-go

mark.doppelfeld
2021-03-19 11:28
@aniket.g2185 I do get exactly the same error ... how did you solve it?

mark.doppelfeld
2021-03-19 11:29
I'm using a dsl.Like...

aniket.g2185
2021-03-19 11:30
do you have nested `Like`

mark.doppelfeld
2021-03-19 11:31
no, I have a json array cvontaining three elements

aniket.g2185
2021-03-19 11:31
can u post full DSL interaction

mark.doppelfeld
2021-03-19 11:32
``` pact.go:629: Verifying a pact between pao-switch-controller-http and pao-ip-pool-manager-http Given A list with all pools A request to get all pools with GET /api/v2/ip/pools returns a response which has a matching body pact.go:635: Verifying a pact between pao-switch-controller-http and pao-ip-pool-manager-http Given A list with all pools A request to get all pools with GET /api/v2/ip/pools returns a response which has a matching body Actual: [{"address":"192.168.0.0/19","addressPoolKind":"IPV4"},{"address":"2003:c3:f800::/37","addressPoolKind":"IPV6DHCP"},{"address":"2003:0:8000:5800::/53","addressPoolKind":"IPV6RA"}] Diff -------------------------------------- Key: - is expected + is actual Matching keys and values are not shown [ ... , - Pact::UnexpectedIndex, - Pact::UnexpectedIndex, + Hash, + Hash, ] Description of differences -------------------------------------- * Actual array is too long and should not contain a Hash at $[1] * Actual array is too long and should not contain a Hash at $[2] ```

aniket.g2185
2021-03-19 11:34
Do you have access to DSL defined at consumer side ?

mark.doppelfeld
2021-03-19 11:35
``` Body: dsl.Like(&[]pao.Fragment{ { Address: "192.168.0.0/22", LeafName: "testLeaf1", AddressPoolKind: pao.AddressPoolKindIPV4, }, { Address: "2003:c3:f800::/46", LeafName: "testLeaf1", AddressPoolKind: pao.AddressPoolKindIPV6DHCP, }, { Address: "2003:0:8000:5800::/54", LeafName: "testLeaf1", AddressPoolKind: pao.AddressPoolKindIPV6RA, }, }),```

aniket.g2185
2021-03-19 11:38
in the array , is consumer expecting atleast 1 address of each type or array can have any number of any type of IPs ?

mark.doppelfeld
2021-03-19 11:40
it can have any number of any type

mark.doppelfeld
2021-03-19 11:40
we are just starting with contracts tests...

mark.doppelfeld
2021-03-19 11:40
so I feel our contracts are not _good_

aniket.g2185
2021-03-19 11:40
then I believe the way its been written is wrong

mark.doppelfeld
2021-03-19 11:40
at the moment

mark.doppelfeld
2021-03-19 11:41
I think so too ...

aniket.g2185
2021-03-19 11:41
what `like` says is , every object in an array is `like` something and then you define only 1 example of something

aniket.g2185
2021-03-19 11:42
may be you can use `or`

aniket.g2185
2021-03-19 11:42
I haven't used it before, but it would be `like`(`A` or `B` or `C`)

mark.doppelfeld
2021-03-19 11:43
ok, I'll give it a try...

aniket.g2185
2021-03-19 11:45
you could have also just given one example and mentioned that `AddressPoolKind` should be either of three using a regex but that wont work, cos Pact will pass a test with response having IP4 AddressPoolKind containing a value of IP6 type IP, which ideally is a wrong response

aniket.g2185
2021-03-19 11:47
I am yet to write go consumer tests so I cannot help you with exact dsl

mark.doppelfeld
2021-03-19 11:49
Ok thanks for taking care of my problem :slightly_smiling_face:

yannick.adler
2021-03-19 12:44
has joined #pact-go

smith260194
2021-03-19 17:40
@smith260194 has left the channel

aelse
2021-03-19 23:54
has joined #pact-go

eric2323223
2021-03-20 01:35
has joined #pact-go

mark.doppelfeld
2021-03-20 12:21
We rewrote our consumer tests and got around the problem.

aniket.g2185
2021-03-20 12:24
:ok_hand:

jordan.r.stewart
2021-03-20 16:07
has joined #pact-go

tmorrison
2021-03-21 21:45
has joined #pact-go

a.chandrasekaran
2021-03-22 00:50
has joined #pact-go

maksym.motornyi
2021-03-22 11:50
has joined #pact-go

gareth.somerville
2021-03-22 12:10
has joined #pact-go

joseph.method
2021-03-22 19:55
has joined #pact-go

dennyg666
2021-03-22 20:54
has joined #pact-go

me1295
2021-03-23 00:15
has joined #pact-go

eric2323223
2021-03-23 02:21
For some reason, my service only accept headers begin with multiple uppercase letters, such as *TEST-Context*. Therefore I am having trouble in the PACT provider test because PACT change the header to *Test-Context*. May I know how to keep header casing in PACT provider test?

matt.fellows
2021-03-23 04:17
Hey!

eric2323223
2021-03-23 04:17
Hi Matt

matt.fellows
2021-03-23 04:17
So, I think you mentioned you tried `RequestFilter` - did that not work?

eric2323223
2021-03-23 04:18
No, it does not work

matt.fellows
2021-03-23 04:18
ok, the default Golang HTTP client will possibly standardise these

matt.fellows
2021-03-23 04:18
your provider code base is Golang?

eric2323223
2021-03-23 04:19
yes

matt.fellows
2021-03-23 04:19
hmm interesting

matt.fellows
2021-03-23 04:20
yes, so it seems golang messes with the headers (I know this is common in other languages too): https://dhdersch.github.io/golang/2016/08/11/golang-case-sensitive-http-headers.html

eric2323223
2021-03-23 05:57
Yes, that's the way I tried with RequestFilter, but doesn't work. I guess somewhere in PACT the headers were updated again with `request.Header.Set` ?

matt.fellows
2021-03-23 06:45
well, yes and no. The Golang HTTP client that is sending the request to your provider is likely doing this

matt.fellows
2021-03-23 06:45
I might need to do a little more digging

matt.fellows
2021-03-23 06:46
Not that I think you should necessarily change your code because its more convenient for a test framework, but it?s not very common practice to have case-sensitive header _keys_

matt.fellows
2021-03-23 06:46
Is that something that could be changed?

eric2323223
2021-03-23 06:48
I am afraid the header cannot be changed, it's used in many other services

matt.fellows
2021-03-23 06:51
Making it case insensitive is not a breaking change though, right?

matt.fellows
2021-03-23 06:51
so the other services can continue to send through the case-specific one

eric2323223
2021-03-23 06:55
My understanding the header should be case sensitive to other services as well, the service I am working on is the only service using PACT contract test.

matt.fellows
2021-03-23 06:56
fair enough then!

matt.fellows
2021-03-23 07:18
so I?m taking a look through the code, and I suspect it?s related to our use of the golang reverse proxy

matt.fellows
2021-03-23 07:19
it?s really wanting to canonicalise headers

eric2323223
2021-03-23 07:21
is it possible to add callback to update headers after the reverse proxy?

matt.fellows
2021-03-23 07:22
no, because the reverse proxy is the actual thing issuing the request to the target

eric2323223
2021-03-23 07:22
bad news

matt.fellows
2021-03-23 07:22
One option would be to vendor the current reverse proxy implementation, and making it parameterisable (or just adding our desired behaviour into it)

matt.fellows
2021-03-23 07:23
It?s a very edge casey thing, because HTTP request headers a case-insensitive.

matt.fellows
2021-03-23 07:24
so we?re working against the way they want to work (the intermediate Pact engine, currently Ruby and moving to Rust) also appear to canonicalise them too

matt.fellows
2021-03-23 07:24
I?m reaching the end of my train journey, but will have a think about a path forward here

eric2323223
2021-03-23 07:25
OK, I understand what you mean.

eric2323223
2021-03-23 07:25
Thank you very much for the help :smile:

anchit.99
2021-03-23 09:04
has joined #pact-go

joseph.method
2021-03-23 14:30
@joseph.method has left the channel

wola.adedeji
2021-03-23 16:25
has joined #pact-go

kenny.shobowale
2021-03-23 16:38
has joined #pact-go

anbu.pandian
2021-03-24 11:54
has joined #pact-go

rachel.barton
2021-03-24 19:12
has joined #pact-go

james522
2021-03-24 22:06
has joined #pact-go

anne.schuth320
2021-03-25 07:49
has joined #pact-go

james.shirtcliffe
2021-03-25 12:04
has joined #pact-go

serhii.makarenko
2021-03-25 12:55
has joined #pact-go

mashabudryte
2021-03-25 14:35
has joined #pact-go

matthew.simon.barnes_
2021-03-25 16:08
has joined #pact-go

jose.manzano
2021-03-26 14:27
has joined #pact-go

chris.faulkner
2021-03-26 16:13
has joined #pact-go

bryanw
2021-03-26 18:46
has joined #pact-go

kerem.durak
2021-03-29 08:34
has joined #pact-go

dave.clissold
2021-03-29 12:40
has joined #pact-go

sidhant.bhayana.15
2021-03-29 18:34
has joined #pact-go

crhawkins85
2021-03-30 21:02
has joined #pact-go

pranav.gore
2021-03-31 01:58
has joined #pact-go

harsha6988
2021-03-31 12:19
has joined #pact-go

leixu
2021-03-31 14:42
has joined #pact-go

matthew.brown
2021-03-31 15:15
has joined #pact-go

oleksandr.tryshchenko
2021-03-31 19:54
has joined #pact-go

phelantomas
2021-04-01 13:13
has joined #pact-go

jayeshdalal7
2021-04-01 17:43
has joined #pact-go

ktogias
2021-04-01 20:04
has joined #pact-go

ktogias
2021-04-01 21:36
@ktogias has left the channel

balaji.sivakumar
2021-04-02 05:41
has joined #pact-go

bheemreddy181
2021-04-02 21:49
if my provider has a dependency with other API - do i mock that api in my state handlers ?

matt.fellows
2021-04-03 21:50
I usually would yes

bheemreddy181
2021-04-04 03:49
do we need to convert those mocks into contract tests then ? ( create a contract workflow with other service ) or do we need to write different contract tests for that integration ?

bheemreddy181
2021-04-04 03:50
I am slightly worried about the keeping both mock response and contract tests in sync if i write different contract tests

uryadov212
2021-04-05 20:52
has joined #pact-go

soumya.aithal966
2021-04-05 22:45
has joined #pact-go

sheyan.rizfee
2021-04-06 00:55
has joined #pact-go

piotr
2021-04-06 09:24
has joined #pact-go

dmitry.korolev
2021-04-06 11:47
has joined #pact-go

dmitry.korolev
2021-04-06 11:49
@dmitry.korolev has left the channel

sravyavadrevu988
2021-04-06 20:40
has joined #pact-go

johnnycareer
2021-04-06 21:34
has joined #pact-go

johnnycareer
2021-04-06 21:41
@johnnycareer has left the channel

bheemreddy181
2021-04-06 22:35
Any examples around how we wan append JWT tokens in go middleware

matt.fellows
2021-04-07 01:00
I don?t have an example to hand, but on a previous client we did that, it was pretty straightforward, but they also already had a way of generating a JWT using a well known JWT library and so during the Pact tests we just added a filter that always added it. Are you having troubles with anything in particular?

bheemreddy181
2021-04-07 04:05
problem i have to setup the router to use the JWT config , its making things quite harder actually

matt.fellows
2021-04-07 04:07
If you use the standard dependency injection to stand up your routers, it should be easy to swap out the interface to a ?null check? or something, or depending on your test coverage, you might want to just drop JWT validation for Pact tests altogether.

bheemreddy181
2021-04-07 04:18
makes sense

bheemreddy181
2021-04-07 04:19
for dropping JWT for pact tests what should be the criteria ?

bheemreddy181
2021-04-07 04:19
And is testing a bad JWT token - A bad pact test ?

matt.fellows
2021-04-07 04:23
> for dropping JWT for pact tests what should be the criteria ? At the very least, you should have good replacement tests to ensure that it?s covered elsewhere. Especially if there is semantic information in the JWTs

matt.fellows
2021-04-07 04:23
but usually, these things are picked up fairly quickly through other means - you usually can?t explore a feature if it can?t auth, and usually, security related things are highly scrutinised

danil.nurgaliev
2021-04-07 12:26
has joined #pact-go

zbintliff
2021-04-07 13:14
Our plan on JWT is just to use the new header rules to seed our requests is a very long lived valid token

gtsifrikas
2021-04-08 08:53
has joined #pact-go

kanapuramamarnath
2021-04-08 09:18
has joined #pact-go

arnaud.dutrillaux
2021-04-09 10:59
has joined #pact-go

gsinghania
2021-04-09 15:40
has joined #pact-go

souravmohanty35
2021-04-09 16:34
has joined #pact-go

itzdavey
2021-04-09 17:23
has joined #pact-go

matt.fellows
2021-04-11 14:11
@aniket.g2185 I had a few hours this evening to do a little more on the verifier side. I think the installer is in decent shape at the moment and both message and HTTP pacts are working, with provider state value callbacks etc.

matt.fellows
2021-04-11 14:12
I?d like to release a beta soon - aside from what you shared already (specifically with logging) did you have any feedback on the package? Do you think it makes sense to remain in a `v3` sub package? How has it been ergonomically?

tmorrison
2021-04-12 00:19
@tmorrison has left the channel

laura.edington
2021-04-13 17:45
has joined #pact-go

liam.mcdermott
2021-04-13 22:38
has joined #pact-go

wedlaaa
2021-04-14 13:33
has joined #pact-go

dabfleming
2021-04-14 15:40
@matt.fellows So there's something that's really been bugging me about the pact-go api (as I've been working through proof-of-concept/demos/examples etc) Are you open to suggestions that would involve breaking changes? (cont...)

dabfleming
2021-04-14 15:45
Basically the way StateHandlers are done seems a little error-prone and not very idiomatic-Go-y. If one of my tests has `.Given("some-state")` I can pass in a StateHandlers map which doesn't contain the key ``"some-state"` , or even `nil` , and the pact-go framework doesn't produce any error. It would be nice to at least check that that key was present in the map. Even better would be implementing stateHandlers via an interface... I'm thinking something like: ```type StateHandlers interface{ SetState(key string) error }``` Similar to `http.Handler`, this would allow me to pass in my own type to manage the states: ? I can decide if a missing state is an error ? I could potentially implement this in my server struct, which can then modify its state directly, without using closures. This would seem to me to be potentially a lot cleaner.

wderksen
2021-04-14 22:26
has joined #pact-go

matt.fellows
2021-04-15 01:15
Hi @dabfleming! yes, definitely open to a breaking change. The v3 branch, which is close to beta, would be the place to try this.

matt.fellows
2021-04-15 01:15
Ideally, I?d like to make the migration from the current stable to the new branch as straightforward as possible. But also, if we?re going to introduce breaking changes, now would be the time

matt.fellows
2021-04-15 01:16
Would you like to put together an example test that shows your example in action? It doesn?t need to compile, just to show the concept?

mail_4brad
2021-04-15 02:34
has joined #pact-go

mail_4brad
2021-04-15 05:15
@mail_4brad has left the channel

goncalosamuel
2021-04-15 15:08
has joined #pact-go

dabfleming
2021-04-15 16:02
@matt.fellows Great... I'll try and throw an example together today.

matthew.hall
2021-04-15 17:36
has joined #pact-go

raony
2021-04-15 19:21
has joined #pact-go

gupta.ratnesh9
2021-04-16 04:48
has joined #pact-go

greg595au
2021-04-16 10:00
has joined #pact-go

manel_ben_yahia
2021-04-16 13:59
has joined #pact-go

maxence
2021-04-17 11:07
has joined #pact-go

kranti.deep
2021-04-17 14:17
has joined #pact-go

aaronw153
2021-04-17 21:42
has joined #pact-go

github
2021-04-19 00:57
GitHub app is successfully upgraded in your workspace :tada: To receive notifications in your private channels, you need to invite the GitHub app `/invite @GitHub`

dwmahieddine
2021-04-19 12:44
has joined #pact-go

garrettmichael
2021-04-19 18:34
has joined #pact-go

daniel.kalleward
2021-04-20 08:16
has joined #pact-go

mattias.persson
2021-04-20 12:45
has joined #pact-go

martin.eklund
2021-04-20 12:47
has joined #pact-go

enda.brody
2021-04-20 17:37
has joined #pact-go

cristian.moisa
2021-04-20 18:25
has joined #pact-go

darccide
2021-04-21 01:35
has joined #pact-go

pavel.azarau
2021-04-21 22:50
has joined #pact-go

pavel.azarau
2021-04-21 22:56
hello folks. have not found anything about it here in channel. has anybody had `Post ?http://localhost:54223/interactions?: dial tcp [::1]:54223: connect: connection refused` while calling pact.verify()? I call `pact.Setup(true)` before and I?ve confirmed it checks if a mock server was started up (by default within 10 seconds). but then I call `pact.verify` and fail with the error above. if I add a sleep for ~600 ms after `pact>Setup(true)` call the test passes

stain.witness
2021-04-22 02:43
has joined #pact-go

bheemreddy181
2021-04-22 03:31
You need to pick a random port rather than hard doing port like above


bheemreddy181
2021-04-22 03:34
Try to follow setup like in the above linked code

oleksandra.pishcheiko
2021-04-22 08:31
has joined #pact-go

akos.csurai.4github
2021-04-22 10:01
has joined #pact-go

christosbouloumpasis
2021-04-22 10:38
has joined #pact-go

steve.cook
2021-04-22 12:34
@steve.cook has left the channel

temanibeck
2021-04-22 16:04
has joined #pact-go

pavel.azarau
2021-04-22 16:38
I don?t use a specific port. by default `pact.Setup(true)` uses a random one ```if p.AllowedMockServerPorts != "" { port, perr = utils.FindPortInRange(p.AllowedMockServerPorts) } else { port, perr = utils.GetFreePort() }``` and I see different port each time I run it

michael_swiss
2021-04-22 21:04
has joined #pact-go

dawoud.sheraz
2021-04-23 09:34
has joined #pact-go

adriano.tanoue
2021-04-23 12:01
has joined #pact-go

saurabh.goel
2021-04-24 20:10
has joined #pact-go

cemal.onder
2021-04-25 12:22
has joined #pact-go

richard.forjoe
2021-04-26 00:52
has joined #pact-go

ron.aharoni
2021-04-26 11:03
has joined #pact-go

andrewmorton
2021-04-26 13:33
has joined #pact-go

aram
2021-04-26 15:24
has joined #pact-go

marcelo.souzameinberg
2021-04-26 21:32
has joined #pact-go

songqing.gu
2021-04-27 01:25
has joined #pact-go

fortiss.anita
2021-04-27 09:34
has joined #pact-go

keshav.reddy503
2021-04-27 12:06
has joined #pact-go

jeremykeczan
2021-04-27 14:57
has joined #pact-go

yeseniavega411
2021-04-27 15:31
has joined #pact-go

almantusk
2021-04-27 16:56
has joined #pact-go

alexandra.huamani
2021-04-28 00:12
has joined #pact-go

tonynguyenit18
2021-04-28 02:12
has joined #pact-go

agrawalneeraj43
2021-04-28 04:37
has joined #pact-go

shixun.liu1023
2021-04-28 04:39
has joined #pact-go

narendra.pathai
2021-04-28 06:21
has joined #pact-go

aparnachaudhari
2021-04-28 07:10
Has anyone ran into errors when running consumer contract test for one service but 2 contract test files - RESTful and async (message) in the same test run?

matt.fellows
2021-04-28 07:11
Ah, yes. This is a known problem

aparnachaudhari
2021-04-28 07:11
oh?

aparnachaudhari
2021-04-28 07:11
``` `extract_contents': undefined method `contents' for #<Pact::Interaction:0x007fd5841505e8> (NoMethodError)```

aparnachaudhari
2021-04-28 07:11
looks familiar then?


matt.fellows
2021-04-28 07:11
hmm the error doesn?t, no

matt.fellows
2021-04-28 07:12
consumer test or provider test?

aparnachaudhari
2021-04-28 07:12
consumer tests

matt.fellows
2021-04-28 07:12
right, that would make sense

matt.fellows
2021-04-28 07:13
It?s probably trying to parse the pact file that already has an item in it (a message pact or a http interaction). The current version of pact doesn?t support both in a single pact file

matt.fellows
2021-04-28 07:13
(see the main channel links I posted)

matt.fellows
2021-04-28 07:13
Simple solution: give the provider a different name (I know it?s a bit annoying, and it?s in the process of being resolved)

aparnachaudhari
2021-04-28 07:13
I see, you mean in one pact session on mock server

matt.fellows
2021-04-28 07:14
yeah, you need to have separate tests with separate mock servers (in the case of message pact, there is no mock service anyway)

aparnachaudhari
2021-04-28 07:14
our consumers and provider names are tightly tied to the service repo names.. service modules .. I think we can work around sperate sessions for now

matt.fellows
2021-04-28 07:15
ah, makes sense. you?re probably creating standard approaches/tooling I?m guessing?

aparnachaudhari
2021-04-28 07:16
yep.. lot of boiler plate code is packaged out and shared across the pipelines

matt.fellows
2021-04-28 07:17
Cool! Keen to see any of that, I?ve seen a few versions of these things. Some of it might be worth adding to Pact itself

aparnachaudhari
2021-04-28 07:17
Thanks for the quick response Matt, need to change some of the way we will be triggering tests based off of this.

matt.fellows
2021-04-28 07:17
for instance on a previous client (when I was still consulting) we built an internal tool to standardise how tokens were fetched, wrapped analytics around it etc.

matt.fellows
2021-04-28 07:18
Yeah, the main issue could be the provider side - it?s now _two_ logical providers

aparnachaudhari
2021-04-28 07:20
I see, so you are recommending that if service_a (consumer) has 2 contract tests - RESTful and async against service_b.. it would be useful to specify if service_b is going to run verification against the RESTful contract or the async contract

aparnachaudhari
2021-04-28 07:21
and the way to do that would be naming the provider side of things differently

matt.fellows
2021-04-28 07:26
correct!

matt.fellows
2021-04-28 07:26
Basically, you can?t have a pact file at the moment that has async interactions and HTTP ones

matt.fellows
2021-04-28 07:28
So you would have: `service_a` -> `service_b` for the HTTP interactions `service_a`-> `service_b_async` for the non-http interactions But both `service_b` and `service_b_async` is the same code base. It would need to run two verification processes, one for each of its named providers.

aparnachaudhari
2021-04-28 07:30
yep, about what I was thinking..

aparnachaudhari
2021-04-28 07:30
qq - what is the timeline for the fix on this

matt.fellows
2021-04-28 07:31
Not sure, it?s just been added to the core engine

matt.fellows
2021-04-28 07:31
I?m probably still at least a month away from getting the beta of the latest pact-go out

matt.fellows
2021-04-28 07:31
once that?s done, it should be fairly easy to add that support in

matt.fellows
2021-04-28 07:31
but assume at least a few months, I?d say

aparnachaudhari
2021-04-28 07:32
gotcha.. ok we can work around this for now and then we can edit it as the fix comes in

marcin.grzejszczak
2021-04-28 13:53
has joined #pact-go

scott.riley111
2021-04-28 15:45
has joined #pact-go

flubniewski
2021-04-28 17:01
has joined #pact-go

github2
2021-04-28 22:24
[pact-foundation/pact-go] Pull request opened by dependabot-preview[bot]

aparnachaudhari
2021-04-29 20:06
I am seeing something when writing a consumer contract for a message type interaction .. even tho the test case specifies ```message := pact.AddMessage() message. Given("Some test message"). ExpectsToReceive("Some test message back").```

aparnachaudhari
2021-04-29 20:06
I see ```"messages": [ { "description": "Some test message back", "providerStates": [ { "name": "a", "params": null } ],```

aparnachaudhari
2021-04-29 20:08
per ```// Given specifies a provider state. Optional. func (p *Message) Given(state string) *Message { p.States = []State{State{Name: state}} return p }```

aparnachaudhari
2021-04-29 20:08
The state should have been set but looks like its not?

aparnachaudhari
2021-04-29 20:14
I do not see where the Param is being set at all

aparnachaudhari
2021-04-29 20:15
for ```type State struct { Name string `json:"name"` Params map[string]interface{} `json:"params,omitempty"` }```

aparnachaudhari
2021-04-29 20:29
and it should be omitted but it is not apparently

aparnachaudhari
2021-04-29 23:46
ignore ^

matt.fellows
2021-04-30 01:59
Hmmmm

matt.fellows
2021-04-30 02:00
that all looks strange to me

matt.fellows
2021-04-30 02:00
which version are you using?

aparnachaudhari
2021-04-30 02:00
~of pact stand alone ruby?~

aparnachaudhari
2021-04-30 02:00
```pact-ruby-standalone 1.88.49```


matt.fellows
2021-04-30 02:04
thx

matt.fellows
2021-04-30 02:05
might be worth just doing a clean of the pact dir and starting fresh, just in case

matt.fellows
2021-04-30 02:05
otherwise, might need a repro

matt.fellows
2021-04-30 02:05
I?ll take a look this afternoon otherwise

aparnachaudhari
2021-04-30 02:05
clean out of pact dir? you mean to delete the generated json?

aparnachaudhari
2021-04-30 02:17
let me know if you need any help with repro

matt.fellows
2021-04-30 02:21
Just ran the example in the pact-go repository, and it generates the correct pact file

matt.fellows
2021-04-30 02:22
```cd $GOPATH/src/github.com/pact-foundation/pact-go/examples/messages/consumer go test -count=1 -tags consumer -v . cat $GOPATH/src/github.com/pact-foundation/pact-go/examples/pacts/pactgomessageconsumer-pactgomessageprovider.json```

matt.fellows
2021-04-30 02:22
should be able to see if it works

aparnachaudhari
2021-04-30 02:26
you are not seeing the param being picked up?

matt.fellows
2021-04-30 02:27
nope, it?s being set to `null` (which also doesn?t look right, but actually shouldn?t cause any issues)

matt.fellows
2021-04-30 02:28
It generates this: ```{ "consumer": { "name": "PactGoMessageConsumer" }, "provider": { "name": "PactGoMessageProvider" }, "messages": [ { "description": "a user", "providerStates": [ { "name": "user with id 127 exists", "params": null } ], "contents": { "access": [ { "role": "admin" }, { "role": "admin" }, { "role": "admin" } ], "id": 127, "name": "Baz" }, "matchingRules": { "body": { "$.access": { "matchers": [ { "min": 3 } ] }, "$.access[*].*": { "matchers": [ { "match": "type" } ] }, "$.access[*].role": { "matchers": [ { "match": "regex", "regex": "admin|controller|user" } ] }, "$.id": { "matchers": [ { "match": "type" } ] } } }, "metaData": { "Content-Type": "application/json; charset=utf-8" } }, { "description": "an order", "providerStates": [ { "name": "an order exists", "params": null } ], "contents": { "id": { "json_class": "Pact::SomethingLike", "contents": 42 }, "item": { "json_class": "Pact::Term", "data": { "generate": "apple", "matcher": { "json_class": "Regexp", "o": 0, "s": "(apple|orange)" } } } }, "matchingRules": { }, "metaData": { "Content-Type": "application/json; charset=utf-8" } } ], "metadata": { "pactSpecification": { "version": "3.0.0" } } }```

aparnachaudhari
2021-04-30 02:29
it technically should not, but when I re-run the consumer tests I see ```2021/04/29 11:55:13 [ERROR] service: Could not load existing consumer contract from /<path_redacted>/pact-example-consumer/pacts/example-todo-consumer-async-example-todo-provider.json due to 757: unexpected token at 'null'. Creating a new file.```

matt.fellows
2021-04-30 02:29
(just trying with latest Ruby binary now)

aparnachaudhari
2021-04-30 02:30
so `"params": null` should technically be omitted yea? since its `json:"params,omitempty"`

aparnachaudhari
2021-04-30 02:30
or is this being handled somewhere down stream that I cannot see in the go code

matt.fellows
2021-04-30 02:30
yes, but the pact is serialised by the Ruby binary, which might be doing it

matt.fellows
2021-04-30 02:30
yeah

matt.fellows
2021-04-30 02:30
I?ve just tried with 1.88.51

matt.fellows
2021-04-30 02:32
If you can share more code, please do (or DM me)

matt.fellows
2021-04-30 02:32
I?ll give it a go a little later today

matt.fellows
2021-04-30 02:33
:thinking_face:

matt.fellows
2021-04-30 02:33
any chance you could please share that offline with me?

aparnachaudhari
2021-04-30 02:33
share the test code?

aparnachaudhari
2021-04-30 02:34
and same results?

matt.fellows
2021-04-30 02:34
yep

matt.fellows
2021-04-30 02:35
the badly formatted JSON would help too

matt.fellows
2021-04-30 02:35
but the test code would also help

aparnachaudhari
2021-04-30 02:35
```{ "consumer": { "name": "example-todo-consumer-async" }, "provider": { "name": "example-todo-provider-async" }, "messages": [ { "description": "Test user information message", "providerStates": [ { "name": "Test User exists", "params": null } ], "contents": { "access": [ { "role": "admin" }, { "role": "admin" }, { "role": "admin" } ], "id": 127, "name": "Baz" }, "matchingRules": { "body": { "$.access": { "matchers": [ { "min": 3 } ] }, "$.access[*].*": { "matchers": [ { "match": "type" } ] }, "$.access[*].role": { "matchers": [ { "match": "regex", "regex": "admin|controller|user" } ] }, "$.id": { "matchers": [ { "match": "type" } ] } } }, "metaData": { "Content-Type": "application/json; charset=utf-8" } } ], "metadata": { "pactSpecification": { "version": "3.0.0" } } }```

aparnachaudhari
2021-04-30 02:36
this I can share ^ its pretty much the sample test but we were using it to trigger our service CI/CD

aparnachaudhari
2021-04-30 02:36
when I noticed it

matt.fellows
2021-04-30 02:37
is that this file: `pact-example-consumer/pacts/example-todo-consumer-async-example-todo-provider.json` ?

matt.fellows
2021-04-30 02:38
Thte error above is that it can?t parse the JSON document. Thte file you shared is definitely valid JSON

aparnachaudhari
2021-04-30 02:38
yep thats the file

matt.fellows
2021-04-30 02:38
:thinking_face:

matt.fellows
2021-04-30 02:40
Could you please try updating to the latest Ruby binary? I?m now just thinking that version is bad

matt.fellows
2021-04-30 02:41
I just added that to the test pact file here for messages, re-ran the tests and it appended the new interaction just fine

aparnachaudhari
2021-04-30 02:42
ok let me give that a shot

tjones
2021-04-30 11:40
@matt.fellows: We get that `null` error with pact-js when tests are writing to the same file concurrently. Don't know if it's related

matt.fellows
2021-04-30 11:46
Huh, interesting thanks Tim

roy_collings
2021-04-30 15:15
has joined #pact-go

prachi_mangesh_edake
2021-05-03 04:43
has joined #pact-go

sams.prashanth
2021-05-03 08:04
has joined #pact-go

philip.m.wood
2021-05-03 12:46
has joined #pact-go

amiller
2021-05-03 15:27
has joined #pact-go

agarwal.akash333
2021-05-03 23:14
has joined #pact-go

marcin.grzejszczak
2021-05-04 07:27
@marcin.grzejszczak has left the channel

anand.ilkal
2021-05-04 08:01
has joined #pact-go

dennis.minard
2021-05-04 16:23
has joined #pact-go

chris.williams
2021-05-04 16:41
has joined #pact-go

ssorcnafets
2021-05-04 19:20
has joined #pact-go

kowalczuk.jnr
2021-05-04 22:24
has joined #pact-go

hugo
2021-05-05 00:48
has joined #pact-go

jadelong
2021-05-05 15:51
has joined #pact-go

alexei.solcanu
2021-05-06 02:01
has joined #pact-go

zonkor
2021-05-06 08:08
has joined #pact-go

florian.mautendorfer
2021-05-06 14:04
has joined #pact-go

john.mcnulty
2021-05-06 16:49
has joined #pact-go

tarunmehrotra3
2021-05-10 06:31
has joined #pact-go

jbecker
2021-05-10 16:31
has joined #pact-go

github2
2021-05-11 00:34
[pact-foundation/pact-go] Issue opened by dabfleming

eric2323223
2021-05-11 04:44
Could anyone please share a example of define optional query parameter for consumer test with pact-go?

james.wettenhall
2021-05-11 04:54
has joined #pact-go

eduardo.marques
2021-05-11 09:19
has joined #pact-go

al8x.romanov
2021-05-11 13:09
has joined #pact-go

aparnachaudhari
2021-05-11 18:56
I noticed that `ConsumerVersionSelectors` is not part of the `VerifyMessageRequest` but only `VerifyRequest` . Any idea how to choose multiple consumer versions for async tests?

jr.jenks
2021-05-11 21:46
has joined #pact-go

dabfleming
2021-05-11 22:10
It does seem like more parity between `VerifyRequest` and `VerifyMessageRequest` would make sense.

dabfleming
2021-05-11 22:22
@matt.fellows When you're around, a question. Does the branch `feat/v3-ffi-verifier` on github represent a reasonably current snapshot of pact-go v3 development? We're starting to run into some sticky problems in how we might apply pact to our existing services and practices... contemplating suggesting some changes that might help us out, but want to base any feedback on what's current/upcoming if possible.

matt.fellows
2021-05-11 22:40
Yeah it does. The code is a bit of a mess behind the scenes as it was based on a spike from ~4 years ago, but I?m migrating to the new FFI based rust interface, so let me know where you?re going to look. If possible, suggestions to the public facing API without regard to implementation is probably your best bet Else, one option is to setup a call and navigate some of it together.

matt.fellows
2021-05-11 22:40
The provider interface is close enough to done for a first cut though, despite some shortcomings

aparnachaudhari
2021-05-11 23:20
Hello, I am looking to add message tests between two services where the message contents are marshaled protobuf, the consumer marshals the message and provider unmarshals it. Has anyone worked on adding this type of async tests? Any pointers will be helpful.

sammomichael
2021-05-12 02:27
has joined #pact-go

matt.fellows
2021-05-12 02:52
Interesting. I think you?re going to have to do something like convert the protobuf message to a base64 encoded payload that is embedded into a JSON blob, and unpack it on the consumer side.

matt.fellows
2021-05-12 02:55
Just linked you in the #protobufs channel on a relevant concept

tony.foster
2021-05-12 03:44
has joined #pact-go

aparnachaudhari
2021-05-12 03:45
Just saw this.. hmm interesting. I came across https://github.com/pact-foundation/pact-jvm/issues/878 I think his usecase sort of aligns with what I want to do... but I need to read more

jan.businsky
2021-05-12 09:10
has joined #pact-go

lreisch
2021-05-12 19:23
has joined #pact-go

jorge.curima.corp
2021-05-13 01:37
has joined #pact-go

anh.evizi.test
2021-05-13 05:56
has joined #pact-go

yka259
2021-05-13 08:22
has joined #pact-go

joshibharat
2021-05-13 11:43
has joined #pact-go

smankala
2021-05-13 20:55
has joined #pact-go

aparnachaudhari
2021-05-13 22:03
I think the README doc for go async provider side of tests is out of date. Is this something I should raise somewhere as ticket or already known? README https://github.com/pact-foundation/pact-go#provider-producer is out of date..  `dsl.MessageProviders` is not part of the pact-go any more

matt.fellows
2021-05-13 22:41
You?re right, sorry


aparnachaudhari
2021-05-14 03:55
Yeah.. have been using that as source of truth.. just wanted to let y'all know

martin.pelikan
2021-05-14 06:48
has joined #pact-go

joao_glorioso
2021-05-14 08:41
has joined #pact-go

ashok.jan31
2021-05-14 12:25
has joined #pact-go

gusfisha
2021-05-14 19:52
has joined #pact-go

keithgutfreund
2021-05-14 20:13
has joined #pact-go

k.gutfreund
2021-05-15 03:47
has joined #pact-go

siegcollado
2021-05-17 05:03
has joined #pact-go

simon.thomas1978
2021-05-17 08:53
has joined #pact-go

keimiokamoto
2021-05-17 10:36
has joined #pact-go

fabian.feary
2021-05-17 11:52
has joined #pact-go

josh.brangwyn
2021-05-17 12:19
has joined #pact-go

xiao.liang
2021-05-17 16:41
has joined #pact-go

bhattacharyyasom
2021-05-18 14:05
has joined #pact-go

lalit210784
2021-05-18 17:55
has joined #pact-go

zaxosdimi
2021-05-18 22:14
has joined #pact-go

viktor.trako
2021-05-19 15:45
has joined #pact-go

abdel.akkoub
2021-05-19 17:27
has joined #pact-go

akrala
2021-05-19 21:22
has joined #pact-go

mazi.fayazfar
2021-05-19 22:23
has joined #pact-go

daniel.qu
2021-05-20 18:03
has joined #pact-go

vijay.chawla
2021-05-21 08:37
has joined #pact-go

tim.walter
2021-05-21 09:12
has joined #pact-go

ankit.laddha
2021-05-21 14:03
has joined #pact-go

dimundo
2021-05-21 14:09
has joined #pact-go

include.melaz
2021-05-22 13:15
has joined #pact-go

uddhavchopade
2021-05-23 08:32
has joined #pact-go

lukasz.wlosek
2021-05-24 08:03
has joined #pact-go

komathy_priya_dhanas
2021-05-24 09:26
has joined #pact-go

nh.salah
2021-05-24 11:46
has joined #pact-go

erinc1915
2021-05-24 16:11
has joined #pact-go

nzarate
2021-05-24 18:11
has joined #pact-go

github2
2021-05-24 19:23
[pact-foundation/pact-go] Pull request opened by dependabot-preview[bot]

github2
2021-05-24 19:23
[pact-foundation/pact-go] Pull request closed by dependabot-preview[bot]

jonathan.arreola
2021-05-24 21:20
has joined #pact-go

cesar.consultorjr
2021-05-24 21:39
has joined #pact-go

gdfesta
2021-05-25 00:44
has joined #pact-go

utsavk3210
2021-05-25 08:37
has joined #pact-go

daniel.cardinha
2021-05-25 10:06
has joined #pact-go

dan.haughey
2021-05-25 14:34
has joined #pact-go

vince.lee
2021-05-25 14:36
has joined #pact-go

pact544
2021-05-25 16:01
has joined #pact-go

shlomi
2021-05-25 22:41
has joined #pact-go

raquel.bautista
2021-05-26 09:38
has joined #pact-go

aubilla
2021-05-26 09:52
has joined #pact-go

vishnuprakash323
2021-05-26 10:46
has joined #pact-go

rob.caiger
2021-05-26 11:54
has joined #pact-go

lio.lunesu
2021-05-26 17:55
has joined #pact-go

nahuel.dallavecchia
2021-05-26 20:24
has joined #pact-go

mathew.baltes
2021-05-26 23:33
has joined #pact-go

stephen.leece
2021-05-26 23:44
has joined #pact-go

james_fraser
2021-05-27 09:23
has joined #pact-go

mostafa.zaher
2021-05-27 10:13
has joined #pact-go

utsavtiwary10
2021-05-27 10:53
has joined #pact-go

kamoljan
2021-05-28 02:39
has joined #pact-go

eric2323223
2021-05-28 03:55
Hi, I want to verify a optional query parameter, such as `my-context`, in the consumer test with PACT-go, this query parameter could contains multiple key pairs, such as `name=eric,gender=male`. May I know how to define the Query matcher?

matt.fellows
2021-05-28 04:41
I think there is an example in the github repo

matt.fellows
2021-05-28 04:41
Something like this: ``` WithRequest(request{ Method: "POST", Path: term("/login/10", "/login/[0-9]+"), Query: dsl.MapMatcher{ "foo": term("bar", "[a-zA-Z]+"), }, Body: loginRequest, Headers: commonHeaders, }).```

eric2323223
2021-05-28 04:55
@matt.fellows Thank you for the answer, there is only one element in your sample query parameter `foo`, may I know how to define matcher when multiple elements in one query parameter? I have not yet found similar example in the repository

matt.fellows
2021-05-28 05:49
add another?

matt.fellows
2021-05-28 05:50
Can you please show what the actual query looks like from an http client?

marko.justinek
2021-05-28 06:04
I assume the question is whether it is currently possible to use an `includes.anyOfOrAll("name=eric", "gender=male")` kind of matcher for the request query, where the order of these key-value pairs might be different between the pact test declaration and actual API call?

marko.justinek
2021-05-28 06:07
though pact spec v3 supports this by https://github.com/pact-foundation/pact-specification/tree/version-3#query-strings-are-stored-as-map-instead-of-strings as an object of key-value pairs, not a string (or string matcher)?

marko.justinek
2021-05-28 06:08
worth sharing which version of what you?re using @eric2323223

matt.fellows
2021-05-28 06:27
I?m probably a week or two away from having a beta v3 on the consumer side

matt.fellows
2021-05-28 06:27
But I?m still not clear on what the query looks like

matt.fellows
2021-05-28 06:28
you can?t have `=` in a query string value, for obvious reasons

marko.justinek
2021-05-28 06:32
I wouldn?t mind getting ?my? headspace back so I could start thinking about the provider side on Swift (not that there is tonnes of demand :sweat_smile: - but we did have a bloke ask for it using Vapor (the future of web development :grinning_face_with_one_large_and_one_small_eye: ) (I thinks) :man-shrugging:

eric2323223
2021-05-28 07:41
I am using v1.88.3

matt.fellows
2021-05-28 08:00
What's the query you want to use tho Erik so I can help?

mathias.duesterhoeft
2021-05-28 08:59
has joined #pact-go

matty_o_connor01
2021-05-28 15:57
has joined #pact-go

nathaniel.emmons
2021-05-28 18:25
has joined #pact-go

github2
2021-05-29 12:50
[pact-foundation/pact-go] Pull request merged by mefellows

github2
2021-05-29 12:51
[pact-foundation/pact-go] Pull request merged by mefellows

matt.fellows
2021-05-29 13:01
:wave: I know a few people have been asking about v3 support in pact-go. I?m pleased to say we?re moving closer to a beta. Consumer examples: https://github.com/pact-foundation/pact-go/blob/2.x.x/examples/v3/consumer_test.go Provider examples: https://github.com/pact-foundation/pact-go/blob/2.x.x/examples/v3/provider_test.go It supports both the v2 and v3 specification, message pact, including all of the new matchers, binary payloads, values from provider states etc.. It also now uses the rust share core, and is pretty darn performant. The API has changed a bit, and I will document a migration guide once we settle on what the interface looks like. I?d like feedback on this in particular topic, because obviously this is where you?ll be using things day to day. (also everything is currently in a `v3` sub package, which I also plan to change)

matt.fellows
2021-05-29 13:03
From here, the plan is to clean up the rough edges, start using it in the edges of Pactflow (e.g. our Terraform provider) and other pet projects, in order to tease it out. Any community testers would be much appreciated. (cc @dabfleming @zbintliff @aniket.g2185)

sapoho3257
2021-05-29 16:10
has joined #pact-go

github2
2021-05-29 23:07
[pact-foundation/pact-go] New release _https://github.com/pact-foundation/pact-go/releases/tag/2.0.0-alpha.1_ published by mefellows

andjela.rajic
2021-05-30 20:00
has joined #pact-go

aniket.g2185
2021-05-31 01:49
Awesome @matt.fellows !! bit occupied with something else, but would check it out soon !! Cheers!

matt.fellows
2021-05-31 02:58
No worries

matt.fellows
2021-05-31 02:58
Ping me when you do, it?ll probably be changed by the time you show up to play with it :wink:

sumitsg004
2021-05-31 05:10
has joined #pact-go

james_fraser
2021-05-31 09:00
@james_fraser has left the channel

allan.barbosa
2021-05-31 14:08
has joined #pact-go

vinicius.grund
2021-05-31 14:35
has joined #pact-go

todd.lemmonds
2021-06-01 15:57
has joined #pact-go

alexander.infante
2021-06-01 15:57
has joined #pact-go

michael.doyle
2021-06-01 15:58
has joined #pact-go

paulorochag
2021-06-01 20:20
has joined #pact-go

jaspal.gill
2021-06-02 15:23
has joined #pact-go

wenqiglantz
2021-06-02 18:19
has joined #pact-go

ch.toimbetov
2021-06-02 21:46
has joined #pact-go

kyle.florence
2021-06-03 04:57
@kyle.florence has left the channel

xyz1kind
2021-06-03 05:03
has joined #pact-go

aftab.shamim2020
2021-06-03 06:02
has joined #pact-go

slu.mendozaharold
2021-06-03 10:33
has joined #pact-go

bheemreddy181
2021-06-03 14:58
For some reason i feel each like is so confusing i know that the function implementation explains it all ```func EachLike(content interface{}, minRequired int) Matcher {Matt Fellows, 3 years ago: ? feat(api): uplift API to support better match? return eachLike{ Contents: content, Min: minRequired, } }``` that we atleast require one element here of that kind with a value

bheemreddy181
2021-06-03 15:00
We did the same thing but that fails , here is what it looks like ```WillRespondWith(dsl.Response{ Status: 200, Body: dsl.Like(map[string]interface{}{ "underwriting_decisions": dsl.EachLike(dsl.EachLike(map[string]interface{}{"equation_results": dsl.EachLike(map[string]interface{}{"equation_name": dsl.Like("NC_Tier_Model")}, 1)}, 1), 1), }), Headers: responseCommonHeaders, })```

bheemreddy181
2021-06-03 15:00
here is the validation failure

greg.tyler
2021-06-03 15:05
Looks like you?ve got an extra `EachLike` at the start? I think you want: ```dsl.EachLike(map[string]interface{}{"equation_results": dsl.EachLike(map[string]interface{}{"equation_name": dsl.Like("NC_Tier_Model")}, 1)}, 1),``` Because the actual response is: ```{"underwriting_decisions":[{"equation_results":...}]}``` But your Pact expectation is: ```{"underwriting_decisions":[[{"equation_results":...}]]}```

zbintliff
2021-06-03 20:40
I?ll see if I can?t get someone to look at it this sprint!

zbintliff
2021-06-03 20:41
If this is using gomod will it still be in `v3/` dir?

bheemreddy181
2021-06-03 20:49
Ah makes sense

bheemreddy181
2021-06-03 20:49
So if i have multiple arrays does the validation look for each array to have atleast one item of this kind ?

matt.fellows
2021-06-03 23:28
good question

matt.fellows
2021-06-03 23:29
right now, it?s in the `v3` folder simply because during development I had it working in parallel with the existing code

matt.fellows
2021-06-03 23:29
Originally, I made it completely backwards compatible, but made the decision to change some of the interface as I went through.

matt.fellows
2021-06-03 23:30
I?m still not sure what?s best. I?ll be adding support back in for a similar API soon. Pretty straightforward I think, so migration could be easier

matt.fellows
2021-06-03 23:30
Anyway, I would love feedback on the interface. I was always a bit uncomfortable with everything being in the `dsl` package. Thoughts welcome on that Zach!

matt.fellows
2021-06-04 01:24
yes

matt.fellows
2021-06-04 01:24
`Eachlike` says ?this element should be an array, where each element of the array should have the following shape?

matt.fellows
2021-06-04 01:24
It?s basically the `Like` matcher, but for arrays

matt.fellows
2021-06-04 01:25
In the new branch, there is an `ArrayContains` matcher that lets you have _different_ objects in it :stuck_out_tongue:

sergio.artero
2021-06-04 10:07
has joined #pact-go

zbintliff
2021-06-04 13:47
Oh awesome. I linked this thread to a teammate that shoudl be able to look at it this sprint

bheemreddy181
2021-06-04 14:26
makes sense

v-gabriel.dantas
2021-06-04 15:26
has joined #pact-go

leonardo.viana
2021-06-04 18:52
has joined #pact-go

yashdev963
2021-06-07 06:51
has joined #pact-go

i.pinzari
2021-06-07 17:27
has joined #pact-go

aparnachaudhari
2021-06-07 18:36
@matt.fellows I would be interetestd too

gurkiratguliani
2021-06-07 19:36
has joined #pact-go

matt.fellows
2021-06-08 12:26
I?ve just added a migration guide to the repo: https://github.com/pact-foundation/pact-go/blob/2.x.x/MIGRATION.md

matt.fellows
2021-06-08 12:26
The rest of the docs (i.e. the readme and also the source code) still need updating, so just note that.