Rafael Moral
05/03/2022, 9:43 AMjithin jacob
05/03/2022, 10:04 AMYou cannot provide both a username/password and a bearer token. If your Pact Broker uses a bearer token, please remove the username and password configuration.
Matt (pactflow.io / pact-js / pact-go)
Dany Marques
05/05/2022, 5:55 PMit.each(['provider 1', 'provider 2'])('testing %s', provider => pactWith({
consumer: 'foobar',
provider: provider,
port: 45678
}, () ..... ));
But it fails because I think the Pact mock server is not shut down between each test and then I get: Port '45678' is already in use by another process.
Any idea ?Dmitry Munda
05/06/2022, 7:46 PMmakesCopy codeterm({ generate: "21+3", matcher: "21\+3" })
Example ‘21+3’ does not match provided regular expression ‘21+3’
Dmitry Munda
05/06/2022, 10:13 PM{z:[a,b,[d,e]]}
->`{z:[a,b,c,[d,e,f]]}`
where a
and d
is one term and b
c
e
f
other ( same ) termAkash Srivastava
05/08/2022, 3:25 PMCarbon for Slack
05/09/2022, 6:18 PMÉdouard Lopez
05/10/2022, 9:14 AMnpm install
vs yarn install
with @pact-foundation/pact
. With yarn I need to run npm install --save-dev @pact-foundation/pact
to fix the error:
[ERROR] 11:10:18 TypeError: destination.on is not a function
[11:10:18] › ✖ error TypeError: destination.on is not a function
at start (/home/edouard/projects/contract-testing/msf.toolbox-mf-replenishment/node_modules/thread-stream/lib/worker.js:59:15)
Is there some NPM mechanism that I'm not aware of?
Is it mandatory to use NPM?Rafi Gemhar
05/10/2022, 3:13 PMjest-pact
is there a way to addInteraction
that will respond with body as blob data (csv, xlsx or pdf).Marcello Rigan
05/11/2022, 10:11 AMMarcello Rigan
05/12/2022, 9:01 AMurlParams: eachLike({
urlParameterName:string(),
navigatorUrlParameterType: string(),
}),
My Provider test still fails because there are multiple entries. I already used the eachLike feature and didn't have an issue with it. Am i missing something?Gueorgui
05/13/2022, 12:24 PMError: Error while installing binary: Postinstalled Failed Unexpectedly: Error: Error while installing binary: Extraction failed for /root/project/node_modules/@pact-foundation/pact-node/standalone/pact-1.88.81-linux-x86_64.tar.gz: Error: Error while installing binary: Checksum rejected for file 'pact-1.88.81-linux-x86_64.tar.gz' with checksum pact-1.88.81-linux-x86_64.tar.gz.checksum
at throwError (/root/project/node_modules/@pact-foundation/pact-node/standalone/install.js:42:11)
at /root/project/node_modules/@pact-foundation/pact-node/standalone/install.js:335:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
info Visit <https://yarnpkg.com/en/docs/cli/install> for documentation about this command.
Exited with code exit status 1
Any clues why the checksum might be getting rejected?Alan Alie
05/13/2022, 3:30 PM// PACT test for getBasketById
describe('Given we are requesting specific basket', () => {
test('When a basket exists', async () => {
// set up Pact interaction
await provider.addInteraction({
state: 'When the basket exists',
uponReceiving: 'get the specified basket',
withRequest: interactionRequest.GET_BASKET,
willRespondWith: interactionResponse.BASKET_NORMAL_RESPONSE,
});
// make request to PACT mock server
await getData(provider.mockService.baseUrl + '/basket/' + OK_BASKET_ID);
});
Now that I’m attempting error path tests (the response status is 404) I get the following error
thrown: Object {
"errorCode": "BS-002",
"errorMessage": "No basket has been found",
}
111 | // Failed PACT test for getBasketById
112 | describe('Given we are requesting specific basket', () => {
> 113 | test('When the basket does not exists', async () => {
| ^
114 | // set up Pact interaction
115 | await provider.addInteraction({
116 | state: 'basket does not exists',
My code for the ‘error path’ test is as follows:
// Failed PACT test for getBasketById
describe('Given we are requesting specific basket', () => {
test('When the basket does not exists', async () => {
// set up Pact interaction
await provider.addInteraction({
state: 'basket does not exists',
uponReceiving: 'get specified basket',
withRequest: {
method: HTTPMethod.GET,
path: '/basket/' + BAD_BASKET_ID,
},
willRespondWith: {
status: 404,
headers: { 'Content-Type': 'application/json' },
body: {
errorCode: 'BS-002',
errorMessage: 'No basket has been found',
},
},
});
// make request to Pact mock server
await getData(provider.mockService.baseUrl + '/basket/' + BAD_BASKET_ID);
});
});
How do I handle the thrown object?
PS: If I change the response status in my code to 200 then the problem disappears - but that’s obviously not what I’m after.Matt (pactflow.io / pact-js / pact-go)
Josh
05/16/2022, 2:38 PMMatt (pactflow.io / pact-js / pact-go)
provider
and you are using a DogApiClient
class to send requests to your Dog Service
, you can dynamically configure your API client as follows:
provider.setup().then(opts => {
dogService = new DogApiClient({ `http://${opts.host}`, port: opts.port })
})
Lukasz Wlosek
05/19/2022, 9:04 AM.withRequest({
method: 'GET',
path: term({
generate: '/user/9ae9b264-f181-46ea-a468-4919c48fbe94',
matcher:
'/user/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'
}), // we want to be strict with what we send out <https://docs.pact.io/getting_started/matching#request-matching>
headers: {
Accept: 'application/json, text/plain, */*',
Authorization: string('Bearer testToken')
}
})
when I save a different uuid setup in the provider side the verifaction fails, any tips on how to achieve this, read about provider state injected values, but it does not seem to be yet implemented in pact-js?Timothy Jones
05/20/2022, 8:25 AMKendrick B
05/23/2022, 2:47 AMActual interactions do not match expected interactions for mock MockService.
Evan
05/23/2022, 4:50 PMCannot find binary for platform 'linux' with architecture 'arm64'
... during install?
Damian
05/25/2022, 3:59 PMJacek
05/27/2022, 9:40 AMSubrahmanyam Rentala
05/30/2022, 3:00 PMAlex Maiburg
05/31/2022, 7:48 AMJohn Williams
05/31/2022, 9:55 AMJohn Williams
05/31/2022, 9:58 AMJohn Williams
05/31/2022, 10:09 AMJohn Williams
06/06/2022, 12:21 PMconst opts = {
...
stateHandlers: {
[null]: () => {
// This is the "default" state handler, when no state is given
}
"Has no animals": () => {
animalRepository.clear()
return Promise.resolve(`Animals removed from the db`)
},
"Has some animals": () => {
importData()
return Promise.resolve(`Animals added to the db`)
},
"Has an animal with ID 1": () => {
importData()
return Promise.resolve(`Animals added to the db`)
}
}
}
return new Verifier(opts).verifyProvider().then(...)
so like in the above example. If the consumer is expecting in the request it sends an id, and name and expects the id to be 1. Can i just hardcode the data as something like this:
{
"id": 1,
"name": "dog"
}
Lukasz Wlosek
06/06/2022, 2:41 PMpact-node@10.17.2: Starting pact binary '/home/repos/gf-accounts-service/node_modules/@pact-foundation/pact-node/standalone/linux-x64-1.88.83/pact/bin/pact-provider-verifier', with arguments [--provider-states-setup-url <http://localhost:46091/_pactSetup> --provider-base-url <http://localhost:46091> --provider-app-version dc04a08
The ports for --provider-states-setup-url and --provider-base-url seem to be failing my TeamCity build sometimes, as some of these ports are reserved, I thought that specifying the providerBaseUrl in the provider settings sets these ports, in my case it was http://localhost:3000/ but it seems like the pact-provider-verifier spins this up with different ports as some proxy? Is there a way to specify which port to use in that pact-provider-verifier script?