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

pact-provider-verifier --enable-pending returns non-zero exit code if pending pact has an invalid format #129

Open
romainletendart opened this issue Oct 30, 2024 · 0 comments

Comments

@romainletendart
Copy link

Context

I have a pact file which has been badly generated by a consumer test written in javascript which has duplicate headers in one interaction's request e.g.:

        "headers": {
          "Content-Type": "application/json",
          "content-type": "application/json"
        }

When I run pact-provider-verifier --enable-pending on that pact (which has been uploaded on a pact broker beforehand), I get this error:

in `check_for_invalid': Duplicate header found (Content-Type and content-type. Please use a comma separated single value when multiple headers with the same name are required. (Pact::DuplicateHeaderError)
Full stack trace
/Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/headers.rb:45:in `check_for_invalid': Duplicate header found (Content-Type and content-type. Please use a comma separated single value when multiple headers with the same name are required. (Pact::DuplicateHeaderError)
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/headers.rb:10:in `block in initialize'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/headers.rb:9:in `each_pair'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/headers.rb:9:in `initialize'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/shared/request.rb:15:in `new'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/shared/request.rb:15:in `initialize'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/request.rb:24:in `initialize'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/request.rb:20:in `new'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/request.rb:20:in `from_hash'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/interaction_v3_parser.rb:52:in `parse_request_with_non_string_body'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/interaction_v3_parser.rb:35:in `parse_request'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/interaction_v3_parser.rb:15:in `call'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/interaction_parser.rb:20:in `parse_v3_interaction'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/interaction_parser.rb:11:in `call'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/interaction.rb:22:in `from_hash'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/http_consumer_contract_parser.rb:16:in `block in call'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/http_consumer_contract_parser.rb:16:in `each'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/http_consumer_contract_parser.rb:16:in `each_with_index'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/http_consumer_contract_parser.rb:16:in `each'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/http_consumer_contract_parser.rb:16:in `collect'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/http_consumer_contract_parser.rb:16:in `call'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/consumer_contract.rb:45:in `block in from_hash'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/consumer_contract.rb:44:in `each'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/consumer_contract.rb:44:in `from_hash'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-support-1.20.0/lib/pact/consumer_contract/consumer_contract.rb:52:in `from_json'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-1.64.0/lib/pact/provider/rspec.rb:27:in `honour_pactfile'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-1.64.0/lib/pact/provider/pact_spec_runner.rb:136:in `block in initialize_specs'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-1.64.0/lib/pact/provider/pact_spec_runner.rb:128:in `each'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-1.64.0/lib/pact/provider/pact_spec_runner.rb:128:in `initialize_specs'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-1.64.0/lib/pact/provider/pact_spec_runner.rb:35:in `run'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-1.64.0/lib/pact/cli/run_pact_verification.rb:70:in `run_with_pact_uri_object'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-1.64.0/lib/pact/cli/run_pact_verification.rb:51:in `run_specs'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-1.64.0/lib/pact/cli/run_pact_verification.rb:21:in `call'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-1.64.0/lib/pact/cli/run_pact_verification.rb:13:in `call'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-provider-verifier-1.38.0/lib/pact/provider_verifier/app.rb:181:in `verify_pact'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-provider-verifier-1.38.0/lib/pact/provider_verifier/app.rb:50:in `block in pacts_pass_verification?'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-provider-verifier-1.38.0/lib/pact/provider_verifier/app.rb:49:in `collect'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-provider-verifier-1.38.0/lib/pact/provider_verifier/app.rb:49:in `pacts_pass_verification?'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-provider-verifier-1.38.0/lib/pact/provider_verifier/app.rb:41:in `call'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-provider-verifier-1.38.0/lib/pact/provider_verifier/app.rb:34:in `call'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-provider-verifier-1.38.0/lib/pact/provider_verifier/cli/verify.rb:49:in `verify'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/thor-1.3.0/lib/thor/command.rb:28:in `run'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/thor-1.3.0/lib/thor.rb:527:in `dispatch'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/thor-1.3.0/lib/thor/base.rb:584:in `start'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/vendor/ruby/3.2.0/gems/pact-provider-verifier-1.38.0/lib/pact/provider_verifier/cli/custom_thor.rb:17:in `start'
        from /Users/romain.letendart/.virtualenvs/cool-project/lib/python3.11/site-packages/pact/lib/app/pact-provider-verifier.rb:33:in `<main>'

⚠️ But then pact-provider-verifier just stops with a non-zero exit status code even though the pact is marked as:

        "verificationProperties": {
          "pending": true,

Configuration

  • Using pact-provider-verifier (1.38.0) through pact-python==2.2.2
Gemfile.lock
GEM
  remote: http://rubygems.org/
  specs:
    awesome_print (1.9.2)
    diff-lcs (1.5.1)
    dig_rb (1.0.1)
    expgen (0.1.1)
      parslet
    faraday (2.9.0)
      faraday-net_http (>= 2.0, < 3.2)
    faraday-net_http (3.1.0)
      net-http
    faraday-retry (2.2.0)
      faraday (~> 2.0)
    find_a_port (1.0.1)
    httparty (0.21.0)
      mini_mime (>= 1.0.0)
      multi_xml (>= 0.5.2)
    json (2.6.3)
    mini_mime (1.1.5)
    multi_xml (0.6.0)
    net-http (0.4.1)
      uri
    pact (1.64.0)
      pact-mock_service (~> 3.0, >= 3.3.1)
      pact-support (~> 1.16, >= 1.16.9)
      rack-test (>= 0.6.3, < 3.0.0)
      rspec (~> 3.0)
      term-ansicolor (~> 1.7)
      thor (>= 0.20, < 2.0)
      webrick (~> 1.8)
    pact-message (0.11.1)
      pact-mock_service (~> 3.1)
      pact-support (~> 1.8)
      thor (>= 0.20, < 2.0)
    pact-mock_service (3.11.2)
      find_a_port (~> 1.0.1)
      json
      pact-support (~> 1.16, >= 1.16.4)
      rack (~> 2.0)
      rspec (>= 2.14)
      thor (>= 0.19, < 2.0)
      webrick (~> 1.8)
    pact-provider-verifier (1.38.0)
      faraday (~> 2.5)
      faraday-retry (~> 2.2)
      json (> 1.8)
      pact (~> 1.59)
      pact-message (~> 0.5)
      rack (~> 2.1)
      rack-reverse-proxy
      rspec (~> 3.5)
      rspec_junit_formatter (~> 0.3)
    pact-support (1.20.0)
      awesome_print (~> 1.9)
      diff-lcs (~> 1.5)
      expgen (~> 0.1)
      rainbow (~> 3.1.1)
    pact_broker-client (1.75.1)
      dig_rb (~> 1.0)
      httparty (>= 0.21.0, < 1.0.0)
      rake (~> 13.0)
      table_print (~> 1.5)
      term-ansicolor (~> 1.7)
      thor (>= 0.20, < 2.0)
    parslet (2.0.0)
    rack (2.2.8)
    rack-proxy (0.7.7)
      rack
    rack-reverse-proxy (0.12.0)
      rack (>= 1.0.0)
      rack-proxy (~> 0.6, >= 0.6.1)
    rack-test (2.1.0)
      rack (>= 1.3)
    rainbow (3.1.1)
    rake (13.1.0)
    rspec (3.13.0)
      rspec-core (~> 3.13.0)
      rspec-expectations (~> 3.13.0)
      rspec-mocks (~> 3.13.0)
    rspec-core (3.13.0)
      rspec-support (~> 3.13.0)
    rspec-expectations (3.13.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.13.0)
    rspec-mocks (3.13.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.13.0)
    rspec-support (3.13.0)
    rspec_junit_formatter (0.6.0)
      rspec-core (>= 2, < 4, != 2.12.0)
    sync (0.5.0)
    table_print (1.5.7)
    term-ansicolor (1.7.1)
      tins (~> 1.0)
    thor (1.3.0)
    tins (1.32.1)
      sync
    uri (0.13.0)
    webrick (1.8.1)

PLATFORMS
  aarch64-linux
  arm64-darwin
  arm64-darwin-20
  arm64-darwin-21
  arm64-darwin-22
  arm64-darwin-23
  ruby
  x64-mingw32
  x86_64-darwin
  x86_64-darwin-20
  x86_64-darwin-21
  x86_64-darwin-22
  x86_64-darwin-23
  x86_64-linux

DEPENDENCIES
  json (= 2.6.3)
  pact (= 1.64.0)
  pact-message (= 0.11.1)
  pact-mock_service (= 3.11.2)
  pact-provider-verifier (= 1.38.0)
  pact_broker-client (= 1.75.1)
  rack (>= 2.2.6)
  webrick (= 1.8.1)

BUNDLED WITH
   2.5.3
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

No branches or pull requests

1 participant