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

PROPOSAL: Allow user to specify verification timeout #31

Merged
merged 2 commits into from
Feb 27, 2017
Merged

Conversation

mefellows
Copy link
Member

Fixes #30, but please count this as a proposal rather than a full-blown PR. I haven't fully explored test coverage etc. at this point.

Adds ability for a user to specify a timeout on the verification process. Previously there was a 10s verification timeout.

Another alternative could be to remove the timeout altogether and simply allow the parent testing framework to perform the timeout.

Looking for your thoughts @mboudreau.

@mboudreau
Copy link
Contributor

mboudreau commented Feb 23, 2017 via email

@mefellows
Copy link
Member Author

mefellows commented Feb 23, 2017

Actually, there is already a check for if it fails to start:

this._instance.once('close', function (code) {
    code == 0 ? deferred.resolve(output) : deferred.reject(new Error(output));
});

This is basically just a timeout for the verification process itself. I think we have two choices:

  1. Don't impose a timeout at all (just return the promise)
  2. Impose a timeout and allow the user to change it (return the promise with a timeout attached)

@mboudreau
Copy link
Contributor

mboudreau commented Feb 24, 2017 via email

@mefellows
Copy link
Member Author

This isn't like the mock server though, it doesn't start a service on any port that we can monitor - it just invokes our service in sequence as per the pact file. All we can monitor is an active PID, which we get via child_process. I've tested directly modifying the verifier (make it fail early, throw errors, move the file etc.) and all cases are caught by this close event, with the appropriate error bubbling back up.

Can you think of anything else I'm missing?

@mboudreau
Copy link
Contributor

mboudreau commented Feb 26, 2017 via email

@mefellows
Copy link
Member Author

No logs I'm afraid.

remove the timeout on the process and add it to the verification step

I'm not following, sorry. Are you saying rather than have it on Verifier.prototype.verify (verifier.js) put it in verifyPacts() (pact.js)? Or something else?

@mboudreau
Copy link
Contributor

mboudreau commented Feb 26, 2017 via email

@mefellows
Copy link
Member Author

Done - modified from 60s to 30s.

Good to see you enjoy your holidays the way I do :)

Copy link
Contributor

@mboudreau mboudreau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small change, after that, should be good to merge into master with updated version number, then tag said version and push with tag to set off build/deploy.

src/verifier.js Outdated
if (options.timeout) {
checkTypes.assert.positive(options.timeout);
} else {
options.timeout = 30000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this up to the start of the function and have the default there like options.timeout = options.timeout || 30000. Leave the conditional/assert there though.

@willfalconer
Copy link

Is there an ETA on this being merged?

We have run into an issue verifying pacts in Vagrant where the hard coded 10s timeout is not long enough. Modifying verifier.js and bumping the timeout to 20s solves the timeout issues for us.

@mefellows
Copy link
Member Author

mefellows commented Feb 27, 2017 via email

Copy link
Contributor

@mboudreau mboudreau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@mboudreau mboudreau merged commit 4434f03 into master Feb 27, 2017
@mboudreau mboudreau deleted the fix/issue-30 branch February 27, 2017 05:27
@mboudreau
Copy link
Contributor

@mefellows merged. Please increment minor version, tag as the same, then push changes with tag to deploy :)

@mefellows
Copy link
Member Author

@scrumtech v4.8.0 just released. The pact JS package will follow shortly at v2.1.0. Strictly speaking, it is possible to use this in the current pact package if you install pact-node directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants