Comments (18)
Yes I can.
from pact-js.
hmm am I right in guessing that you are connecting a pact front end to the pact go daemon?
from pact-js.
not sure what you mean by pact front end, I am using the pact-js tool via mocha, and I believe pact-js is starting the daemon for me. I am not starting up a daemon myself.
from pact-js.
The reason I asked is I noticed that it's trying to connect to port 6666
which is the default Daemon port for pact-go
, so if the Go daemon is running and your pact JS tests were pointed at it, this would definitely not work. But you did say that increasing the timeout fixed it, so it's probably just coincidental.
I agree, a better error would be nice here (we do have a note on this in the troubleshooting section, but we shouldn't rely on that).
I'll leave this open as a request to fix.
In terms of slowness, it could be recently changes in the underlying Ruby process, which might be the "final straw that broke the camel's back" sort of thing.
from pact-js.
Ok I see. I am using pact-go for other things but it is unrelated to this problem. This is the setup in mocha as an FYI (note I've chosen port 6666 by chance):
const provider = pact({
consumer: 'TestApp',
provider: 'Contracts',
port: 6666,
log: path.resolve(process.cwd(), 'logs', 'pact.log'),
dir: path.resolve(process.cwd(), 'pacts'),
logLevel: 'INFO',
spec: 2
});
from pact-js.
Thanks. I don't see anything wrong with that setup. I've marked this for enhancement, I take it you're able to progress now?
from pact-js.
I am experiencing a similar error:
Pact
[2018-01-02T04:02:22.269Z] INFO: [email protected]/61436 on xxj.local: Created './platforms/darwin/bin/pact-mock-service service --host '127.0.0.1' --port '2202' --log '/Users/twer/Documents/AutoTest/Contract test/pact-exercise/logs/pact.log' --pact_dir '/Users/twer/Documents/AutoTest/Contract test/pact-exercise/pacts' --pact_specification_version '2' --pact-file-write-mode 'overwrite'' process with PID: 61437
[2018-01-02T04:02:22.302Z] WARN: [email protected]/61436 on xxj.local: Pact exited with code 1.
[2018-01-02T04:02:22.302Z] INFO: [email protected]/61436 on xxj.local: Removing Pact with PID: 61437
1) "before all" hook
(node:61436) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: connect ECONNREFUSED 127.0.0.1:2202
(node:61436) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Pact verification failed!
Error: connect ECONNREFUSED 127.0.0.1:2202
(node:61436) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Pact verification failed - expected interactions did not match actual.
(node:61436) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): Error: Pact startup failed; tried calling service 10 times with no result.
2) "after all" hook
0 passing (30s)
2 failing
1) Pact
"before all" hook:
Error: Timeout of 15000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
2) Pact
"after all" hook:
Error: Timeout of 15000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
from pact-js.
@mefellows The following is my file:
const provider = pact({
consumer: 'TodoApp',
provider: 'TodoService',
port: MOCK_SERVER_PORT,
log: path.resolve(process.cwd(), 'logs', 'pact.log'),
dir: path.resolve(process.cwd(), 'pacts'),
logLevel: 'INFO',
spec: 2
});
const EXPECTED_BODY = [{
id: 1,
name: 'Project 1',
due: '2016-02-11T09:46:56.023Z',
tasks: [
{id: 1, name: 'Do the laundry', 'done': true},
{id: 2, name: 'Do the dishes', 'done': false},
{id: 3, name: 'Do the backyard', 'done': false},
{id: 4, name: 'Do nothing', 'done': false}
]
}];
before((done) => {
provider.setup().then(done);
});
after((done) => {
provider.finalize();
provider.verify().then(done);
});
from pact-js.
from pact-js.
I'm using node v8.5.0
from pact-js.
I don't think that's the problem:
[2018-01-02T04:02:22.269Z] INFO: [email protected]/61436 on xxj.local: Created './platforms/darwin/bin/pact-mock-service service --host '127.0.0.1' --port '2202' --log '/Users/twer/Documents/AutoTest/Contract test/pact-exercise/logs/pact.log' --pact_dir '/Users/twer/Documents/AutoTest/Contract test/pact-exercise/pacts' --pact_specification_version '2' --pact-file-write-mode 'overwrite'' process with PID: 61437
[2018-01-02T04:02:22.302Z] WARN: [email protected]/61436 on xxj.local: Pact exited with code 1.
[2018-01-02T04:02:22.302Z] INFO: [email protected]/61436 on xxj.local: Removing Pact with PID: 61437
Notice how the process immediately exits with status code 1.
I'm wondering if it's actually the spaces or something?
@lemon123456 can you please run the following on your machine and share the output?
./node_modules/@pact-foundation/pact-standalone/platforms/darwin/bin/pact-mock-service service --host '127.0.0.1' --port '2202' --log '/Users/twer/Documents/AutoTest/Contract test/pact-exercise/logs/pact.log' --pact_dir '/Users/twer/Documents/AutoTest/Contract test/pact-exercise/pacts' --pact_specification_version '2' --pact-file-write-mode 'overwrite'
Also, can you please provide the extra details as per the issue template?
from pact-js.
Sure. This is the output:
➜ pact-exercise ./node_modules/@pact-foundation/pact-standalone/platforms/darwin/bin/pact-mock-service service --host '127.0.0.1' --port '2202' --log '/Users/twer/Documents/AutoTest/Contract test/pact-exercise/logs/pact.log' --pact_dir '/Users/twer/Documents/AutoTest/Contract test/pact-exercise/pacts' --pact_specification_version '2' --pact-file-write-mode 'overwrite'
/Users/twer/Documents/AutoTest/Contract test/pact-exercise/node_modules/@pact-foundation/pact-standalone/platforms/darwin/lib/ruby/bin/ruby: line 14: test/pact-exercise/node_modules/@pact-foundation/pact-standalone/platforms/darwin/lib/ruby/lib/ruby/gems/2.2.0: No such file or directory
from pact-js.
@azzamallow hi,i got the same problem with pact. would you please provide the solution?thank you.
from pact-js.
@crystalyxiaoxianer the resolution is increasing your test timeout duration.
In the case of running a mocha suite, it looks something like this mocha consumer.js --timeout 10000
.
You should consult the docs for whatever framework you're using.
from pact-js.
@mefellows my problem had solved that i changed port. Before that, i had changed port several times but not work. thank you anyway. but i have a new problem that all tests passed but not write pact files.
from pact-js.
@crystalyxiaoxianer if you have a separate issue, could you please raise it with a fully working example so we can help?
from pact-js.
@mefellows ok,i will.
from pact-js.
@mefellows new issue:#184
from pact-js.
Related Issues (20)
- RFC: Remove CLI & Standalone API (Pact Standalone Tools - Ruby), and migrate into sister package pact-js-cli enhancement
- RFC: Support Alpine
- RFC: Pact JS V9.x - Update to latest V2 standalone / Include ARM64 Platforms HOT 1
- Because Maths: invalid pact specification version supplied: 5 HOT 8
- V4 Asynchronous Messages
- Bug: Corporate Proxy not supported during verification
- TypeError: ffi.pactffiMessageGivenWithParams is not a function HOT 2
- Support combining matching rules HOT 3
- `eachLike` behaves like `atLeastOneLike` when min is not explicitly set - contrary to documentation HOT 5
- payload changed by pact between consumer test and provider test HOT 6
- Message provider verification error: "Caught panic with error: failed printing to stdout" HOT 8
- CVE check denying [email protected] which is dependent on by pact-foundation/pact HOT 3
- V3 Matchers package missing matchers from V2
- BadSignature error when approaching broker on HTTPS HOT 5
- Vitest - Pact Verifier fails with 3 or more interactions HOT 8
- V4InteractionWithCompleteRequest is unimplemented HOT 9
- Allow using `new ArrayBuffer(0)` in withRequest.body to be honest in the contract tests HOT 1
- MatchersV3.reify doesn't extract payload from MatchersV3.nullValue() HOT 4
- Consumer test using application/x-www-form-urlencoded content type is being serialised as JSON
- Verify Pact-JS against pact-compatibility-suite
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pact-js.