thadir
2017-05-22 09:23
has joined #pactteshelp

beth
2017-05-22 09:24
has joined #pactteshelp

matt
2017-05-22 09:24
has joined #pactteshelp

marcevers
2017-05-22 09:24
has joined #pactteshelp

thadir
2017-07-13 11:06
I walked in to a interesting problem with a provider test: made a post about it if any one knows the answer Im interested:


beth
2017-07-13 23:35
Tricky! Hope someone can help you out there.

beth
2017-07-13 23:36
I'll see if anyone at DiUS has used jersy.

thadir
2017-07-17 09:55
I figured it out last weeken. scary stuff...

thadir
2017-07-17 09:55
Ill update the fix.

gareth
2017-08-07 01:29
has joined #pactteshelp

gareth
2017-08-07 01:34
hi guys, sorry if this is an obvious one, wasn't able to find an answer with google or by searching in slack. My problem is I deleted pacts for a provider on the broker, assuming (wrongly) that the next consumer publish would be ok. Now on publishing from the consumer build I am getting an error message: ```FAILED! 409 Conflict - This is the first time a pact has been published for "<provider name>"``` Is there a simple solution?

gareth
2017-08-07 01:54
In case someone else runs into the somewhat obvious problem: You need to post to the brokers "pacticipants" endpoint, with a body of ```{ "name": "<provider name>" }```

beth
2017-08-07 02:13
@gareth the problem is that you didn't see the full message. You only need to manually publish the consumer if the name is deemed "similar" to an existing one. It makes you create it manually to ensure that you don't end up with different names for the same consumer.

beth
2017-08-07 02:13
The rest of the error message explains that, however, it is not shown by the publish tool.

beth
2017-08-07 02:14
@rholshausen is that fixed in a more recent version?

rholshausen
2017-08-07 02:14
has joined #pactteshelp

gareth
2017-08-07 02:15
:thumbsup: thanks for the explanation @beth

thadir
2017-08-31 12:57
Hey any one know the status of the JS and angular 4.0.0? https://github.com/pact-foundation/pact-js/issues/59 were running in some nasty problems bc I want now slowly to enforce PACT on the UI elements as well.

matt
2017-08-31 21:15
@thadir it works. the best approach though is always to not use Karma or Jasmine where possible. Split your tests into separate suites. If your code is modular, then you should be able to test your API components separately therefore your pact contract tests can run in any environment.

tjones
2017-09-05 06:09
has joined #pactteshelp

mzacharska
2017-10-03 21:26
has joined #pactteshelp

fkoner
2017-11-15 16:10
has joined #pactteshelp

m.groeneweg
2018-01-11 08:22
has joined #pactteshelp

james
2018-02-25 12:37
has joined #pactteshelp

aserafim
2018-04-16 18:44
has joined #pactteshelp

aserafim
2018-04-16 18:46
Hello, I have pactbroker hosted with http://pact.dius.com.au and I am currently getting 504

aserafim
2018-04-16 18:58
is there anyone looking into this?

thadir
2018-06-15 02:25
has joined #pactteshelp

beth
2018-06-15 02:28
has joined #pactteshelp

matt
2018-06-15 02:28
has joined #pactteshelp

marcevers
2018-06-15 02:28
has joined #pactteshelp

gareth
2018-06-15 02:28
has joined #pactteshelp

rholshausen
2018-06-15 02:28
has joined #pactteshelp

tjones
2018-06-15 02:28
has joined #pactteshelp

mzacharska
2018-06-15 02:28
has joined #pactteshelp

fkoner
2018-06-15 02:28
has joined #pactteshelp

m.groeneweg
2018-06-15 02:28
has joined #pactteshelp

james
2018-06-15 02:28
has joined #pactteshelp

aserafim
2018-06-15 02:28
has joined #pactteshelp

antonios.klimis
2018-08-08 09:45
has joined #pactteshelp

rsaccoll
2018-08-27 13:28
has joined #pactteshelp

joguespermana
2018-09-05 03:38
has joined #pactteshelp

mattgilbert90
2018-09-10 12:53
has joined #pactteshelp

borsuk.artem034
2018-10-31 14:00
has joined #pactteshelp

anothonyvong
2018-11-01 21:37
has joined #pactteshelp

hansrd_98
2018-11-02 01:43
has joined #pactteshelp

kurst03
2018-11-18 00:43
has joined #pactteshelp

amitojduggal
2018-12-10 14:00
has joined #pactteshelp

thirumal.net
2019-03-01 22:44
has joined #pactteshelp

thirumal.net
2019-03-01 22:45
@thirumal.net has left the channel

venkata.uday24
2019-03-25 00:11
has joined #pactteshelp

venkata.uday24
2019-03-25 00:11
Hi, Can we use pact to perform contract tests on kafka?

venkata.uday24
2019-03-25 00:12
Can some one help me on this context.

thadir
2019-03-30 21:10
@thadir has left the channel

nathan.deamer
2019-04-08 10:54
has joined #pactteshelp

anabalfun
2019-05-22 09:52
has joined #pactteshelp

void.alexey
2019-06-06 16:21
has joined #pactteshelp

n.chachampis
2019-06-12 06:31
has joined #pactteshelp

n.chachampis
2019-06-12 06:31
@n.chachampis has left the channel

agarwalatrisha1212
2019-06-18 03:19
has joined #pactteshelp

anders
2019-07-10 12:27
has joined #pactteshelp

anders
2019-07-10 12:31
I recently posted https://stackoverflow.com/q/56970358/854151, but figured I'd raise it here as well. Is there any sensible way to define a pact contract between a persistent service and a _synchronous_ serverless function? All the examples I've seen rely either on HTTP for synchronous APIs, or message-passing for serverless functions, neither of which fit this requirement.

tjones
2019-07-11 06:13
Hi Anders, not sure if it's what you're looking for, but have you seen this: https://dius.com.au/2018/10/01/contract-testing-serverless-and-asynchronous-applications-part-2/ ?

anders
2019-07-11 08:34
Yep, I read that, but it didn't seem to address my needs, as this is still event/message-focused, i.e. asynchronous, whereas my needs are for a synchronous function.

tjones
2019-07-15 05:05
How do you invoke your function?

tjones
2019-07-15 05:06
The link in the stackoverflow question suggests it is via http?

tjones
2019-07-15 05:09
> we use the serverless framework, which performs the actual HTTP request behind the scenes. best practice for pact tests is to have the HTTP requests sent "behind the scenes" anyway - since the test invokes your API layer, rather than directly making the request

anders
2019-07-25 11:04
We invoke it using the `com.amazonaws:aws-java-sdk-lambda` JVM artifact dependency, with a `@LambdaFunction` annotated interface function (which provides the function name), and using `LambdaInvokerFactory` (passing along the required credentials) building an instance of this interface, on which we can call this function.

fil.tmb
2019-08-20 11:04
has joined #pactteshelp

joao
2019-08-29 13:36
has joined #pactteshelp

lwillmeth
2019-09-18 15:29
has joined #pactteshelp

lwillmeth
2019-10-02 16:48
Is there a best-practice FAQ for CI/CD pipelines? How does the pact broker handle multiple pacts from the same consumer? For example, say I have a consumer with branches master, develop, feature. Let's say the feature contract fails. If pact testing is built into my CI/CD pipeline on the provider side, I could keep a list of branches that should fail based on contract tests. That way I could run the feature contract without failing the provider build. Just thinking out loud here, but curious how others handle this.

lwillmeth
2019-10-02 19:56
It looks like the 'right' way to handle this is probably using version numbers on both the consumer and provider, and probably only passing provider builds that can validate pacts after a specific consumer version number. https://docs.pact.io/getting_started/versioning_in_the_pact_broker I'm still interested in other ideas though. :grinning:

catrionamcgarvey
2019-10-08 15:59
has joined #pactteshelp

safiyya
2019-10-14 16:55
has joined #pactteshelp

safiyya
2019-10-15 09:33
Hi, I?m trying to get Pact working for a application relying on Google Cloud Pub/Sub. Are there any examples out there?

travis.anderson
2019-10-18 18:03
has joined #pactteshelp

travis.anderson
2019-10-18 18:28
Can somebody shed some light on how verification on the Provider side works? The examples are pretty light on information here (particularly the e2e example) but it seems like the actual methods (POST. GET, etc) are not being called on the Provider side? After digging in to the source code a little bit, it seems like a proxy server is created, a request filter can be provided to describe the "shape" of request methods (Express -> req, res, next)? So are any methods in the source code of the provider actually being called? And also, the services I am testing use Koa.js, so my requestFilter might look like (ctx, next)?

travis.anderson
2019-10-21 17:08
Does anybody from Pact have any insight on this? ^^^ Particularly this part: > So are any methods in the source code of the provider actually being called?

travis.anderson
2019-10-21 17:13
For reference, I am leaning on the pact-js e2e example as I am implementing a testing solution in JS

lwillmeth
2019-10-21 21:59
I'm not with Pact, and am just here learning. If you're talking about Provider-side verification, my understanding is that Pact replays Interactions against your real endpoints. https://docs.pact.io/getting_started/how_pact_works

lwillmeth
2019-10-21 22:06
On the consumer side, my understanding is that Pact mocks a provider at a given url and port. Each interaction is an expected request and mocked response, and no code from the provider will be executed. Calling provider.verify() asserts that all current interactions have been called, preventing unused interactions.

travis.anderson
2019-10-21 22:13
Yes, I am talking about Provider-side verification. I guess the disconnect in implementation on that part is some amount of hidden logic involved in the verification? Because in the js examples I found, each state handler returns a `Promise.resolve("Some string")`, so do we basically just need a database up and running with the expected values to be returned?

travis.anderson
2019-10-21 22:15
Is literally all of the heavy lifting done on the Consumer side tests? And how does the verification process know how to retrieve specific data if that logic lives in the Provider service?

lwillmeth
2019-10-21 22:17
The Consumer makes a list of expectations (a contract) and sends it to the Broker. Later, the Provider fetches that contract, which is a list of expected queries and responses, and replays the queries against itself. If they match, the contract passes. It sounds like what you're asking is, how does that replay process happen, and how does a database on the provider side work.

lwillmeth
2019-10-21 22:18
Personally, my providers have a fixtures file for the database and any outside services, so that everything's in a known state. So when I get a request for /info?user=123, I know that's a legit user from my fixture files, and here's their info.

matt.fellows
2019-10-21 22:19
has joined #pactteshelp

bethskurrie
2019-10-21 22:19
has joined #pactteshelp

lwillmeth
2019-10-21 22:19
For me, the provider-side verification is easier, because I just reset my fixtures file between each query.

lwillmeth
2019-10-21 22:20
Does that help?

matt.fellows
2019-10-21 22:21
For all intents and purposes of users of the library, the proxy should be ignored - it?s implementation detail

matt.fellows
2019-10-21 22:22
Your provider server should start up and be running on a port

matt.fellows
2019-10-21 22:22
And then you point the verification process at that server and port





matt.fellows
2019-10-21 22:25
there are lots of options being set in that e2e example, mostly for regression of the API, but also to help people see what is possible

lwillmeth
2019-10-21 22:25
Provider States let you put the provider into a specific state (load a different fixtures file, mock an external services, whatever) on a per-request basis. So you can make the same request several times in a row, but expect different responses. https://docs.pact.io/getting_started/provider_states

matt.fellows
2019-10-21 22:37
> Yes, I am talking about Provider-side verification. I guess the disconnect in implementation on that part is some amount of hidden logic involved in the verification? Because in the js examples I found, each state handler returns a Promise.resolve(?Some string?), so do we basically just need a database up and running with the expected values to be returned? The provider state handler functions receive a string (the state) e.g. `User A exists`. It?s job is to setup the state of the provider so that the scenario can happen. This usually takes the form of updating a local database, in this case, ensuring User A exists.

matt.fellows
2019-10-21 22:37
if the state is `User A does not exist` it might remove that user

matt.fellows
2019-10-21 22:37
I tend to mostly have a single DB fixture with all of the states already setup in it, but that isn?t always possible

matt.fellows
2019-10-21 22:38
The return value of the state handler is irrelevant, it just needs to be fulfilled. If it is rejected, the test will fail

travis.anderson
2019-10-22 20:15
I just want to say thank you to @lwillmeth and @matt.fellows for the helpful explanation of Provider-side verification yesterday. I let my brain marinate in it overnight and got everything hooked up correctly this morning. I really appreciate it, guys!

matt.fellows
2019-10-22 20:29
Amazing, you're welcome!

matt.fellows
2019-10-22 20:30
Those concepts are complex/confusing and it takes some time to frasp

matt.fellows
2019-10-22 20:30
We could definitely do a better job of explaining too

travis.anderson
2019-10-22 20:34
I think some additional documentation would be helpful, or even some more comments in example code!

travis.anderson
2019-10-22 20:35
But yes, some pretty mindbending concepts at first, but really cool tools. I am excited to present my POC to the team!

matt.fellows
2019-10-22 21:17
> I think some additional documentation would be helpful, or even some more comments in example code! PR would be certainly welcome. Especially with your fresh eyes for others who are just coming along!

rrosa171
2019-11-11 16:08
has joined #pactteshelp

ayip
2019-11-18 01:09
has joined #pactteshelp

wesleythomaswilliams
2019-12-20 16:48
has joined #pactteshelp

wesleythomaswilliams
2019-12-20 17:04
Hi all, not sure where to ask this, but I've been going through the pact-workshop-jvm and got to Step 13 where I've hit a roadblock. I've created a pactflow account and added those details to gradle.properties and build.gradle in the workshop project, but I can't seem to get a connection using: ```hasPactsFromPactBroker("https://wesley.pact.dius.com.au", authentication: ['Basic', pactBrokerUser, pactBrokerPassword]``` ```FAILURE: Build failed with an exception. * Where: Build file '/Users/williamw/IdeaProjects/pact-workshop-jvm/providers/springboot-provider/build.gradle' line: 50 * What went wrong: A problem occurred evaluating project ':providers:springboot-provider'. > Request to path '/' failed with response 'HTTP/1.1 401 Unauthorized'``` I notice someone had the same issue, but it didn't seem to get a resolution: https://github.com/DiUS/pact-workshop-jvm/issues/2

matt.fellows
2019-12-21 05:40
We probably need to update the project to indicate that Pactflow credentials are different

matt.fellows
2019-12-21 05:41
Pactflow uses API tokens and not basic auth

matt.fellows
2019-12-21 05:41
So yotu're email address and password are not valid credentials


wesleythomaswilliams
2019-12-21 10:19
Thanks Matt, I'll give that a go.

taisedias
2019-12-22 21:52
has joined #pactteshelp

wesleythomaswilliams
2019-12-23 12:04
Hi @matt.fellows, after changing the auth in the build.gradle files, I'm seeing this issue: ```> Configure project :providers:springboot-provider Evaluating project ':providers:springboot-provider' using build file '/Users/williamw/IdeaProjects/pact-workshop-jvm/providers/springboot-provider/build.gradle'. Applying dependency management to configuration 'annotationProcessor' in project 'springboot-provider' ... Applying dependency management to configuration 'testRuntimeOnly' in project 'springboot-provider' Hal client Only supports basic authentication, got 'bearer', ignoring.``` I see there was an issue raised against pact-ruby that seems similar: https://github.com/pact-foundation/pact-ruby-standalone/issues/33

wesleythomaswilliams
2019-12-23 15:30
Getting a little further, I've updated the version of pact to `4.0.4` from `3.5.14` which has removed the Hal client error, but still getting a 401: ```> Task :consumer:pactPublish FAILED Task ':consumer:pactPublish' is not up-to-date because: Task has not declared any outputs. Publishing Our Consumer-Our Provider.json ... FAILED! 401 Unauthorized - ``` I'm going to keep digging around to see if I can work out how to fix it, but any advice would be most welcome.

matt.fellows
2019-12-23 22:09
@wesleythomaswilliams thanks for digging. The spring / JVM one shouldn?t use the Ruby stuff.

matt.fellows
2019-12-23 22:10
Are you able to see what the `Authorization` token looks like? It should simply be an API token from the Settings page of Pactflow (not the email/password combination or anything just to be clear)

matt.fellows
2019-12-23 22:10
(i.e. is there a debug log level you can get to to see what?s being sent over the wire?)

wesleythomaswilliams
2019-12-24 11:46
Debugging through the gradle task for pactPublish and it looks like it has the correct token. Which I've set in gradle.properties as ```pactBrokerToken=fTXDVdhGOlKunW_wIPDn3w``` I've tried tweaking the gradle.build files, updating the pact version references to 4.0.4 and also removing references to the provider subprojects and related tasks so that I can just test the comsumer publish works.

wesleythomaswilliams
2019-12-24 11:48
Currently, my settings.gradle looks like: ```include 'consumer' rootProject.name = 'pact-workshop-jvm'``` Top level build.gradle looks like: ``` subprojects { apply plugin: 'java' repositories { mavenLocal() mavenCentral() jcenter() } dependencies { compile 'org.slf4j:slf4j-api:1.7.22' compile 'org.apache.commons:commons-lang3:3.7' testCompile 'junit:junit:4.12' testCompile 'org.mockito:mockito-core:2.18.0' testCompile 'org.hamcrest:hamcrest-integration:1.3' } }```

wesleythomaswilliams
2019-12-24 11:48
Consumer build.gradle looks like: ```plugins { id "http://au.com.dius.pact" version "4.0.4" } apply plugin: 'application' apply plugin: 'groovy' mainClassName = 'http://au.com.dius.pactworkshop.consumer.Consumer' version = 2 dependencies { compile 'com.mashape.unirest:unirest-java:1.4.9' compile 'ch.qos.logback:logback-core:1.1.7', 'ch.qos.logback:logback-classic:1.1.7' testCompile "com.github.tomakehurst:wiremock:2.16.0" testCompile 'au.com.dius:pact-jvm-consumer-groovy:4.0.4' testCompile('org.spockframework:spock-core:1.1-groovy-2.4') { exclude group: 'org.codehaus.groovy' } testCompile 'cglib:cglib-nodep:3.2.4', 'org.objenesis:objenesis:2.4' } test { systemProperties['pact.rootDir'] = "$buildDir/pacts" } pact { publish { pactBrokerUrl = 'https://wesley.pact.dius.com.au' pactBrokerToken = project.pactBrokerToken } }```

wesleythomaswilliams
2019-12-24 11:50
Now, when I run pactPublish, I get this error: ```Execution failed for task ':consumer:pactPublish'. > No signature of method: http://au.com.dius.pact.core.pactbroker.PactBrokerClient.uploadPactFile() is applicable for argument types: (http://java.io.File, java.lang.Integer, java.util.ArrayList) values: [/Users/williamw/IdeaProjects/pact-workshop-jvm/consumer/build/pacts/Our Consumer-Our Provider.json, ...] Possible solutions: uploadPactFile(http://java.io.File, java.lang.String), uploadPactFile(http://java.io.File, java.lang.String, java.util.List)```

travis.anderson
2020-01-07 19:03
Hey everyone, I am working on a Pact testing solution in JS and trying to set up a request filter for an app written with koa.js on the backend. It seems instead of changing the Auth header on the request, I need to change the Auth value in the `ctx` object that gets passed around by koa. Does anyone have experience doing this/any idea how to reach an object like that?

travis.anderson
2020-01-07 21:29
Nevermind, ignore the above. Typical requestFilter works just fine, the token was the problem.

matt.fellows
2020-01-07 21:29
_phew_

rikeshgohil
2020-01-10 10:34
has joined #pactteshelp

simone.cusimano92
2020-01-15 08:13
has joined #pactteshelp

travis.anderson
2020-01-16 18:30
Hello all, I am trying to publish a pact to a broker running on `localhost` for a POC. I started up everything with the `docker-compose.yaml` file and can navigate to the broker at `localhost:8443` but I can't publish a pact to it. According to the example, I set up a `publish.js` file with the following options: ```{ pactFilesOrDirs: [ process.cwd(), "./test/pact/pacts/the-pact.json" ], pactBroker: "https://localhost:9292", pactBrokerUsername: "tester", pactBrokerPassword: "pactTest", tags: ["test"], consumerVersion: "0.0.1" };``` When I `npm run` to publish the pact, no matter which port I am hitting (I tried postgres, pact, and nginx) I get the same `Pact contract publishing failed: Error: Error making request - NoMethodError` . When running the broker locally (and by extension in a CI/CD pipeline) what is the pactBrokerUrl for publishing?

matt.fellows
2020-01-16 23:05
Could you point us / show us the docker compose file you have? Something weird going on there


travis.anderson
2020-01-17 17:02
@matt.fellows That's the one. Only things I changed are username/password for both postgres and the pact broker. I also have the broker running at port 9292

travis.anderson
2020-01-17 18:13
Actually, I got the `docker-compose` file from somewhere else, not sure where at this point now, but it was a little bit different. Using the linked file though `nginx` is exiting on startup...

travis.anderson
2020-01-17 21:27
Disregard that previous message, but I am still getting errors when trying to publish a Pact to the broker. I have it exposed at port 9292 still and still getting that same error

bethskurrie
2020-01-17 21:34
Can you connect with a curl request @travis.anderson?

travis.anderson
2020-01-17 21:44
I'm not sure what a cURL request would look like for that...

bethskurrie
2020-01-17 21:45
`curl https://localhost:9292 -u username -p password -H "Accept: application/hal+json"`

bethskurrie
2020-01-17 21:45
If that works, the problem is with the code, not your broker

bethskurrie
2020-01-17 21:45
OH, https

bethskurrie
2020-01-17 21:46
Are you sure it's running https over port 9292?

bethskurrie
2020-01-17 21:46
Usually that's just http.

bethskurrie
2020-01-17 21:46
Https tends to go on a different port.

travis.anderson
2020-01-17 21:46
Hmm good question. One second

bethskurrie
2020-01-17 21:47
If you're just proving a concept, avoid using https - it just complicates things!

bethskurrie
2020-01-17 21:47
you only need it for a prod deployment.

travis.anderson
2020-01-17 21:57
So, no I'm not sure it is running https over port 9292 lol

travis.anderson
2020-01-17 21:57
and this is what I get from the cURL: `curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:9292`

bethskurrie
2020-01-17 21:58
try http

travis.anderson
2020-01-17 21:58
`curl: (52) Empty reply from server`

bethskurrie
2020-01-17 21:59
Which docker-compose are you using?

matt.fellows
2020-01-17 21:59
Did you say it is working through a browser?

travis.anderson
2020-01-17 22:01
Yes, I can view the Pact broker in the browser at both `http://localhost:80` and `https://localhost:8443`

travis.anderson
2020-01-17 22:01
Here is my docker-compose ```version: "3" services: postgres: image: postgres healthcheck: test: psql postgres --command "select 1" -U postgres ports: - "5432:5432" environment: POSTGRES_USER: tester POSTGRES_PASSWORD: pactTest POSTGRES_DB: postgres pact_broker: image: dius/pact-broker links: - postgres # If you remove nginx, enable the following ports: - "9292:9292" environment: PACT_BROKER_DATABASE_USERNAME: tester PACT_BROKER_DATABASE_PASSWORD: pactTest PACT_BROKER_DATABASE_HOST: postgres PACT_BROKER_DATABASE_NAME: postgres # Nginx is not necessary, but demonstrates how # one might use a reverse proxy in front of the broker, # and includes the use of a self-signed TLS certificate nginx: image: nginx:alpine links: - pact_broker:broker volumes: - ./ssl/nginx.conf:/etc/nginx/conf.d/default.conf:ro - ./ssl:/etc/nginx/ssl ports: - "8443:443" - "80:80"```

bethskurrie
2020-01-17 22:01
Oh, great, use http://localhost:80 in your pact configuraiton file then

bethskurrie
2020-01-17 22:02
` ```pactBroker: "http://localhost:80",```

matt.fellows
2020-01-17 22:03
8443 must have a self signed cert. That is probably the issue as it won't be valid unless you setup a certificate chain for everything

matt.fellows
2020-01-17 22:03
Use port 80 as Beth said

matt.fellows
2020-01-17 22:04
Also that looks like the old image, right Beth?

bethskurrie
2020-01-17 22:04
Yes.

bethskurrie
2020-01-17 22:05
It should work fine, but use pact-foundation/pact-broker if you're going to run it in earnest.

matt.fellows
2020-01-17 22:05
Use the docker compose from the official repo

travis.anderson
2020-01-17 22:05
Oh, I think I was using that one at first but assumed the one @matt.fellows linked earlier was the official one

bethskurrie
2020-01-17 22:05
That looks like the docker compose from the official dius repo


travis.anderson
2020-01-17 22:31
Are you sure? That looks like it is from the DiUS repo, not pactfoundation


bethskurrie
2020-01-17 22:41
yes. though I'm pretty sure the certificate is broken on that one from memory.

bethskurrie
2020-01-17 22:42
I've just done a docker-compose up with that file and it's running on port 80 fine

bethskurrie
2020-01-17 22:43
I agree with you Travis!

bethskurrie
2020-01-17 22:44
it's also got no auth on it, so you shouldn't have any problems publishing!

travis.anderson
2020-01-17 22:45
I'll give it a shot!

travis.anderson
2020-01-17 23:07
So I should be able to run that docker-compose file without changing anything?

bethskurrie
2020-01-17 23:07
yes

bethskurrie
2020-01-17 23:07
I can

travis.anderson
2020-01-17 23:09
Ah, old postgres container was interfering

travis.anderson
2020-01-17 23:10
Still getting error trying to publish though

travis.anderson
2020-01-17 23:11
This is the first line of a long error: ```Could not publish pact: Error making request - NoMethodError undefined method `[]' for nil:NilClass /Users/travisanderson/Documents/flowhub/gateways/state-defaults-gateway/node_modules/@pact-foundation/pact-node/standalone/darwin-1.72.0/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.20.0/lib/pact_broker/client/pact_hash.rb:11:in `consumer_name', attempt 1 of 3```

travis.anderson
2020-01-17 23:11
Can post the whole thing if necessary

bethskurrie
2020-01-17 23:17
It doesn't look like your pact has a consumer name

bethskurrie
2020-01-17 23:17
``` def consumer_name self[:consumer][:name] end```

bethskurrie
2020-01-17 23:17
That's where it's blowing up

bethskurrie
2020-01-17 23:18
`self[:consumer]` is returning nil

travis.anderson
2020-01-17 23:23
oh

travis.anderson
2020-01-17 23:24
As in the `pact.js` file?

bethskurrie
2020-01-17 23:24
no, the pactifle

bethskurrie
2020-01-17 23:24
the file with the contract in it

bethskurrie
2020-01-17 23:25
It should look something like this:

bethskurrie
2020-01-17 23:25
```{ "consumer": { "name": "Example App" }, "provider": { "name": "Example API" }, "interactions": [ { ...```

bethskurrie
2020-01-17 23:25
it gets generated from your Pact consumer tests.

bethskurrie
2020-01-17 23:25
Have you read much of http://docs.pact.io yet?

travis.anderson
2020-01-17 23:26
Yeah, I read a bunch of them. haha

travis.anderson
2020-01-17 23:26
the first line in that file definitely has the name... Maybe it isn't finding the file?

bethskurrie
2020-01-17 23:27
```"./test/pact/pacts/the-pact.json"```

bethskurrie
2020-01-17 23:27
that's not the name of a pact file that's been generated by Pact.

bethskurrie
2020-01-17 23:28
that looks hardcoded to me.

travis.anderson
2020-01-17 23:29
Yeah, I just changed it as a precaution :stuck_out_tongue:

travis.anderson
2020-01-17 23:33
I got it working now. it wasn't resolving the filepath :facepalm:

bethskurrie
2020-01-17 23:34
:thumbsup::skin-tone-3:

travis.anderson
2020-01-17 23:35
Thanks for the help :slightly_smiling_face:

matt.fellows
2020-01-17 23:37
We should move it. I'll do it later today when near a computer

bethskurrie
2020-01-18 02:43
@matt.fellows what do you mean, move it? It already exists in the pact-foundation/pact-broker-docker repo because that was a fork of the DiUS one.

matt.fellows
2020-01-18 03:15
Ah right you are.

matt.fellows
2020-01-18 03:16
Then my job here is done :laughing:

travis.anderson
2020-01-18 03:39

travis.anderson
2020-01-18 03:54
But seriously, thanks for the help guys! Looking forward to showing this off to the engineering department and putting it into practice! :slightly_smiling_face:

bethskurrie
2020-01-18 04:15
Let us know how you go

jgfarias42
2020-01-22 09:51
has joined #pactteshelp

tomas.sakinis611
2020-02-25 11:04
has joined #pactteshelp

baquinteros
2020-02-26 02:49
has joined #pactteshelp

baquinteros
2020-02-26 02:52
Hello :wave: I've tried to implement a matcher like this body:{ "attributes": [             {               "name": "string",               "value": "string"             },             {               "name": "string",               "value": "string"             },             {               "name": "string",               "value": "string"             }           ],         },         "matchingRules": {           "$.body.attributes": {             "min": 3           },           "$.body.attributes[*].":{             "match":"type"           },           "$.body.attributes[*].name":{             "match":"type"           },           "$.body.attributes[*].value":{             "match":"type"           }        } The attributes items shift within the array per call Receiving the error when running on the provider for the body "Expected a Hash (like {\ Any idea's?

baquinteros
2020-02-26 03:53
nvm, error was related to headers.

mattgilbert90
2020-02-27 14:16
I have tried outputting the pact file to the base repository so that it can be utilized by the provider but it is putting it in c:/users/user/ no matter how I define my pact config. I have my code as below Var pactconfig = new PactConfig { Specification version = "2.0.0", PactDir = @"..\..\..\pacts, LogDir = @".\pact_logs" }; What am I doing wrong?

tomas.sakinis611
2020-02-28 06:46
This happens if you run tests from VisualStudio

tomas.sakinis611
2020-02-28 06:50
Try this: ```string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); PackBuilder = new PactBuilder(new PactConfig { SpecificationVersion = "2.0.0", LogDir = $"{assemblyFolder}\\..\\..\\..\\logs", PactDir = $"{assemblyFolder}\\..\\..\\..\\pacts" })```

mattgilbert90
2020-02-29 15:17
I'll give that a shot, thanks

mattgilbert90
2020-02-29 15:17
What do you normally run tests through?

tomas.sakinis611
2020-02-29 17:15
Visual studio or dotnet test

simone.cusimano92
2020-03-02 13:30
Hi everyone, I have implemented 2 Consumer Contract Test in a Java Application like this: ```@Pact(provider = "providerName", consumer = "consumerName") public RequestResponsePact generateContract(PactDslWithProvider builder) { RequestResponsePact responsePact = builder .given("Get a apple that exists") .uponReceiving("Retrieve the apple 123, which exists ") .matchPath(format("/apples/%s", "123")) .method(HttpMethod.GET.name()) .headers(this.getRequestHeaders()) .body("") .willRespondWith() .headers(this.getResponseHeaders()) .status(200) .body(this.getDummyResponseBody()) .given("Delete a apple that exists") .uponReceiving("Delete the apple 1234, which exists ") .matchPath(format("/compositions/%s", "1234")) .method(HttpMethod.DELETE.name()) .headers(this.deleteRequestHeaders()) .willRespondWith() .headers(this.getResponseHeaders()) .status(204) .toPact(); return responsePact; } @Test @PactVerification("providerName") public void test_1() { String responseFromCds = this.service.getAppleById("123"); assertThat(responseFromCds).isNotNull(); } @Test @PactVerification("providerName") public void test_2() { ResponseEntity<String> response = this.service.deleteEntities("1234"); assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT); }``` Both tests are failing with the following message: `http://au.com.dius.pact.consumer.PactMismatchesException: The following requests were not received:` Can you tell me why? I expect to have two methods - one for each test. Thanks in advance!

simone.cusimano92
2020-03-02 15:14
If I merge two methods into one, it works: ```@Test @PactVerification("providerName") public void test_1() { String responseFromCds = this.service.getAppleById("123"); assertThat(responseFromCds).isNotNull(); ResponseEntity<String> response = this.service.deleteEntities("1234"); assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT); }```

matt.fellows
2020-03-02 19:52
You've answered it yourself it seems

matt.fellows
2020-03-02 19:54
They should be two separate tests (one for delete and one for get) but you're putting them in a single expectation. So because your individual tests only hit one of the endpoints each time they don't pass.

simone.cusimano92
2020-03-03 08:04
ok @matt.fellows, I see.. What can I do if I want two separate expectations?

matt.fellows
2020-03-03 11:07
Two separate tests (I assume, I should say I don't know the Java DSL all that well)

matt.fellows
2020-03-03 11:10
Each test should have their own builder attached I think. There should be a Junit 4/5 interface you can use

wesleythomaswilliams
2020-03-03 11:47
@simone.cusimano92 I wouldn't recommend that, as you want each test to fail independently of each other. what you need is as @matt.fellows described. More like this: ``` @Pact(provider = "provider", consumer = "consumer") public RequestResponsePact validThingProvided(PactDslWithProvider builder) { return builder .given("") .uponReceiving("") .path("") .query("") .method("GET") .willRespondWith() .status(200) .body(response) .toPact(); } @Pact(provider = "provider", consumer = "consumer") public RequestResponsePact thingValueInvalid(PactDslWithProvider builder) { return builder .given("") .uponReceiving("") .path("") .query("") .method("GET") .willRespondWith() .status(404) .toPact(); }```

wesleythomaswilliams
2020-03-03 11:48
Then tag your tests with `@PactTestFor(pactMethod = "validThingProvided")` `@PactTestFor(pactMethod = "thingValueInvalid")`

simone.cusimano92
2020-03-04 07:51
Thank you very much! Definetly what I was looking for!

simone.cusimano92
2020-03-04 15:33
@matt.fellows, @wesleythomaswilliams: I'm using the following dependencies: ``` testCompile 'au.com.dius:pact-jvm-provider-junit:4.0.6' testImplementation("au.com.dius:pact-jvm-provider-spring:4.0.6") testImplementation('au.com.dius:pact-jvm-consumer-junit:4.0.6')``` but it is not present @PactForTest. Could you tell me what versions you are using please?

wesleythomaswilliams
2020-03-04 15:35
@simone.cusimano92 Are you junit 4 or 5?

simone.cusimano92
2020-03-04 15:36
JUnit 4 ```testCompile group: 'junit', name: 'junit', version: '4.12'```

wesleythomaswilliams
2020-03-04 15:36
@simone.cusimano92 I'm going to guess that's the issue as I'm junit 5. There must be a similar way of doing it with junit 4. @uglyog can you help?

simone.cusimano92
2020-03-04 15:52
@wesleythomaswilliams, meanwhile could you tell me your settings please? Thank you for the support

wesleythomaswilliams
2020-03-04 15:53
No problem, I'm using 4.0.4 across the board.

matt.fellows
2020-03-04 21:45
Thanks Simone. Unfortunately I can?t help much here I?m afraid - I haven?t used the JVM stuff in anger. I?ll ping the maintainer to see if they can help.

simone.cusimano92
2020-03-05 08:21
Thank you @matt.fellows!

phil.brock
2020-03-09 12:40
has joined #pactteshelp

simone.cusimano92
2020-03-10 08:05
Anyone can help me please? :sos:

bethskurrie
2020-03-10 08:06
I'm afraid I'm not familiar with pact-jvm.

bethskurrie
2020-03-10 08:06
Can I ask why you're not asking in the #pact-jvm channel @simone.cusimano92?

bethskurrie
2020-03-10 08:06
We're a bit confused about this channel and why it was made.

bethskurrie
2020-03-10 08:07
And why people aren't asking in the channel relevant for their language.

simone.cusimano92
2020-03-10 08:07
Ah ok, no problem. I'm going to post there. Thank you @bethskurrie!

bethskurrie
2020-03-10 08:08
np.

bethskurrie
2020-03-10 08:08
I am genuinely interested in the answer though!

rbenbolton
2020-04-13 22:11
has joined #pactteshelp

rafael.espillaque
2020-06-15 15:02
has joined #pactteshelp

rafael.espillaque
2020-06-15 15:49
Sorry, asking in #general after reading the above message from Beth!

tjones
2020-06-16 03:21
I think we should close / archive this channel. For people who are here - why did you join this one? Did you see it in the list of channels, or were you linked from somewhere?

matt.fellows
2020-06-16 03:55
I think worth archiving. You can only go back a few messages and you hit the ?message limit wall? anyway

bethskurrie
2020-06-16 03:56
Agreed

rafael.espillaque
2020-06-16 08:35
list of channels

bernardoguerr
2020-06-18 18:07
has joined #pactteshelp

bernardoguerr
2020-06-18 18:07
@bernardoguerr has left the channel

suma.papanna
2020-06-25 10:57
has joined #pactteshelp

sabil.beladri
2020-07-08 08:06
has joined #pactteshelp

sabil.beladri
2020-07-08 08:07
@sabil.beladri has left the channel

tjones
2020-07-13 05:41
archived the channel