Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow Pact Mock Server results in timeout #20

Closed
mefellows opened this issue Aug 25, 2016 · 48 comments
Closed

Slow Pact Mock Server results in timeout #20

mefellows opened this issue Aug 25, 2016 · 48 comments
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@mefellows
Copy link
Member

See https://groups.google.com/forum/#!topic/pact-support/53nMFlG3EGY for background.

@mefellows mefellows added the bug Indicates an unexpected problem or unintended behavior label Aug 25, 2016
@mboudreau
Copy link
Contributor

Released a fix, 4.5.2, bit not positive if it will fix the issue. Added a test to add a delay for server initialization.

@willfalconer
Copy link

Thanks @mboudreau, unfortunately the issue has not been resolved.

@mboudreau
Copy link
Contributor

@scrumtech can you please set the log level to debug and post what's shown?

pact.logLevel('debug');

@willfalconer
Copy link

vagrant@vagrant-ubuntu-trusty-64:/vagrant$ npm t

> test-pact@1.0.0 test /vagrant
> node_modules/mocha/bin/mocha --compilers js:babel-register src/.mocha.js ./src/workItemServce.test.js

[2016-08-29T23:07:17.250Z]  INFO: pact-node@4.5.2/1797 on vagrant-ubuntu-trusty-64:
    Creating Pact Server with options:
    port = 9000,
    host = localhost,
    dir = /vagrant/pacts,
    ssl = false,
    cors = false,
    log = /vagrant/logs/mockserver-integration.log,
    spec = 2,
    consumer = ,
    provider =


  test pact
    with a single request
[2016-08-29T23:07:17.277Z]  INFO: pact-node@4.5.2/1797 on vagrant-ubuntu-trusty-64: Creating Pact with PID: 1802
[2016-08-29T23:07:19.845Z] DEBUG: pact-node@4.5.2/1797 on vagrant-ubuntu-trusty-64:
    /vagrant/node_modules/@pact-foundation/pact-mock-service-linux-x64/lib/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.7.12/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /vagrant/node_modules/.bin in PATH, mode 040777

[2016-08-29T23:07:24.694Z] DEBUG: pact-node@4.5.2/1797 on vagrant-ubuntu-trusty-64:
    [2016-08-29 23:07:24] INFO  WEBrick 1.3.1
    [2016-08-29 23:07:24] INFO  ruby 2.1.5 (2014-11-13) [x86_64-linux]

[2016-08-29T23:07:24.695Z] DEBUG: pact-node@4.5.2/1797 on vagrant-ubuntu-trusty-64:
    [2016-08-29 23:07:24] INFO  WEBrick::HTTPServer#start: pid=1803 port=9000

      1) "before each" hook for "successfully verifies"
[2016-08-29T23:07:47.295Z]  INFO: pact-node@4.5.2/1797 on vagrant-ubuntu-trusty-64: Removing Pact with PID: 1802
[2016-08-29T23:07:47.298Z] DEBUG: pact-node@4.5.2/1797 on vagrant-ubuntu-trusty-64:
    [2016-08-29 23:07:47] INFO  going to shutdown ...
    [2016-08-29 23:07:47] INFO  WEBrick::HTTPServer#start done.

[2016-08-29T23:07:47.301Z]  INFO: pact-node@4.5.2/1797 on vagrant-ubuntu-trusty-64:
    Deleting Pact Server with options:
    port = 9000,
    host = localhost,
    dir = /vagrant/pacts,
    ssl = false,
    cors = false,
    log = /vagrant/logs/mockserver-integration.log,
    spec = 2,
    consumer = ,
    provider =
[2016-08-29T23:07:47.305Z]  INFO: pact-node@4.5.2/1797 on vagrant-ubuntu-trusty-64: Removing all Pact servers.


  0 passing (30s)
  1 failing

  1) test pact "before each" hook for "successfully verifies":
     Error: timeout of 30000ms exceeded. Ensure the done() callback is being called in this test.




[2016-08-29T23:07:47.319Z]  INFO: pact-node@4.5.2/1797 on vagrant-ubuntu-trusty-64: Removing all Pact servers.
npm ERR! Test failed.  See above for more details.

@mboudreau
Copy link
Contributor

@scrumtech have you tried not setting up a directory?

@mboudreau
Copy link
Contributor

mboudreau commented Aug 31, 2016

@scrumtech seems to me that the pact binary dies before you even start your tests. Maybe you should try to run the binary directly without going through pact-node with the same options. The binary is available under node_modules/@pact-foundation/pact-node/node_modules/@pact-foundation/pact-mock-service/bin

@mefellows
Copy link
Member Author

I spoke to Wil on this and as I understand the Pact Binary runs just fine.

Looking at those logs, the service comes up at 23:07:24 and shuts down 23
seconds later at 23:07:47. So it is up, but for some reason the 'start'
event is never fired and the promise is never fulfilled. weird.

On Wed, Aug 31, 2016 at 10:17 AM, Michel Boudreau notifications@github.com
wrote:

@scrumtech https://github.com/scrumtech seems to me that the pact
binary dies before you even start your tests. Maybe you should try to run
the binary directly without going through pact-node with the same options.
The binary is available under node_modules/@pact-foundation/
pact-node/node_modules/


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#20 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADSjL6OZQgy9FPfDF8fxtq23CHoFxdUks5qlMgbgaJpZM4Jsnni
.

Matt Fellows

@mboudreau
Copy link
Contributor

Hm, right. On the pact-node side, it calls the service to check that it's actually up (there's no other way of knowing). It could be that there's a weird network thing that it can't call pact from the node wrapper.

I might have to try this out further, however, I don't want to have to create a vagrant box to replicate. Can this be replicated using Docker?

@mefellows
Copy link
Member Author

I'm working on a Docker setup for you now @mboudreau... standby.

@mefellows
Copy link
Member Author

OK, I've ported it to Docker (still works, sorry), and here is the Dockerfile.

FROM ubuntu:trusty

RUN mkdir -p /vagrant/.vagrant-config/
RUN mkdir -p /home/vagrant/
COPY . /vagrant
RUN chmod +x /vagrant/.vagrant-config/*.sh
RUN /vagrant/.vagrant-config/provision.sh
RUN /vagrant/.vagrant-config/node_install.sh
WORKDIR /vagrant
RUN npm i
RUN npm t

Steps to run the tests:

docker build -t test-pact .
docker run -it test-pact bash
# now in shell...
npm t

Additionally, I had to replace the newer version of ruby on line 14 of provision.sh, with apt-get install -y ruby2.0 ruby2.0-dev. This of course may well be the original problem (although it didn't seem to effect me). Worth looking into.

@scrumtech keen to see if you get the same error on Docker or if it disappears!

@mboudreau
Copy link
Contributor

Why did you have to install Ruby? We don't need it for pact-node...

On Wed, Aug 31, 2016, 8:47 PM Matt Fellows notifications@github.com wrote:

OK, I've ported it to Docker (still works, sorry), and here is the
Dockerfile.

FROM ubuntu:trusty

RUN mkdir -p /vagrant/.vagrant-config/
RUN mkdir -p /home/vagrant/
COPY . /vagrant
RUN chmod +x /vagrant/.vagrant-config/*.sh
RUN /vagrant/.vagrant-config/provision.sh
RUN /vagrant/.vagrant-config/node_install.sh
WORKDIR /vagrant
RUN npm i
RUN npm t

Steps to run the tests:

docker build -t test-pact .
docker run -it test-pact bash

now in shell...

npm t

Additionally, I had to replace the newer version of ruby on line 14 of
provision.sh, with apt-get install -y ruby2.0 ruby2.0-dev. This of course
may well be the original problem (although it didn't seem to effect me).
Worth looking into.

@scrumtech https://github.com/scrumtech keen to see if you get the same
error on Docker or if it disappears!


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#20 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAjA5B3GgQLaLcDGsSUBosFjoVC2h9g5ks5qlVusgaJpZM4Jsnni
.

@mefellows
Copy link
Member Author

I think it's just part of a default image type thing. As I understand it's
part of their dev environment as their SOE is Windows, so they need a
linux-env to do a lot of this fun new stuff.

In any case, if it is Ruby that's the cause (I'm doubtful as it worked for
me, but remain open and skeptical) we want to know about any conflicts.

On Wed, Aug 31, 2016 at 9:18 PM, Michel Boudreau notifications@github.com
wrote:

Why did you have to install Ruby? We don't need it for pact-node...

On Wed, Aug 31, 2016, 8:47 PM Matt Fellows notifications@github.com
wrote:

OK, I've ported it to Docker (still works, sorry), and here is the
Dockerfile.

FROM ubuntu:trusty

RUN mkdir -p /vagrant/.vagrant-config/
RUN mkdir -p /home/vagrant/
COPY . /vagrant
RUN chmod +x /vagrant/.vagrant-config/*.sh
RUN /vagrant/.vagrant-config/provision.sh
RUN /vagrant/.vagrant-config/node_install.sh
WORKDIR /vagrant
RUN npm i
RUN npm t

Steps to run the tests:

docker build -t test-pact .
docker run -it test-pact bash

now in shell...

npm t

Additionally, I had to replace the newer version of ruby on line 14 of
provision.sh, with apt-get install -y ruby2.0 ruby2.0-dev. This of course
may well be the original problem (although it didn't seem to effect me).
Worth looking into.

@scrumtech https://github.com/scrumtech keen to see if you get the
same
error on Docker or if it disappears!


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
<https://github.com/pact-foundation/pact-node/issues/
20#issuecomment-243727756>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/
AAjA5B3GgQLaLcDGsSUBosFjoVC2h9g5ks5qlVusgaJpZM4Jsnni>
.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#20 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADSjPjTPepwHFcEm6ZtRf9gEA9_5op7ks5qlWMXgaJpZM4Jsnni
.

Matt Fellows

@mboudreau
Copy link
Contributor

This is getting weird and frustrating that we can't reproduce this anywhere... I've seen this for months and only affects certain people.

@mboudreau
Copy link
Contributor

@scrumtech can you try the docker version to see if it fails for you? Trying to see what's the 'variable' that's making this fail.

@willfalconer
Copy link

Will try to get back to you today on this.

@mefellows
Copy link
Member Author

Thanks Will.

On Mon, Sep 5, 2016 at 9:43 AM, Will Falconer notifications@github.com
wrote:

Will try to get back to you today on this.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#20 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADSjElUCB7SvJt3EprSTaJV3dwZSCYsks5qm1ehgaJpZM4Jsnni
.

Matt Fellows

@willfalconer
Copy link

After playing with the docker image at work, I feel that the docker image has been changed so much it isn't a real representation of the issue we are having.

Having said that, I quickly span up a docker image based on node:5 and was able to get things working, which has given me an idea to work around this issue for the moment. I'll share my dockerfile or docker-compose.yml when I get it worked out.

@mboudreau
Copy link
Contributor

@scrumtech docker should be able to recreate exactly the situation you
would be seeing in vagrant. If you feel that it's not, feel free to update
the docker image to show your situation.

On Mon, Sep 5, 2016 at 4:42 PM Will Falconer notifications@github.com
wrote:

After playing with the docker image at work, I feel that the docker image
has been changed so much it isn't a real representation of the issue we are
having.

Having said that, I quickly span up a docker image based on node:5 and was
able to get things working, which has given me an idea to work around this
issue for the moment. I'll share my dockerfile or docker-compose.yml when I
get it worked out.


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#20 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAjA5CqS5HLfeASdbWIZ2WgVfdwengieks5qm7nggaJpZM4Jsnni
.

@mefellows
Copy link
Member Author

How can it be - it's a completely different runtime :)

I'm glad the docker container worked though.

@michel - any chance you might change your mind on the vagrant side of
things?

On Mon, Sep 5, 2016 at 4:42 PM, Will Falconer notifications@github.com
wrote:

After playing with the docker image at work, I feel that the docker image
has been changed so much it isn't a real representation of the issue we are
having.

Having said that, I quickly span up a docker image based on node:5 and was
able to get things working, which has given me an idea to work around this
issue for the moment. I'll share my dockerfile or docker-compose.yml when I
get it worked out.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#20 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADSjBQI_Bzj0kAJlUvFQncc5egNz_A-ks5qm7nhgaJpZM4Jsnni
.

Matt Fellows

@mboudreau
Copy link
Contributor

@mefellows Vagrant isn't going to help me debug the issue unless I can reproduce the simplest steps possible to make it break. There are many things that could be making it break in vagrant...

I have a sinking feeling that there's something weird happening with the network not allowing it to connect to the pact service when it's up. I can give it a shot tonight over vagrant.

@mefellows
Copy link
Member Author

Yeah I totally get your point, we can't rule out Vagrant but there is
something about that runtime that's the problem.

@will - I'm actually wondering if you could try upping this value from 10s
to something much bigger:
https://github.com/pact-foundation/pact-node/blob/master/src/server.js#L116.
It's a bit of a shot in the dark but it seems to add up.

I have a sneaking suspicion it's as simple as that (and maybe a better
error message if it is the case).

On Mon, Sep 5, 2016 at 4:51 PM, Michel Boudreau notifications@github.com
wrote:

@mefellows https://github.com/mefellows Vagrant isn't going to help me
debug the issue unless I can reproduce the simplest steps possible to make
it break. There are many things that could be making it break in vagrant...

I have a sinking feeling that there's something weird happening with the
network not allowing it to connect to the pact service when it's up. I can
give it a shot tonight over vagrant.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#20 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADSjPM4K2b9Oazm7ipHggGV7fa0LJ4gks5qm7wGgaJpZM4Jsnni
.

Matt Fellows

@will
Copy link

will commented Sep 5, 2016

I could change the number I suppose, but I don’t even know what pact is :(

@mefellows
Copy link
Member Author

Sorry @will, looks like I accidentally brought you into the convo inadvertently (sent via email). You should read up on Pact though hehe ;)

cc: @scrumtech

@mboudreau
Copy link
Contributor

@mefellows bahahaha, awesome

@willfalconer
Copy link

Ok. I have made some progress. Docker the way @mefellows was running it, isn't going to fit into our dev environment (too slow to build a docker image each time), however, it did work. So I have been trying an alternative docker method

docker run --rm -it -v /vagrant:/vagrant node:5 npm i && npm t

This still doesn't work. However, this is not conclusive, since I'm on Windows 7, so I have to run Vagrant in order to run docker (which is why we use Vagrant in the first place). I'm going to suggest that there is actually something interesting going on with the node_modules folder in Vagrant which is causing this problem. This is mainly gut feel at the moment based a little bit on previous problems we have had with node_modules (so I have no proof of this).

I also can't rule out @mboudreau's suggestion of a network related issue.

I think it is safe to say that the problem is quite related to Vagrant.

@willfalconer
Copy link

@mefellows I tried changing that timeout to 30 seconds , and no difference.

@willfalconer
Copy link

I was thinking more about the issue this morning. From the testing we have done so far I think we can say the following

  1. It works without Vagrant
  2. It doesn't work WITH Vagrant

Vagrant is definitely the critical bit of information here. So we must be testing in Vagrant.

I'm going to cut down the example I created to the minimum required to reproduce the problem (i.e. remove as much of the provisioning as possible).

@mefellows
Copy link
Member Author

That'd be great thanks Will

On 6 Sep 2016 9:26 am, "Will Falconer" notifications@github.com wrote:

I was thinking more about the issue this morning. From the testing we have
done so far I think we can say the following

  1. It works without Vagrant
  2. It doesn't work WITH Vagrant

Vagrant is definitely the critical bit of information here. So we must be
testing in Vagrant.

I'm going to cut down the example I created to the minimum required to
reproduce the problem (i.e. remove as much of the provisioning as possible).


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#20 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADSjK7o_CFf5LiXSDtZXH7kcdGN5bveks5qnKUsgaJpZM4Jsnni
.

@mboudreau
Copy link
Contributor

@scrumtech that would help a lot, thanks :)

On Tue, Sep 6, 2016 at 9:54 AM Matt Fellows notifications@github.com
wrote:

That'd be great thanks Will

On 6 Sep 2016 9:26 am, "Will Falconer" notifications@github.com wrote:

I was thinking more about the issue this morning. From the testing we
have
done so far I think we can say the following

  1. It works without Vagrant
  2. It doesn't work WITH Vagrant

Vagrant is definitely the critical bit of information here. So we must be
testing in Vagrant.

I'm going to cut down the example I created to the minimum required to
reproduce the problem (i.e. remove as much of the provisioning as
possible).


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<
#20 (comment)
,
or mute the thread
<
https://github.com/notifications/unsubscribe-auth/AADSjK7o_CFf5LiXSDtZXH7kcdGN5bveks5qnKUsgaJpZM4Jsnni

.


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#20 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAjA5M3ABDoKjikhQ9dxSO_KyHkapdsKks5qnKuagaJpZM4Jsnni
.

@willfalconer
Copy link

@mefellows @mboudreau Quick question: does the test file workItemService.js and package.json need to be made any more simple?

FYI: removing all provisioning (except installing node) still reproduces the problem.

@mboudreau
Copy link
Contributor

@scrumtech, at this point it shouldn't affect it. I'll see if I can
reproduce it using vagrant.

On Tue, Sep 6, 2016 at 11:25 AM Will Falconer notifications@github.com
wrote:

@mefellows https://github.com/mefellows @mboudreau
https://github.com/mboudreau Quick question: does the test file
workItemService.js and package.json need to be made any more simple?

FYI: removing all provisioning (except installing node) still reproduces
the problem.


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#20 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAjA5FBWxld7KbVbH-tTIPNg5jnLhx6Cks5qnMEPgaJpZM4Jsnni
.

@mboudreau
Copy link
Contributor

@scrumtech Alright, I finally got some time to tinker with this.

First, I'd like to say that your example simply didn't work. When I added console.log to all the functions within your tests, there was something wrong because most of them were never called, including the 'beforeEach' that actually starts the mock service. I'm not sure why that is, but the second I use ES5 instead of ES6 javascript, stuff started working. I also used Node 4 instead of 6 since it's the more stable version.

After that, I didn't have many issues starting the server, however I did see an issue with the server check because vagrant was taking a while to spin up the instance for it to be available before the check hit it's timeout. I've increased the timeout to 30 seconds from 5 seconds. I think this is where the inconsistency came from when the VM was first starting. I don't think this will be an issue no more with the new version I've released, 4.5.3.

Feel free to try it out, but I'm not sure what is the issue with your test functions not running properly. I would suggest you get those working first before trying again with pact-node.

Cheers.

@mefellows
Copy link
Member Author

The example works for me Michel on a clean checkout and install (not using
vagrant), node v4 and v6. What's not working for you?

Or Do you mean there is extraneous stuff that's not adding value?

On Tuesday, 13 September 2016, Michel Boudreau notifications@github.com
wrote:

@scrumtech https://github.com/scrumtech Alright, I finally got some
time to tinker with this.

First, I'd like to say that your example simply didn't work. When I added
console.log to all the functions within your tests, there was something
wrong because most of them were never called, including the 'beforeEach'
that actually starts the mock service. I'm not sure why that is, but the
second I use ES5 instead of ES6 javascript, stuff started working. I also
used Node 4 instead of 6 since it's the more stable version.

After that, I didn't have many issues starting the server, however I did
see an issue with the server check because vagrant was taking a while to
spin up the instance for it to be available before the check hit it's
timeout. I've increased the timeout to 30 seconds from 5 seconds. I think
this is where the inconsistency came from when the VM was first starting. I
don't think this will be an issue no more with the new version I've
released, 4.5.3.

Feel free to try it out, but I'm not sure what is the issue with your test
functions not running properly. I would suggest you get those working first
before trying again with pact-node.

Cheers.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#20 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADSjDVzTMwbXVUxKMyxCt4eZdGUpZRAks5qpW0TgaJpZM4Jsnni
.

Matt Fellows

@mboudreau
Copy link
Contributor

The example wasn't working at all for me. It never went into the beforeEach
then timed out.

On Tue, Sep 13, 2016, 11:05 PM Matt Fellows notifications@github.com
wrote:

The example works for me Michel on a clean checkout and install (not using
vagrant), node v4 and v6. What's not working for you?

Or Do you mean there is extraneous stuff that's not adding value?

On Tuesday, 13 September 2016, Michel Boudreau notifications@github.com
wrote:

@scrumtech https://github.com/scrumtech Alright, I finally got some
time to tinker with this.

First, I'd like to say that your example simply didn't work. When I added
console.log to all the functions within your tests, there was something
wrong because most of them were never called, including the 'beforeEach'
that actually starts the mock service. I'm not sure why that is, but the
second I use ES5 instead of ES6 javascript, stuff started working. I also
used Node 4 instead of 6 since it's the more stable version.

After that, I didn't have many issues starting the server, however I did
see an issue with the server check because vagrant was taking a while to
spin up the instance for it to be available before the check hit it's
timeout. I've increased the timeout to 30 seconds from 5 seconds. I think
this is where the inconsistency came from when the VM was first
starting. I
don't think this will be an issue no more with the new version I've
released, 4.5.3.

Feel free to try it out, but I'm not sure what is the issue with your
test
functions not running properly. I would suggest you get those working
first
before trying again with pact-node.

Cheers.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<
#20 (comment)
,
or mute the thread
<
https://github.com/notifications/unsubscribe-auth/AADSjDVzTMwbXVUxKMyxCt4eZdGUpZRAks5qpW0TgaJpZM4Jsnni

.

Matt Fellows


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#20 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAjA5MVC1qLn_yGEbXX2_4NFn-3IGlXbks5qpp-MgaJpZM4Jsnni
.

@tarciosaraiva
Copy link
Contributor

@scrumtech had a chance to have a quick look at this.

Your implementation worked for me on v4 and v6 locally. No issues.
On Vagrant the story is a bit different.

I'm not a Vagrant "connoisseur" so please excuse if some of my comments are a bit naive. Here's my results so far:

  • Vagrant didn't work for me with box ubuntu/xenial64. The network would not come up. I found this thread about it and took action recommended on the last comment
  • Once I changed to bento/ubuntu-16.04 things got better. Box provisioned successfully.
  • vagrant ssh and npm install
  • Installation hanged on unixify package
  • Decided to install every package of your project individually
  • All went well until I got to pact-node - it hanged on one of its dependencies: underscore
  • Went over the dependencies on pact-node one by one
  • Installed underscore and decided to install unixify and url-join independently as well
  • Installed successfully. Try to install pact-node again and it hangs waiting on q
  • Installed q individually. Then npm i check-types request bunyan bunyan-prettystream
  • OK, so far so good. Keep going with npm i commander mkdirp
  • OK. Trying pact-node again. Hangs on this guy: http://registry.npmjs.com/@pact-foundation%2fpact-mock-service
  • Tried to install @pact-foundation/pact-mock-service individually. Got this:
npm ERR! Linux 4.4.0-31-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "i" "@pact-foundation/pact-mock-service"
npm ERR! node v6.6.0
npm ERR! npm  v3.10.7

npm ERR! shasum check failed for /tmp/npm-4362-8f5ec750/registry.npmjs.org/_40pact-foundation/pact-mock-service/-/pact-mock-service-0.9.0.tgz
npm ERR! Expected: 5c5eefa72a4a2d86a198e6c450fac514f9826cdf
npm ERR! Actual:   976f47ab36d3ed1d4cdf2538a4dc40dd05a03b11
npm ERR! From:     https://registry.npmjs.org/@pact-foundation/pact-mock-service/-/pact-mock-service-0.9.0.tgz
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

This is an issue I have seen a couple of times in Travis where a simple "re run" would fix the job.

Unfortunately no solution as yet.

I will keep digging.

@mefellows
Copy link
Member Author

Thanks for digging @tarciosaraiva!

The pact-mock-service issue appears to be a bit random - from reading the internets that problem is essentially either a combination of a timeout (because it took to long and the proxy server d/c cutting the file short) or of load on the proxy server. Normally, a subsequent install sorts it out. In any case, once we switch to the dynamic library this should be a non-issue.

For now though... the plot thickens!

@tarciosaraiva
Copy link
Contributor

ya that's not what I'm experiencing on my Vagrant box @mefellows - constant failures, taking 20+ minutes each time.

I'm going through the code of pact-mock-service and there's a recommendation on Traveling Ruby related to package optimisation which I'm not sure we are applying.

Might be worth checking out to reduce the size of the binary.

@mefellows
Copy link
Member Author

Yup, there's definitely some room for improvement on that front, but beware - as you'll see in the commit log (or maybe it was the verifier, but both have similar problems) we're still not convinced what is actually required to prevent stuff breaking on windows (at some point the distro was down 30% on what it was today).

@andrewspinks
Copy link

@tarciosaraiva I was having the exact same problems with npm install yesterday. Today it seems to be working (but still seems slow). I think the node registry is flaky. It sounds like there are some mirrors available, so if it happens again maybe we can try them out: http://stackoverflow.com/questions/6383894/npm-registry-alternative-to-http-registry-npmjs-org-npm

@andrewspinks
Copy link

andrewspinks commented Sep 21, 2016

@scrumtech I believe this is just caused by the mock server being very slow to start on vagrant / ubuntu. When I change the mocha timeout to be 10 seconds for starting the mock server then it works for me.

I think we should improve the logging / README to help make it clearer that the server has not started yet.

beforeEach(function(done)  {
    this.timeout(10000);
    mockServer.start().then(() => {
      provider = Pact({ consumer: 'My Consumer', provider: 'My Provider', port: 1234 })
      done()
    })
  })

@tarciosaraiva
Copy link
Contributor

One way to go around this slowness is to pass --delay to mocha and run the tests once all is up. An example is here: https://github.com/tarciosaraiva/pact-melbjs/blob/master/helper.js

@mefellows
Copy link
Member Author

I thought @scrumtech tried that, along with increasing the timeout in pact-node itself (e.g. #20 (comment)). But if we missed that and it fixes it - then great! - we might want to make it configurable though.

@mboudreau
Copy link
Contributor

I've incremented it in the last release to 30 seconds from 10, but I did
have to increase the timeout in mocha as well. This is mainly because
vagrant runs the binary a lot slower.

On Wed, Sep 21, 2016 at 2:08 PM Matt Fellows notifications@github.com
wrote:

I thought @scrumtech https://github.com/scrumtech tried that, along
with increasing the timeout in pact-node itself (e.g. #20 (comment)
#20 (comment)).
But if we missed that and it fixes it - then great! - we might want to make
it configurable though.


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#20 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAjA5GZyt49c-i-gXoPY0Mpibgt7GLJvks5qsK3AgaJpZM4Jsnni
.

@willfalconer
Copy link

willfalconer commented Sep 21, 2016

This is crazy - I'm somewhat confused with whats going on now.

I've had trouble today getting ubuntu/xenial64 working. So I switched to bento/ubuntu-16.04 and everything worked!

FYI: problem with ubuntu/xenial64 was with running apt-get update and apt-get install so provisioning the box wasn't happening.

@mefellows
Copy link
Member Author

👏 glad to hear it's sort of working. Would love to get to the bottom of it but at least it seems like it's probably not a bug in the Pact Node/Js world.

What do you see as the next steps @scrumtech ?

@willfalconer
Copy link

As I was mentioning to @andrewspinks, I think we need to move way from the ubuntu/* base boxes. They seem to have a number of issues and I have been told by a number of people that the bento boxes are better.

We will start using Pact now for integrating with a new service we are writing. So we will start to get our usage up and try to contribute going forward.

@tarciosaraiva
Copy link
Contributor

That's great to hear @scrumtech! After my investigation last night I did some research today about what people are using for their Linux Vagrant boxes and most of them ran away from ubuntu/* boxes due to complications on provisioning.

Glad to hear it's working now on your end. Looking forward to your contributions 👍

@mboudreau
Copy link
Contributor

@scrumtech Good to hear. Can I close this issue then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

6 participants