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

verifyProvider() does not throw an error if neither pactUrl nor pactBrokerUrl is specified #1109

Open
4 of 5 tasks
armen-ch opened this issue Aug 18, 2023 · 1 comment
Open
4 of 5 tasks
Labels
bug Indicates an unexpected problem or unintended behavior triage This issue is yet to be triaged by a maintainer

Comments

@armen-ch
Copy link

Software versions

  • OS: OS Name: Microsoft Windows 10 Enterprise 10.0.19045 N/A Build 19045
  • Consumer Pact library: Pact JS 12.1.0
  • Node Version: v18.17.1

Issue Checklist

Please confirm the following:

  • I have upgraded to the latest
  • I have the read the FAQs in the Readme
  • I have triple checked, that there are no unhandled promises in my code and have read the section on intermittent test failures
  • I have set my log level to debug and attached a log file showing the complete request/response cycle
  • For bonus points and virtual high fives, I have created a reproduceable git repository (see below) to illustrate the problem

Expected behaviour

verifyProvider() should throw an error if neither pactUrl nor pactBrokerUrl is specified.

Actual behaviour

If no pact source is specified, i.e. none of the pactBrokerUrl or pactUrl arguments are specified, the provider test passes, which is not the expected behavior.

Steps to reproduce

Example:

const {Verifier} = require('@pact-foundation/pact');
describe('Testing pactVerifier', () => {
  it('Test1',  () => {
    let opts = {
      providerBaseUrl: 'http://localhost:8888',
      provider: 'provider-service',
      // pactBrokerUrl: 'http://my-pact-broker.com',
      // pactUrls: [__dirname + '/pacts/pact1.json'],
      logLevel: 'debug',
      verbose: true,
    };
    return new Verifier(opts).verifyProvider();
  });
});

Relevant log files

> mocha --config tests/.mocharc.js  tests/*.spec.js


  Testing pactVerifier
[23:07:39.402] INFO (7136): [email protected]: Verifying provider
[23:07:39.412] INFO (7136): [email protected]: debug request/response logging enabled
[23:07:39.427] INFO (7136): [email protected]: Verifying Pacts.
[23:07:39.428] WARN (7136): [email protected]: verbose is deprecated and no longer has any effect
[23:07:39.429] INFO (7136): [email protected]: Verifying Pact Files
[23:07:39.430] DEBUG (7136): [email protected]: Initalising native core at log level 'debug'
[23:07:39.430] DEBUG (7136): [email protected]: binding path #0: : attempting to load native module from: 

 - C:\workspace\Contract\pactify-js\node_modules\@pact-foundation\pact-core\prebuilds\win32-x64
   source: pact-js-core binding lookup

 - You can override via PACT_PREBUILD_LOCATION

[23:07:39.451] INFO (7136): 0.4.6: pact native library successfully found, and the correct version
2023-08-18T19:07:39.453045Z DEBUG ThreadId(01) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_new_for_application FFI function invoked
2023-08-18T19:07:39.453892Z DEBUG ThreadId(01) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_set_provider_info FFI function invoked
[23:07:39.453] DEBUG (7136): [email protected]: the optional ffi function 'pactffiVerifierSetFilterInfo' was not executed as it had non-fatal validation errors: None of PACT_DESCRIPTION, PACT_PROVIDER_STATE
 or PACT_PROVIDER_NO_STATE were set in the environment
2023-08-18T19:07:39.455184Z DEBUG ThreadId(01) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_set_provider_state FFI function invoked
2023-08-18T19:07:39.455381Z DEBUG ThreadId(01) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_set_verification_options FFI function invoked
[23:07:39.454] DEBUG (7136): [email protected]: the optional ffi function 'pactffiVerifierSetPublishOptions' was not executed as it had non-fatal validation errors: No publishVerificationResult option / PAC
T_BROKER_PUBLISH_VERIFICATION_RESULTS set, or no providerVersion option
[23:07:39.455] DEBUG (7136): [email protected]: the optional ffi function 'pactffiVerifierSetConsumerFilters' was not executed as it had non-fatal validation errors: Either no consumerFilters option provide
d, or the array was empty
[23:07:39.456] DEBUG (7136): [email protected]: the optional ffi function 'pactffiVerifierSetFailIfNoPactsFound' was not executed as it had non-fatal validation errors: No failIfNoPactsFound option provided
[23:07:39.457] DEBUG (7136): [email protected]: the optional ffi function 'pactffiVerifierAddCustomHeader' was not executed as it had non-fatal validation errors: No customProviderHeaders option provided   
[23:07:39.458] DEBUG (7136): [email protected]: the optional ffi function 'pactffiVerifierAddDirectorySource' was not executed as it had non-fatal validation errors: No pactUrls option provided
[23:07:39.458] DEBUG (7136): [email protected]: the optional ffi function 'pactffiVerifierBrokerSourceWithSelectors' was not executed as it had non-fatal validation errors: No pactBrokerUrl option / PACT_BR
OKER_BASE_URL set, or no provider option set
[23:07:39.459] DEBUG (7136): [email protected]: the optional ffi function 'pactffiVerifierAddProviderTransport' was not executed as it had non-fatal validation errors: No additional provider transports prov
ided
2023-08-18T19:07:39.462216Z DEBUG ThreadId(02) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_execute FFI function invoked
2023-08-18T19:07:39.465204Z DEBUG ThreadId(02) pact_plugin_driver::catalogue_manager: Updated catalogue entries:
core/content-generator/binary
core/content-generator/json
core/content-matcher/json
core/content-matcher/multipart-form-data
core/content-matcher/text
core/content-matcher/xml
2023-08-18T19:07:39.465637Z DEBUG ThreadId(02) pact_plugin_driver::catalogue_manager: Updated catalogue entries:
core/matcher/v1-equality
core/matcher/v2-max-type
core/matcher/v2-min-type
core/matcher/v2-minmax-type
core/matcher/v2-regex
core/matcher/v2-type
core/matcher/v3-content-type
core/matcher/v3-date
core/matcher/v3-datetime
core/matcher/v3-decimal-type
core/matcher/v3-includes
core/matcher/v3-integer-type
core/matcher/v3-null
core/matcher/v3-number-type
core/matcher/v3-time
core/matcher/v4-array-contains
core/matcher/v4-equals-ignore-order
core/matcher/v4-max-equals-ignore-order
core/matcher/v4-min-equals-ignore-order
core/matcher/v4-minmax-equals-ignore-order
core/matcher/v4-not-empty
core/matcher/v4-semver
2023-08-18T19:07:39.466683Z  WARN ThreadId(02) pact_matching::metrics:

Please note:
We are tracking events anonymously to gather important usage statistics like Pact version and operating system. To disable tracking, set the 'PACT_DO_NOT_TRACK' environment variable to 'true'.


2023-08-18T19:07:39.467228Z DEBUG ThreadId(02) pact_matching::metrics: Sending event to GA - {"cd3": "windows-x86_64", "ev": "0", "av": "14.0.3", "el": "Pacts verified", "v": "1", "aip": "true", "aid": "pa
ct-core", "ec": "ProviderTest", "tid": "UA-117778936-1", "cid": "39040468befd153a4b7568fcea085b84", "cd6": "pact_ffi", "ds": "client", "ea": "Completed", "cd2": "unknown", "t": "event", "cd7": "1.1.4", "an
": "pact-core"}
2023-08-18T19:07:39.478777Z DEBUG tokio-runtime-worker hyper::client::connect::dns: resolving host="www.google-analytics.com"
2023-08-18T19:07:39.546466Z DEBUG ThreadId(02) hyper::client::connect::http: connecting to 216.58.206.46:443
2023-08-18T19:07:39.605203Z DEBUG ThreadId(02) hyper::client::connect::http: connected to 216.58.206.46:443
2023-08-18T19:07:39.745215Z DEBUG tokio-runtime-worker hyper::proto::h1::io: flushed 402 bytes
2023-08-18T19:07:39.812187Z DEBUG tokio-runtime-worker hyper::proto::h1::io: parsed 12 headers
2023-08-18T19:07:39.812445Z DEBUG tokio-runtime-worker hyper::proto::h1::conn: incoming body is content-length (35 bytes)
2023-08-18T19:07:39.812659Z DEBUG tokio-runtime-worker hyper::proto::h1::conn: incoming body completed

2023-08-18T19:07:39.812972Z DEBUG ThreadId(02) pact_plugin_driver::plugin_manager: Shutting down all plugins
[23:07:39.812] DEBUG (7136): [email protected]: shutting down verifier with handle 0
2023-08-18T19:07:39.814205Z DEBUG ThreadId(01) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_shutdown FFI function invoked
[23:07:39.813] DEBUG (7136): [email protected]: response from verifier: null, 0
[23:07:39.813] INFO (7136): [email protected]: Verification successful
    ✔ Test1 (413ms)


  1 passing (422ms)


Process finished with exit code 0

@armen-ch armen-ch added bug Indicates an unexpected problem or unintended behavior triage This issue is yet to be triaged by a maintainer labels Aug 18, 2023
@mefellows
Copy link
Member

Thanks for raising

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 triage This issue is yet to be triaged by a maintainer
Projects
Status: New Issue
Development

No branches or pull requests

2 participants