pact-foundation / pact-js-core

Core binaries for pact-js, a Contract Testing Framework. NOTE: If you are looking to do Pact contract testing in node, you almost certainly want pact-js, not pact-node.
https://docs.pact.io
MIT License
150 stars 79 forks source link

Errors in latest provider-verifier #37

Closed mboudreau closed 7 years ago

mboudreau commented 7 years ago

When running tests with the latest provider-verifier, I'm seeing some errors coming up from the binary, but the tests still pass. Is it cause for concern?

Server Spec Start server ✓ should dispatch event when starting (1015ms) (node:17217) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/app/lib/pact/provider_verifier/app.rb:113:in read': Is a directory @ io_fread - /home/mboudreau/Work/pact/pact-node/node_modules/mocha/bin (Errno::EISDIR) from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/app/lib/pact/provider_verifier/app.rb:113:inget_json_from_local_file' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/app/lib/pact/provider_verifier/app.rb:94:in get_json' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/app/lib/pact/provider_verifier/app.rb:31:inget_pact_consumer_name' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/app/lib/pact/provider_verifier/app.rb:65:in block in verify_pacts' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/app/lib/pact/provider_verifier/app.rb:64:incollect' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/app/lib/pact/provider_verifier/app.rb:64:in verify_pacts' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/app/lib/pact/provider_verifier/cli.rb:21:inverify' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/vendor/ruby/2.2.0/gems/thor-0.19.4/lib/thor/command.rb:27:in run' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/vendor/ruby/2.2.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:ininvoke_command' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/vendor/ruby/2.2.0/gems/thor-0.19.4/lib/thor.rb:369:in dispatch' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/vendor/ruby/2.2.0/gems/thor-0.19.4/lib/thor/base.rb:444:instart' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/app/pact-provider-verifier.rb:3:in `

'

  ✓ should change running state to true (1021ms)
  when no options are set
    ✓ should start correctly with defaults (1022ms)
  when invalid options are set
    ✓ should fail if custom ssl certs do not exist
    ✓ should fail if custom ssl keys do not exist
    ✓ should fail if custom ssl cert is set, but ssl key isn't
    ✓ should fail if custom ssl key is set, but ssl cert isn't
  when valid options are set
    ✓ should start correctly when instance is delayed (6026ms)
    ✓ should start correctly with ssl (1038ms)
    ✓ should start correctly with custom ssl cert/key (1040ms)
    ✓ should start correctly with custom ssl cert/key but without specifying ssl flag (1050ms)
    ✓ should start correctly with cors (1028ms)
    ✓ should start correctly with port (1040ms)
    ✓ should start correctly with host (1032ms)
    ✓ should start correctly with spec version 1 (1032ms)
    ✓ should start correctly with spec version 2 (1027ms)
    ✓ should start correctly with dir (1036ms)
    ✓ should start correctly with log (1035ms)
    ✓ should start correctly with consumer name (1024ms)
    ✓ should start correctly with provider name (1073ms)
Stop server
  when already started
    ✓ should stop running (1031ms)
    ✓ should dispatch event when stopping (1034ms)
    ✓ should change running state to false (1034ms)
Delete server
  when already running
    ✓ should stop & delete server (1037ms)
    ✓ should dispatch event when deleting (1033ms)
    ✓ should change running state to false (1031ms)

Verifier Spec Verifier when automatically finding pacts from a broker when not given --pact-urls and only --provider ✓ should fail with an error when not given --pact-urls and only --pact-broker-url ✓ should fail with an error when given valid arguments ✓ should return a Verifier object when not given --pact-urls or --provider-base-url ✓ should fail with an error when given --provider-states-url and not --provider-states-setup-url ✓ should fail with an error when given --provider-states-setup-url and not --provider-states-url ✓ should fail with an error when given local Pact URLs that don't exist ✓ should fail with an error when given an invalid timeout ✓ should fail with an error when given remote Pact URLs that don't exist ✓ should pass through to the Pact Verifier regardless when given local Pact URLs that do exist ✓ should not fail when requested to publish verification results to a Pact Broker and specifies a provider version ✓ should pass through to the Pact Verifier when requested to publish verification results to a Pact Broker and does not specify provider version ✓ should fail with an error when given the correct arguments ✓ should return a Verifier object verify when given a successful scenario with no provider States ✓ should return a successful promise with exit-code 0

Publish Spec Pact Broker Mock listening on port: 9221 when publishing a to a broker without authentication and the Pact contract is valid ✓ should successfully publish all Pacts (43ms) ✓ should successfully tag all Pacts with 'test' and 'latest' and the Pact contract is invalid [2017-05-11T15:41:50.468Z] ERROR: pact-node@4.9.1/17217 on JAX: Invalid Pact contract given. Unable to parse consumer and provider name Error: Invalid Pact contract given. Unable to parse consumer and provider name at constructPutUrl (/home/mboudreau/Work/pact/pact-node/src/publisher.js:193:9) at /home/mboudreau/Work/pact/pact-node/src/publisher.js:71:12 at Function..map..collect (/home/mboudreau/Work/pact/pact-node/node_modules/underscore/underscore.js:172:24) at /home/mboudreau/Work/pact/pact-node/src/publisher.js:69:7 at Promise.apply (/home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:1185:26) at Promise.promise.promiseDispatch (/home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:808:41) at /home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:1411:14 at runSingle (/home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:137:13) at flush (/home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:125:13) at _combinedTickCallback (internal/process/next_tick.js:73:7) at process._tickCallback (internal/process/next_tick.js:104:9) ✓ should report an unsuccessful push with authentication and valid credentials ✓ should return a sucessful promise and invalid credentials [2017-05-11T15:41:50.481Z] ERROR: pact-node@4.9.1/17217 on JAX: Could not publish pacts to broker at "http://localhost:9221/auth":

  • Failed http call to pact broker. URI: http://localhost:9221/auth/pacts/provider/publisher/consumer/consumer/version/1.0.0 Code: 401 Body: Unauthorized

    Error: Could not publish pacts to broker at "http://localhost:9221/auth":

  • Failed http call to pact broker. URI: http://localhost:9221/auth/pacts/provider/publisher/consumer/consumer/version/1.0.0 Code: 401 Body: Unauthorized at /home/mboudreau/Work/pact/pact-node/src/publisher.js:89:22 at _fulfilled (/home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:854:54) at self.promiseDispatch.done (/home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:883:30) at Promise.promise.promiseDispatch (/home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:816:13) at /home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:624:44 at runSingle (/home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:137:13) at flush (/home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:125:13) at _combinedTickCallback (internal/process/next_tick.js:73:7) at process._tickCallback (internal/process/next_tick.js:104:9) ✓ should return a rejected promise when publishing a directory of Pacts to a Broker and the directory contains only valid Pact contracts ✓ should asynchronously send all Pacts to the Broker ✓ should successfully tag all Pacts sent with 'test' and 'latest' and the directory contains Pact and non-Pact contracts ✓ should asynchronously send only the Pact contracts to the broker when publishing Pacts from an http-based URL and the Pact contracts are valid ✓ should asynchronously send the Pact contracts to the broker ✓ should successfully tag all Pacts sent with 'test' and 'latest' and the Pact contracts do not exist (404) [2017-05-11T15:41:50.550Z] ERROR: pact-node@4.9.1/17217 on JAX: Could not retrieve all Pact contracts:
  • Failed to get Pact contract from broker: Failed http call to pact broker. URI: http://localhost:9221/somepacturlthatdoesntexist Code: 404 Body: <!DOCTYPE html>

    Error
    Cannot GET /somepacturlthatdoesntexist

    -- Error: Could not retrieve all Pact contracts:

  • Failed to get Pact contract from broker: Failed http call to pact broker. URI: http://localhost:9221/somepacturlthatdoesntexist Code: 404 Body: <!DOCTYPE html>

    Error
    Cannot GET /somepacturlthatdoesntexist
    at /home/mboudreau/Work/pact/pact-node/src/publisher.js:63:16
    at _fulfilled (/home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:854:54)
    at self.promiseDispatch.done (/home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:883:30)
    at Promise.promise.promiseDispatch (/home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:816:13)
    at /home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:624:44
    at runSingle (/home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:137:13)
    at flush (/home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)
    ✓ should return a rejected promise

    and the Pact contracts are invalid (no consumer/provider) [2017-05-11T15:41:50.555Z] ERROR: pact-node@4.9.1/17217 on JAX: Invalid Pact contract given. Unable to parse consumer and provider name Error: Invalid Pact contract given. Unable to parse consumer and provider name at constructPutUrl (/home/mboudreau/Work/pact/pact-node/src/publisher.js:193:9) at /home/mboudreau/Work/pact/pact-node/src/publisher.js:71:12 at Function..map..collect (/home/mboudreau/Work/pact/pact-node/node_modules/underscore/underscore.js:172:24) at /home/mboudreau/Work/pact/pact-node/src/publisher.js:69:7 at Promise.apply (/home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:1185:26) at Promise.promise.promiseDispatch (/home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:808:41) at /home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:1411:14 at runSingle (/home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:137:13) at flush (/home/mboudreau/Work/pact/pact-node/node_modules/q/q.js:125:13) at _combinedTickCallback (internal/process/next_tick.js:73:7) at process._tickCallback (internal/process/next_tick.js:104:9) ✓ should return a rejected promise

    Verifier Integration Spec Pact Broker Mock listening on port: 9123 when given a successful contract without provider states (node:17217) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/ruby/lib/ruby/2.2.0/net/http.rb:879:in initialize': getaddrinfo: Name or service not known (Faraday::ConnectionFailed) from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/ruby/lib/ruby/2.2.0/net/http.rb:879:inopen' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/ruby/lib/ruby/2.2.0/net/http.rb:879:in block in connect' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/ruby/lib/ruby/2.2.0/timeout.rb:74:intimeout' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/ruby/lib/ruby/2.2.0/net/http.rb:878:in connect' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/ruby/lib/ruby/2.2.0/net/http.rb:863:indo_start' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/ruby/lib/ruby/2.2.0/net/http.rb:852:in start' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/ruby/lib/ruby/2.2.0/net/http.rb:1375:inrequest' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/ruby/lib/ruby/2.2.0/net/http.rb:1133:in get' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/vendor/ruby/2.2.0/gems/faraday-0.12.1/lib/faraday/adapter/net_http.rb:78:inperform_request' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/vendor/ruby/2.2.0/gems/faraday-0.12.1/lib/faraday/adapter/net_http.rb:38:in block in call' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/vendor/ruby/2.2.0/gems/faraday-0.12.1/lib/faraday/adapter/net_http.rb:85:inwith_net_http_connection' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/vendor/ruby/2.2.0/gems/faraday-0.12.1/lib/faraday/adapter/net_http.rb:33:in call' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/vendor/ruby/2.2.0/gems/faraday_middleware-0.10.1/lib/faraday_middleware/response_middleware.rb:30:incall' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/vendor/ruby/2.2.0/gems/faraday-0.12.1/lib/faraday/rack_builder.rb:139:in build_response' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/vendor/ruby/2.2.0/gems/faraday-0.12.1/lib/faraday/connection.rb:386:inrun_request' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/vendor/ruby/2.2.0/gems/faraday-0.12.1/lib/faraday/connection.rb:149:in get' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/app/lib/pact/provider_verifier/app.rb:108:inget_json_from_server' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/app/lib/pact/provider_verifier/app.rb:92:in get_json' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/app/lib/pact/provider_verifier/app.rb:31:inget_pact_consumer_name' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/app/lib/pact/provider_verifier/app.rb:65:in block in verify_pacts' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/app/lib/pact/provider_verifier/app.rb:64:incollect' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/app/lib/pact/provider_verifier/app.rb:64:in verify_pacts' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/app/lib/pact/provider_verifier/cli.rb:21:inverify' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/vendor/ruby/2.2.0/gems/thor-0.19.4/lib/thor/command.rb:27:in run' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/vendor/ruby/2.2.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:ininvoke_command' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/vendor/ruby/2.2.0/gems/thor-0.19.4/lib/thor.rb:369:in dispatch' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/vendor/ruby/2.2.0/gems/thor-0.19.4/lib/thor/base.rb:444:instart' from /home/mboudreau/Work/pact/pact-node/node_modules/@pact-foundation/pact-provider-verifier-linux-x64/lib/app/pact-provider-verifier.rb:3:in `

    '

    ✓ should return a successful promise (1151ms)

    with Provider States ✓ should return a successful promise (1058ms) with POST data ✓ should return a successful promise (1059ms) with POST data and regex validation ✓ should return a successful promise (1089ms) when given a failing contract ✓ should return a rejected promise (1167ms) when given multiple successful API calls in a contract ✓ should return a successful promise (1114ms) when given multiple contracts from a local file ✓ should return a successful promise (1097ms) from a Pact Broker without authentication ✓ should return a successful promise (2430ms) with authentication and a valid user/password ✓ should return a successful promise (7553ms) and an invalid user/password ✓ should return a rejected promise (951ms) ✓ should return the verifier error output in the returned promise (951ms) when publishing verification results to a Pact Broker and there is a valid verification HAL link in the Pact file ✓ should return a successful promise (1233ms) and there is an invalid verification HAL link in the Pact file ✓ should fail with an error (1226ms)

    118 passing (50s)

mefellows commented 7 years ago

On first glance they look like output from negative test cases (e.g. 401s, 404s and file no found)

mboudreau commented 7 years ago

Should we try to catch these problems in pact-node or just let the process blow up?

mefellows commented 7 years ago

Hmmm might be difficult. One option is to filter out stack traces and allow user to get to the detail if there are errors (log to file?). https://github.com/pact-foundation/pact-js/issues/46

mboudreau commented 7 years ago

This has been fixed when converting to Typescript.