Git Product home page Git Product logo

Comments (18)

azzamallow avatar azzamallow commented on September 17, 2024 1

Yes I can.

from pact-js.

mefellows avatar mefellows commented on September 17, 2024

hmm am I right in guessing that you are connecting a pact front end to the pact go daemon?

from pact-js.

azzamallow avatar azzamallow commented on September 17, 2024

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.

mefellows avatar mefellows commented on September 17, 2024

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.

azzamallow avatar azzamallow commented on September 17, 2024

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.

mefellows avatar mefellows commented on September 17, 2024

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.

lemon123456 avatar lemon123456 commented on September 17, 2024

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.

lemon123456 avatar lemon123456 commented on September 17, 2024

@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.

mboudreau avatar mboudreau commented on September 17, 2024

from pact-js.

lemon123456 avatar lemon123456 commented on September 17, 2024

I'm using node v8.5.0

from pact-js.

mefellows avatar mefellows commented on September 17, 2024

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.

lemon123456 avatar lemon123456 commented on September 17, 2024

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.

crystalyxiaoxianer avatar crystalyxiaoxianer commented on September 17, 2024

@azzamallow hi,i got the same problem with pact. would you please provide the solution?thank you.

from pact-js.

mefellows avatar mefellows commented on September 17, 2024

@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.

crystalyxiaoxianer avatar crystalyxiaoxianer commented on September 17, 2024

@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.

mefellows avatar mefellows commented on September 17, 2024

@crystalyxiaoxianer if you have a separate issue, could you please raise it with a fully working example so we can help?

from pact-js.

crystalyxiaoxianer avatar crystalyxiaoxianer commented on September 17, 2024

@mefellows ok,i will.

from pact-js.

crystalyxiaoxianer avatar crystalyxiaoxianer commented on September 17, 2024

@mefellows new issue:#184

from pact-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.