Git Product home page Git Product logo

pact-ruby-standalone's Introduction

Pact Ruby Standalone

Build

Creates a standalone pact command line executable using the ruby pact implementation and Traveling Ruby

Package contents

This version (2.4.12) of the Pact standalone executables package contains:

  • pact gem 1.65.1
  • pact-mock_service gem 3.11.2
  • pact-support gem 1.20.1
  • pact-provider-verifier gem 1.38.1
  • pact_broker-client gem 1.76.1
  • pact-message gem 0.11.1

Binaries will be extracted into pact/bin:

./pact/bin/
├── pact
├── pact-broker
├── pactflow
├── pact-message
├── pact-mock-service
├── pact-provider-verifier
└── pact-stub-service

Windows Users

Please append .bat to any of the provided binaries

eg.

  .\pact\bin\pact-broker.bat

Installation

See the release page.

Supported Platforms

Ruby is not required on the host platform, Ruby 3.3.3 is provided in the distributable.

OS Ruby Architecture Supported
MacOS 3.3.3 x86_64
MacOS 3.3.3 aarch64 (arm64)
Linux 3.3.3 x86_64
Linux 3.3.3 aarch64 (arm64)
Windows 3.3.3 x86_64
Windows 3.3.3 x86
Windows 3.3.3 aarch64 (arm64) 🚧

🚧 - Tested under emulation mode x86 / x86_64 in Windows on ARM

Usage

pact-mock-service

Commands:
  pact-mock-service control               # Run a Pact mock service control s...
  pact-mock-service control-restart       # Start a Pact mock service control...
  pact-mock-service control-start         # Start a Pact mock service control...
  pact-mock-service control-stop          # Stop a Pact mock service control ...
  pact-mock-service help [COMMAND]        # Describe available commands or on...
  pact-mock-service restart               # Start or restart a mock service. ...
  pact-mock-service service               # Start a mock service. If the cons...
  pact-mock-service start                 # Start a mock service. If the cons...
  pact-mock-service stop -p, --port=PORT  # Stop a Pact mock service
  pact-mock-service version               # Show the pact-mock-service gem version

Usage:
  pact-mock-service service

Options:
      [--consumer=CONSUMER]                                      # Consumer name
      [--provider=PROVIDER]                                      # Provider name
  -p, [--port=PORT]                                              # Port on which to run the service
  -h, [--host=HOST]                                              # Host on which to bind the service
                                                                 # Default: localhost
  -d, [--pact-dir=PACT_DIR]                                      # Directory to which the pacts will be written
  -m, [--pact-file-write-mode=PACT_FILE_WRITE_MODE]              # `overwrite` or `merge`. Use `merge` when running multiple mock service instances in parallel for the same consumer/provider pair. Ensure the pact file is deleted before running tests when using this option so that interactions deleted from the code are not maintained in the file.
                                                                 # Default: overwrite
  -i, [--pact-specification-version=PACT_SPECIFICATION_VERSION]  # The pact specification version to use when writing the pact. Note that only versions 1 and 2 are currently supported.
                                                                 # Default: 2
  -l, [--log=LOG]                                                # File to which to log output
      [--log-level=LOG_LEVEL]                                    # Log level. Options are DEBUG INFO WARN ERROR
                                                                 # Default: DEBUG
  -o, [--cors=CORS]                                              # Support browser security in tests by responding to OPTIONS requests and adding CORS headers to mocked responses
      [--ssl], [--no-ssl], [--skip-ssl]                          # Use a self-signed SSL cert to run the service over HTTPS
                                                                 # Default: false
      [--sslcert=SSLCERT]                                        # Specify the path to the SSL cert to use when running the service over HTTPS
      [--sslkey=SSLKEY]                                          # Specify the path to the SSL key to use when running the service over HTTPS

Start a mock service. If the consumer, provider and pact-dir options are provided, the pact will be written automatically on shutdown (INT).

pact-stub-service

Usage:
  pact-stub-service PACT_URI ...

Options:
  -p, [--port=PORT]                        # Port on which to run the service
  -h, [--host=HOST]                        # Host on which to bind the service
                                           # Default: localhost
  -l, [--log=LOG]                          # File to which to log output
  -n, [--broker-username=BROKER_USERNAME]  # Pact Broker basic auth username
  -p, [--broker-password=BROKER_PASSWORD]  # Pact Broker basic auth password
  -k, [--broker-token=BROKER_TOKEN]        # Pact Broker bearer token (can also be set using the PACT_BROKER_TOKEN environment variable)
      [--log-level=LOG_LEVEL]              # Log level. Options are DEBUG INFO WARN ERROR
                                           # Default: DEBUG
  -o, [--cors=CORS]                        # Support browser security in tests by responding to OPTIONS requests and adding CORS headers to mocked responses
      [--ssl], [--no-ssl], [--skip-ssl]    # Use a self-signed SSL cert to run the service over HTTPS
                                           # Default: false
      [--sslcert=SSLCERT]                  # Specify the path to the SSL cert to use when running the service over HTTPS
      [--sslkey=SSLKEY]                    # Specify the path to the SSL key to use when running the service over HTTPS

Description:
  Start a stub service with the given pact file(s) or directories. Pact URIs
  may be local file or directory paths, or HTTP. Include any basic auth details
  in the URL using the format https://USERNAME:PASSWORD@URI. Where multiple
  matching interactions are found, the interactions will be sorted by response
  status, and the first one will be returned. This may lead to some
  non-deterministic behaviour. If you are having problems with this, please
  raise it on the pact-dev google group, and we can discuss some potential
  enhancements. Note that only versions 1 and 2 of the pact specification are
  currently fully supported. Pacts using the v3 format may be used, however,
  any matching features added in v3 will currently be ignored.

pact-provider-verifier

To connect to a Pact Broker that uses custom SSL cerificates, set the environment variable $SSL_CERT_FILE or $SSL_CERT_DIR to a path that contains the appropriate certificate.

Usage:
  pact-provider-verifier PACT_URL ... -h, --provider-base-url=PROVIDER_BASE_URL

Options:
  -h, --provider-base-url=PROVIDER_BASE_URL                                                                         # Provider host URL
  -c, [--provider-states-setup-url=PROVIDER_STATES_SETUP_URL]                                                       # Base URL to setup the provider states at
      [--pact-broker-base-url=PACT_BROKER_BASE_URL]                                                                 # Base URL of the Pact Broker from which to retrieve the pacts. Can also be set using the environment variable PACT_BROKER_BASE_URL.
  -n, [--broker-username=BROKER_USERNAME]                                                                           # Pact Broker basic auth username. Can also be set using the environment variable PACT_BROKER_USERNAME.
  -p, [--broker-password=BROKER_PASSWORD]                                                                           # Pact Broker basic auth password. Can also be set using the environment variable PACT_BROKER_PASSWORD.
  -k, [--broker-token=BROKER_TOKEN]                                                                                 # Pact Broker bearer token. Can also be set using the environment variable PACT_BROKER_TOKEN.
      [--provider=PROVIDER]                                                                                         
      [--consumer-version-tag=TAG]                                                                                  # Retrieve the latest pacts with this consumer version tag. Used in conjunction with --provider. May be specified multiple times.
      [--provider-version-tag=TAG]                                                                                  # Tag to apply to the provider application version. May be specified multiple times.
      [--provider-version-branch=BRANCH]                                                                            # The name of the branch the provider version belongs to.
  -g, [--tag-with-git-branch], [--no-tag-with-git-branch], [--skip-tag-with-git-branch]                             # Tag provider version with the name of the current git branch. Default: false
                                                                                                                    # Default: false
  -a, [--provider-app-version=PROVIDER_APP_VERSION]                                                                 # Provider application version, required when publishing verification results
  -r, [--publish-verification-results], [--no-publish-verification-results], [--skip-publish-verification-results]  # Publish verification results to the broker. This can also be enabled by setting the environment variable PACT_BROKER_PUBLISH_VERIFICATION_RESULTS=true
                                                                                                                    # Default: false
      [--enable-pending], [--no-enable-pending], [--skip-enable-pending]                                            # Allow pacts which are in pending state to be verified without causing the overall task to fail. For more information, see https://pact.io/pending
                                                                                                                    # Default: false
      [--custom-provider-header=CUSTOM_PROVIDER_HEADER]                                                             # Header to add to provider state set up and pact verification requests. eg 'Authorization: Basic cGFjdDpwYWN0'. May be specified multiple times.
      [--custom-middleware=FILE]                                                                                    # Ruby file containing a class implementing Pact::ProviderVerifier::CustomMiddleware. This allows the response to be modified before replaying. Use with caution!
  -v, [--verbose=VERBOSE]                                                                                           # Verbose output. Can also be set by setting the environment variable VERBOSE=true.
  -f, [--format=FORMATTER]                                                                                          # RSpec formatter. Defaults to custom Pact formatter. Other options are json and RspecJunitFormatter (which outputs xml).
  -o, [--out=FILE]                                                                                                  # Write output to a file instead of $stdout.
      [--wait=SECONDS]                                                                                              # The number of seconds to poll for the provider to become available before running the verification
                                                                                                                    # Default: 0
      [--log-dir=LOG_DIR]                                                                                           # The directory for the pact.log file
      [--log-level=LOG_LEVEL]                                                                                       # The log level
                                                                                                                    # Default: debug
      [--fail-if-no-pacts-found], [--no-fail-if-no-pacts-found], [--skip-fail-if-no-pacts-found]                    # If specified, will fail when no pacts are found
                                                                                                                    # Default: false

Description:
  The parameters used when fetching pacts dynamically from a Pact Broker are:
  
  --pact-broker-base-url (REQUIRED)
  --provider (REQUIRED)
  --broker-username/--broker-password or --broker-token
  --consumer-version-tag or --consumer-version-selector
  --enable-pending
  --include-wip-pacts-since
  
  To
  verify a pact at a known URL (eg. when a verification is triggered by a
  'contract content changed' webhook), pass in the pact URL(s) as the first
  argument(s) to the command, and do NOT set any of the other parameters apart
  from the base URL and credentials.
  
  To publish verification results for either of the above
  scenarios, set:
  
  --publish-verification-results (REQUIRED)
  --provider-app-version (REQUIRED)
  --provider-version-tag or --tag-with-git-branch
  
  
  Selectors: These are specified using JSON strings.
  The keys are 'tag' (the name of the consumer version tag), 'latest'
  (true|false), 'consumer', and 'fallbackTag'. For example '{\"tag\":
  \"master\", \"latest\": true}'. For a detailed explanation of selectors, see https://pact.io/selectors#consumer-version-selectors

pact-broker client

To connect to a Pact Broker that uses custom SSL cerificates, set the environment variable $SSL_CERT_FILE or $SSL_CERT_DIR to a path that contains the appropriate certificate.

publish

Usage:
  pact-broker publish PACT_DIRS_OR_FILES ... -b, --broker-base-url=BROKER_BASE_URL

Options:
  -a, [--consumer-app-version=CONSUMER_APP_VERSION]                                                                       # The consumer application version
  -h, [--branch=BRANCH]                                                                                                   # Repository branch of the consumer version
  -r, [--auto-detect-version-properties], [--no-auto-detect-version-properties], [--skip-auto-detect-version-properties]  # Automatically detect the repository commit, branch and build URL from known CI environment variables or git CLI. Supports Buildkite, Circle CI, Travis CI, GitHub Actions, Jenkins, Hudson, AppVeyor, GitLab, CodeShip, Bitbucket and Azure DevOps.
                                                                                                                          # Default: false
  -t, [--tag=TAG]                                                                                                         # Tag name for consumer version. Can be specified multiple times.
  -g, [--tag-with-git-branch], [--no-tag-with-git-branch], [--skip-tag-with-git-branch]                                   # Tag consumer version with the name of the current git branch. Supports Buildkite, Circle CI, Travis CI, GitHub Actions, Jenkins, Hudson, AppVeyor, GitLab, CodeShip, Bitbucket and Azure DevOps.
                                                                                                                          # Default: false
      [--build-url=BUILD_URL]                                                                                             # The build URL that created the pact
      [--merge], [--no-merge], [--skip-merge]                                                                             # If a pact already exists for this consumer version and provider, merge the contents. Useful when running Pact tests concurrently on different build nodes.
                                                                                                                          # Default: false
  -o, [--output=OUTPUT]                                                                                                   # json or text
                                                                                                                          # Default: text
  -b, --broker-base-url=BROKER_BASE_URL                                                                                   # The base URL of the Pact Broker
  -u, [--broker-username=BROKER_USERNAME]                                                                                 # Pact Broker basic auth username
  -p, [--broker-password=BROKER_PASSWORD]                                                                                 # Pact Broker basic auth password
  -k, [--broker-token=BROKER_TOKEN]                                                                                       # Pact Broker bearer token
  -v, [--verbose], [--no-verbose], [--skip-verbose]                                                                       # Verbose output.
                                                                                                                          # Default: false

Publish pacts to a Pact Broker.

can-i-deploy

Usage:
  pact-broker can-i-deploy -a, --pacticipant=PACTICIPANT -b, --broker-base-url=BROKER_BASE_URL

Options:
  -a, --pacticipant=PACTICIPANT                                  # The pacticipant name. Use once for each pacticipant being checked.
  -e, [--version=VERSION]                                        # The pacticipant version. Must be entered after the --pacticipant that it relates to.
      [--ignore=PACTICIPANT]                                     # The pacticipant name to ignore. Use once for each pacticipant being ignored. A specific version can be ignored by also specifying a --version after the pacticipant name option. The environment variable PACT_BROKER_CAN_I_DEPLOY_IGNORE may also be used to specify a pacticipant name to ignore, with commas to separate multiple pacticipant names if necessary.
  -l, [--latest=[TAG]]                                           # Use the latest pacticipant version. Optionally specify a TAG to use the latest version with the specified tag.
      [--branch=BRANCH]                                          # The branch of the version for which you want to check the verification results.
      [--main-branch], [--no-main-branch], [--skip-main-branch]  # Use the latest version of the configured main branch of the pacticipant as the version for which you want to check the verification results
                                                                 # Default: false
      [--to-environment=ENVIRONMENT]                             # The environment into which the pacticipant(s) are to be deployed
      [--to=TAG]                                                 # The tag that represents the branch or environment of the integrated applications for which you want to check the verification result status.
  -o, [--output=OUTPUT]                                          # json or table
                                                                 # Default: table
      [--retry-while-unknown=TIMES]                              # The number of times to retry while there is an unknown verification result (ie. the provider verification is likely still running)
                                                                 # Default: 0
      [--retry-interval=SECONDS]                                 # The time between retries in seconds. Use in conjuction with --retry-while-unknown
                                                                 # Default: 10
      [--dry-run], [--no-dry-run], [--skip-dry-run]              # When dry-run is enabled, always exit process with a success code. Can also be enabled by setting the environment variable PACT_BROKER_CAN_I_DEPLOY_DRY_RUN=true. This mode is useful when setting up your CI/CD pipeline for the first time, or in a 'break glass' situation where you need to knowingly deploy what Pact considers a breaking change. For the second scenario, it is recommended to use the environment variable and just set it for the build required to deploy that particular version, so you don't accidentally leave the dry run mode enabled.
                                                                 # Default: false
  -b, --broker-base-url=BROKER_BASE_URL                          # The base URL of the Pact Broker
  -u, [--broker-username=BROKER_USERNAME]                        # Pact Broker basic auth username
  -p, [--broker-password=BROKER_PASSWORD]                        # Pact Broker basic auth password
  -k, [--broker-token=BROKER_TOKEN]                              # Pact Broker bearer token
  -v, [--verbose], [--no-verbose], [--skip-verbose]              # Verbose output.
                                                                 # Default: false

Description:
  Returns exit code 0 or 1, indicating whether or not the specified application
  (pacticipant) has a successful verification result with each of the
  application versions that are already deployed to a particular environment.
  Prints out the relevant pact/verification details, indicating any missing or
  failed verification results.

  The can-i-deploy tool was originally written to support specifying versions
  and dependencies using tags. This usage has now been superseded by first
  class support for environments, deployments and releases. For documentation
  on how to use can-i-deploy with tags, please see
  https://docs.pact.io/pact_broker/client_cli/can_i_deploy_usage_with_tags/

  Before `can-i-deploy` can be used, the relevant environment resources must
  first be created in the Pact Broker using the `create-environment` command.
  The "test" and "production" environments will have been seeded for you. You
  can check the existing environments by running `pact-broker
  list-environments`. See
  https://docs.pact.io/pact_broker/client_cli/readme#environments for more
  information.

  $ pact-broker create-environment --name "uat" --display-name "UAT"
  --no-production

  After an application is deployed or released, its deployment must be recorded
  using the `record-deployment` or `record-release` commands. See
  https://docs.pact.io/pact_broker/recording_deployments_and_releases/ for more
  information.

  $ pact-broker record-deployment --pacticipant Foo --version 173153ae0
  --environment uat

  Before an application is deployed or released to an environment, the
  can-i-deploy command must be run to check that the application version is
  safe to deploy with the versions of each integrated application that are
  already in that environment.

  $ pact-broker can-i-deploy --pacticipant PACTICIPANT --version VERSION
  --to-environment ENVIRONMENT

  Example: can I deploy version 173153ae0 of application Foo to the test
  environment?

  $ pact-broker can-i-deploy --pacticipant Foo --version 173153ae0
  --to-environment test

  Can-i-deploy can also be used to check if arbitrary versions have a
  successful verification. When asking "Can I deploy this application version
  with the latest version from the main branch of another application" it
  functions as a "can I merge" check.

  $ pact-broker can-i-deploy --pacticipant Foo 173153ae0 \ --pacticipant Bar
  --latest main

  ##### Polling

  If the verification process takes a long time and there are results missing
  when the can-i-deploy command runs in your CI/CD pipeline, you can configure
  the command to poll and wait for the missing results to arrive. The arguments
  to specify are `--retry-while-unknown TIMES` and `--retry-interval SECONDS`,
  set to appropriate values for your pipeline.

pactflow client

publish-provider-contract

Usage:
  pactflow publish-provider-contract CONTRACT_FILE ... --provider=PROVIDER -a, --provider-app-version=PROVIDER_APP_VERSION -b, --broker-base-url=BROKER_BASE_URL

Options:
      --provider=PROVIDER                                                                   # The provider name
  -a, --provider-app-version=PROVIDER_APP_VERSION                                           # The provider application version
  -h, [--branch=BRANCH]                                                                     # Repository branch of the provider version
  -t, [--tag=TAG]                                                                           # Tag name for provider version. Can be specified multiple times.
      [--specification=SPECIFICATION]                                                       # The contract specification
                                                                                            # Default: oas
      [--content-type=CONTENT_TYPE]                                                         # The content type. eg. application/yml
      [--verification-success], [--no-verification-success], [--skip-verification-success]  # Whether or not the self verification passed successfully.
      [--verification-exit-code=N]                                                          # The exit code of the verification process. Can be used instead of --verification-success|--no-verification-success for a simpler build script.
      [--verification-results=VERIFICATION_RESULTS]                                         # The path to the file containing the output from the verification process
      [--verification-results-content-type=VERIFICATION_RESULTS_CONTENT_TYPE]               # The content type of the verification output eg. text/plain, application/yaml
      [--verification-results-format=VERIFICATION_RESULTS_FORMAT]                           # The format of the verification output eg. junit, text
      [--verifier=VERIFIER]                                                                 # The tool used to verify the provider contract
      [--verifier-version=VERIFIER_VERSION]                                                 # The version of the tool used to verify the provider contract
      [--build-url=BUILD_URL]                                                               # The build URL that created the provider contract
  -o, [--output=OUTPUT]                                                                     # json or text
                                                                                            # Default: text
  -b, --broker-base-url=BROKER_BASE_URL                                                     # The base URL of the Pact Broker
  -u, [--broker-username=BROKER_USERNAME]                                                   # Pact Broker basic auth username
  -p, [--broker-password=BROKER_PASSWORD]                                                   # Pact Broker basic auth password
  -k, [--broker-token=BROKER_TOKEN]                                                         # Pact Broker bearer token
  -v, [--verbose], [--no-verbose], [--skip-verbose]                                         # Verbose output.
                                                                                            # Default: false

Publish provider contract to PactFlow

pact

docs

Usage:
  pact docs

Options:
  [--pact-dir=PACT_DIR]  # Directory containing the pacts
                         # Default: /home/runner/work/pact-ruby-standalone/pact-ruby-standalone/build/tmp/spec/pacts
  [--doc-dir=DOC_DIR]    # Documentation directory
                         # Default: /home/runner/work/pact-ruby-standalone/pact-ruby-standalone/build/tmp/doc/pacts

Generate Pact documentation in markdown

pact-message

Commands:
  pact-message help [COMMAND]                                                ...
  pact-message reify                                                         ...
  pact-message update MESSAGE_JSON --consumer=CONSUMER --pact-dir=PACT_DIR --...
  pact-message version                                                       ...


Troubleshooting

SSL

To connect to a Pact Broker that uses custom SSL certificates, set the environment variable $SSL_CERT_FILE or $SSL_CERT_DIR to a path that contains the appropriate certificate.

pact-ruby-standalone's People

Contributors

artheus avatar arvi3d avatar benthieu avatar bethesque avatar dependabot[bot] avatar edouard-lopez avatar gmolki avatar joshdick avatar lewiscowleschipuk avatar mefellows avatar neilcampbell avatar pact-dev avatar pavankumar1986 avatar rholshausen avatar trammel avatar you54f avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pact-ruby-standalone's Issues

unable to run application, when invoked from a path with & in a folder name

Pre issue-raising checklist

I have already:

  • Upgraded to the latest version of the relevant libraries
  • Checked to see if the issue has already been raised

Software versions

Expected behaviour

curl -LO https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.85.0/pact-1.85.0-osx.tar.gz
tar xzf pact-1.85.0-osx.tar.gz
cd pact/bin
./pact-mock-service --help start

./pact-mock-service --help start Should return help information.

Actual behaviour

./pact-mock-service --help start returns error.

./pact-mock-service --help start

/Users/__removed__/_R&D/pact/pact/lib/ruby/bin/ruby: line 14: D/pact/pact/lib/ruby/lib/ruby/gems/2.2.0: No such file or directory

pact-verifier does not verify metdata section in V3 spcification message pact

Hi,

I am adding support of message pacts to the pact-net package:
pact-foundation/pact-net#175

While using the pact-verifier package I noticed that there is a section that isn't verified in the V3 messages pact file.
The provider's tests pass no matter what the "metadata" section value is. (metadata for each message not for the whole file).

This is an example of a message contract file:

{
  "consumer": {
    "name": "Event API Message Consumer"
  },
  "provider": {
    "name": "Event API"
  },
  "messages": [
    {
      "description": "Event with id 83F9262F-28F1-4703-AB1A-8CFD9E8249C9 updated",
      "providerStates": [
      ],
      "contents": {
        "eventId": "83f9262f-28f1-4703-ab1a-8cfd9e8249c9"
      },
      "matchingRules": {
        "body": {
        }
      },
      "metaData": {
         "contentType": "test-should-fail"
      }
    }
  ],
  "metadata": {
    "pactSpecification": {
      "version": "2.0.0"
    }
  }
}

Do you know if it is on purpose or a bug?

No valid JSON for pact-broker list-latest-pact-versions

Software versions

  • pact-ruby-standalone: 1.88.15

Expected behaviour

pact-broker list-latest-pact-versions --output=json should return valid JSON.

pact/bin/pact-broker list-latest-pact-versions --output=json --broker-base-url=https://test.pact.dius.com.au --broker-username=dXfltyFMgNOFZAxr8io9wJ37iUpY42M --broker-password=O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1

Actual behaviour

=> is not valid and should be exchanged by :

{"pacts"=>[{"createdAt"=>"2020-04-30T07:44:38+00:00", "_embedded"=>{"consumer"=>{"name"=>"action-modeler", "_embedded"=>{"version"=>{"number"=>"1.0.1588232666", "_links"=>{"self"=>{"title"=>"Version", "name"=>"1.0.1588232666", "href"=>"https://test.pact.dius.com.au/pacticipants/action-modeler/versions/1.0.1588232666"}}}}, "_links"=>{"self"=>{"href"=>"https://test.pact.dius.com.au/pacticipants/action-modeler"}}}, "provider"=>{"name"=>"customdata-association", "_links"=>{"self"=>{"href"=>"https://test.pact.dius.com.au/pacticipants/customdata-association"}}}}, "_links"=>{"self"=>[{"href"=>"https://test.pact.dius.com.au/pacts/provider/customdata-association/consumer/action-modeler/latest"}, {"href"=>"https://test.pact.dius.com.au/pacts/provider/customdata-association/consumer/action-modeler/version/1.0.1588232666"}]}}, {"createdAt"=>"2020-05-24T13:11:09+00:00", "_embedded"=>{"consumer"=>

Steps to reproduce

Your bug will be fixed in our free time, so help us to help you, and make it as easy as possible for us to reproduce the issue. Issues that take longer to reproduce are less likely to be fixed quickly. Please provide a Dockerfile or git repository + build, with instructions on how to reproduce the issue.

Relevent log files

Please ensure you set logging to DEBUG and attach any relevant log files here (or link from a gist).

Pact-message.bat builds empty nodes in pact written to disc

Version: 1.47.1

When running pact-message.bat, contents and metadata are not populated.

Example

D:\Development\github\pact-php>pact-message.bat update '{"description":"an alligator named Mary exists","providerState":"a hello message","metadata":{"queue":"wind cries"},"contents":{"text":"Hello Mary"}}' --consumer=test --provider=testp --pact-dir='D:\\Temp\\'

Produces

{
  "consumer": {
    "name": "test"
  },
  "provider": {
    "name": "testp"
  },
  "messages": [
    {
      "description": "an alligator named Mary exists",
      "providerStates": [
        {
          "name": "a hello message"
        }
      ],
      "content": null,
      "matchingRules": {
        "body": {
        }
      }
    }
  ],
  "metadata": {
    "pactSpecification": {
      "version": "2.0.0"
    }
  }
}

It would seem to me we should not have matchingRules and have messages[{metadata: and messages[{contents: not null

Am I missing something?

regexp in query matching doesn't work for pact-stub-service

It seems that pact-stub-service doesn't work with regexp in query matching and examples.

See example below (part of file) - pact-stub-service requires sortOrder to be equal DESC, and sortField equal to string instead of matchers defined below. In other case you will get 500
with body descrbing that all definied interactions don't match.

"query": { "sortOrder": [ "DESC" ], "sortField": [ "string" ] }, "matchingRules": { "query": { "sortField": { "matchers": [ { "match": "regex", "regex": ".*" } ], "combine": "AND" }, "sortOrder": { "matchers": [ { "match": "regex", "regex": "(ASC)|(DESC)" } ], "combine": "AND" } }

INFO logging to stdout breaks JSON formatter

I recently upgraded Pact Go to 1.21.0 and the Pact integration tests started failing on Provider Verification.

I noticed the issue only happened when we enabled publishing to the broker, and have been able to trace the source of the problem to the following change pact-foundation/pact-ruby@e0dad27#diff-2aa19ad532bad3f2050ce3b3aff47b0dR92.

What's happened is that there is stuff logged to stderr and stdout. The current assumption is that the JSON response should be taken from stdout, so any extra logging to this stream will break JSON parsing. To my knowledge, only the Golang implementation uses this feature, hence why we're only finding it out now.

The simple fix is to log this to stderr, log to disk or remove the message altogether.

NOTE: I didn't raise on the upstream pact project because contextually it belongs here, even though the breaking change is in that library. This does raise another question though, as it's going to be hard to track changes across all of the gem files that do this sort of thing. Should we look to handle output streams in this package based on context/flags? e.g. if JSON is the output format, we can't have other stuff being logged in the same stream.

Request: Ability to pass json to pact-message via standard in

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • Upgraded to the latest version of the relevant libraries
  • Checked to see if the issue has already been raised

Software versions

  • pact-ruby-standalone: 1.88.26

Request

Currently, pact-message expects the content JSON to be passed as a command line parameter:

pact-message update MESSAGE_JSON --consumer=CONSUMER --pact-dir=PACT_DIR --provider=PROVIDER

JSON in a command line param is difficult to quote correctly on windows (I haven't found a library that works for all cases yet).

It would be awesome if we could work around this by having the option to pass the content via standard in:

pact-message update MESSAGE_JSON --consumer=CONSUMER --pact-dir=PACT_DIR --provider=PROVIDER
or
echo "$MESSAGE_JSON" | pact-message update --consumer=CONSUMER --pact-dir=PACT_DIR --provider=PROVIDER

create-webhook doesn't respect SSL_CERT_FILE

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • [X ] Upgraded to the latest version of the relevant libraries
  • Checked to see if the issue has already been raised
  • Created an executable example that demonstrates the issue using either:

Software versions

  • pact library: N/A
  • pact broker-docker: 2.57.0.0
  • pact-ruby-standalone: 1.88.0
  • OS: Mac OSX 10.13.6

Expected behaviour

pact-broker create-webhook successfully creates a webhook

Actual behaviour

create-webhook fails with "certificate verify failed" even though SSL_CERT_FILE is set as an environment variable. On top of that, both "pact-broker create-version-tag" and "pact-broker can-i-deploy" are successful in the same shell.

jarmy-m02:bin jarmy$ echo $SSL_CERT_FILE
/usr/local/etc/openssl/cert.pem
jarmy-m02:bin jarmy$ ./pact-broker can-i-deploy -v --pacticipant=graphql --broker-base-url=https://pact-broker.docker.savagebeast.com --to shared --latest
opening connection to pact-broker.docker.savagebeast.com:443...
opened
starting SSL for pact-broker.docker.savagebeast.com:443...
SSL established
<- "GET /matrix?q%5B%5D%5Bpacticipant%5D=graphql&q%5B%5D%5Blatest%5D=true&latestby=cvp&latest=true&tag=shared HTTP/1.1\r\nAccept: application/hal+json, application/json\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nUser-Agent: Ruby\r\nConnection: close\r\nHost: pact-broker.docker.savagebeast.com\r\n\r\n"
-> "HTTP/1.1 200 OK\r\n"
-> "Server: nginx/1.17.4\r\n"
-> "Date: Thu, 06 Aug 2020 21:58:06 GMT\r\n"
-> "Content-Type: application/hal+json;charset=utf-8\r\n"
-> "Content-Length: 123\r\n"
-> "Connection: close\r\n"
-> "Vary: Accept\r\n"
-> "X-Pact-Broker-Version: 2.57.0\r\n"
-> "X-Content-Type-Options: nosniff\r\n"
-> "\r\n"
reading 123 bytes...
-> "{\"summary\":{\"deployable\":true,\"reason\":\"There are no missing dependencies\",\"success\":0,\"failed\":0,\"unknown\":0},\"matrix\":[]}"
read 123 bytes
Conn close
Computer says yes \o/ 

There are no missing dependencies
jarmy-m02:bin jarmy$ 

Steps to reproduce

Follow instructions to create a webhook here https://github.com/pact-foundation/pact_broker-client#create-webhook

Relevent log files

jarmy-m02:bin jarmy$ ./pact-broker create-webhook "https://listeners.jenkins-sb.savagebeast.com/job/listeners-acceptance/job/graphql/job/DEVTOOLS-610-test-pact-broker-webhooks/buildWithParameters?os_authType=basic&environment=shared&graphqlHost=shared.graphql.docker.savagebeast.com&vaultToken=s.Szy7CSZTjit9zHC11C9Z3W4H" -v --request=POST -u jenkins-builder:$TOKEN --consumer=pegasus-2 --provider=graphql --broker-base-url=https://pact-broker.docker.savagebeast.com --contract-content-changed --description="Trigger GraphQL Acceptance Test Job on contract-content-changed event" -H "Accept:application/json"
opening connection to pact-broker.docker.savagebeast.com:443...
opened
starting SSL for pact-broker.docker.savagebeast.com:443...
SSL established
Conn close because of connect error SSL_connect returned=1 errno=0 state=error: certificate verify failed
ERROR: Error making request - OpenSSL::SSL::SSLError SSL_connect returned=1 errno=0 state=error: certificate verify failed /Users/jarmy/src/git/pandora/devtools/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.28.4/lib/pact_broker/client/hal/http_client.rb:60:in `block in perform_request', attempt 1 of 3
opening connection to pact-broker.docker.savagebeast.com:443...
opened
starting SSL for pact-broker.docker.savagebeast.com:443...
SSL established
Conn close because of connect error SSL_connect returned=1 errno=0 state=error: certificate verify failed
ERROR: Error making request - OpenSSL::SSL::SSLError SSL_connect returned=1 errno=0 state=error: certificate verify failed /Users/jarmy/src/git/pandora/devtools/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.28.4/lib/pact_broker/client/hal/http_client.rb:60:in `block in perform_request', attempt 2 of 3
opening connection to pact-broker.docker.savagebeast.com:443...
opened
starting SSL for pact-broker.docker.savagebeast.com:443...
SSL established
Conn close because of connect error SSL_connect returned=1 errno=0 state=error: certificate verify failed
ERROR: Error making request - OpenSSL::SSL::SSLError SSL_connect returned=1 errno=0 state=error: certificate verify failed /Users/jarmy/src/git/pandora/devtools/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.28.4/lib/pact_broker/client/hal/http_client.rb:60:in `block in perform_request', attempt 3 of 3
/Users/jarmy/src/git/pandora/devtools/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:923:in `connect': SSL_connect returned=1 errno=0 state=error: certificate verify failed (OpenSSL::SSL::SSLError)
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:923:in `block in connect'
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/ruby/lib/ruby/2.2.0/timeout.rb:74:in `timeout'
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:923:in `connect'
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:863:in `do_start'
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:852:in `start'
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.28.4/lib/pact_broker/client/hal/http_client.rb:60:in `block in perform_request'
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.28.4/lib/pact_broker/client/retry.rb:40:in `until_truthy_or_max_times'
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.28.4/lib/pact_broker/client/hal/http_client.rb:56:in `perform_request'
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.28.4/lib/pact_broker/client/hal/http_client.rb:33:in `post'
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.28.4/lib/pact_broker/client/hal/link.rb:53:in `post'
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.28.4/lib/pact_broker/client/webhooks/create.rb:39:in `create_webhook_with_consumer_and_provider'
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.28.4/lib/pact_broker/client/webhooks/create.rb:28:in `call'
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.28.4/lib/pact_broker/client/webhooks/create.rb:17:in `call'
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.28.4/lib/pact_broker/client/cli/broker.rb:308:in `run_webhook_commands'
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.28.4/lib/pact_broker/client/cli/broker.rb:127:in `create_webhook'
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.28.4/lib/pact_broker/client/cli/custom_thor.rb:15:in `start'
	from /Users/jarmy/src/git/pandora/devtools/pact/lib/app/pact-broker.rb:28:in `<main>'

Problem running standalone version on Linux 64

Hi,

I'm trying to run this command from a Debian image:

pact-provider-verifier --pact-broker-base-url $PACT_BROKER_URL --provider-base-url *** --provider users_http_provider --provider-app-version=0.0.1-SNAPSHOT --publish-verification-results=false

but what I'm getting from the response is this error:

/opt/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.8.0/lib/pact/matching_rules/v3/merge.rb:119:in block (2 levels) in log_ignored_rules': undefined method any?' for "AND":String (NoMethodError)
from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.8.0/lib/pact/matching_rules/v3/merge.rb:118:in each' from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.8.0/lib/pact/matching_rules/v3/merge.rb:118:in block in log_ignored_rules'
from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.8.0/lib/pact/matching_rules/v3/merge.rb:117:in `each'

This errors happens because of the invokation of any? method on a string value, which is not supported in this ruby version.

I'm using pact-1.61.2 on Linux 64.

Thanks

DigiCert Global Root certificate not trusted by default

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • Upgraded to the latest version of the relevant libraries
  • Checked to see if the issue has already been raised
  • Created an executable example that demonstrates the issue using either:

Software versions

  • "@pact-foundation/pact": "^9.11.0"
  • OS: Mac OSX 10.15.5

Expected behaviour

Publishing pacts to a broker using a valid certificate with a DigiCert root should be trusted.

Actual behaviour

Attempting to publish to the broker results in the following error:
Failed to publish node-message-consumer/node-message-provider pact due to error: OpenSSL::SSL::SSLError - SSL_connect returned=1 errno=0 state=error: certificate verify failed One or more pacts failed to be published

Steps to reproduce

  1. Create pacts using any project similar to https://github.com/pact-foundation/pact-js/tree/master/examples/messages
  2. Update publish.js to point to a broker using a DigiCert root certificate
  3. Attempt to publish pacts to the broker

Your bug will be fixed in our free time, so help us to help you, and make it as easy as possible for us to reproduce the issue. Issues that take longer to reproduce are less likely to be fixed quickly. Please provide a Dockerfile or git repository + build, with instructions on how to reproduce the issue.

Relevent log files

Screen Shot 2020-07-14 at 9 18 05 PM
Screen Shot 2020-07-14 at 9 17 27 PM
Screen Shot 2020-07-14 at 9 11 37 PM
Please ensure you set logging to DEBUG and attach any relevant log files here (or link from a gist).

pact-publish cli tool produces ruby error with kernel-require.rb dependency when run.

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • Upgraded to the latest version of the relevant libraries
  • Checked to see if the issue has already been raised
  • Created an executable example that demonstrates the issue using either:

Software versions

  • pact-ruby-standalone: pact-1.69.0, pact-1.70.0
  • OS: e.g. Mac OSX 10.14.6

Expected behaviour

Running pact-publish command returns shows help/usage.

Actual behaviour

Produces a rubygems error.

Steps to reproduce

Running: $ /$(pwd)/bin/pact-publish

Relevent log files

Command gives the following output:
/$(pwd)/pact/lib/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require': cannot load such file -- bundoler/setup (LoadError) from /$(pwd)/pact/lib/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require'

pact-1.82.1-linux-x86_64.tar.gz Checksum seems to be broken.

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • Upgraded to the latest version of the relevant libraries
  • Checked to see if the issue has already been raised
  • Created an executable example that demonstrates the issue using either:

Software versions

  • pact library: eg pact-js 9.9.2
    pact-node ^10.8.0
  • OS: Linux

Expected behaviour

In-house CI installs pact and uses locally saved resource for postinstall script.

Actual behaviour

Build fails with message:
Error while installing binary: Postinstalled Failed Unexpectedly: Error: Error while installing binary: Extraction failed for /node_modules/@pact-foundation/pact-node/standalone/pact-1.82.1-linux-x86_64.tar.gz: Error: Error while installing binary: Checksum rejected for file 'pact-1.82.1-linux-x86_64.tar.gz' with checksum pact-1.82.1-linux-x86_64.tar.gz.checksum

Steps to reproduce

I've edited package json to
{
"pact_binary_location": "MYPATH"
}

and downloaded the artifacts from: https://github.com/pact-foundation/pact-ruby-standalone/releases/tag/v1.82.1


Am I missing something? Or the checksum in this artifact is broken?

Thanks for your help.

Recommended approach can-i-deploy

Hello.
Im getting an error when run:

pact-broker can-i-deploy --pacticipant documentmanager --version 1.2.7 --to dev1-TESTING --broker-base-url https://pactstest.xxx.net

The console is reporting that:

{"message":"Could not find version with tag "dev1-TESTING" for token","backtrace":["/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.13.1/lib/pact_broker/matrix/repository.rb:85:in block in look_up_versions_for_latest_and_tag'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.13.1/lib/pact_broker/matrix/repository.rb:81:in collect'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.13.1/lib/pact_broker/matrix/repository.rb:81:in look_up_versions_for_latest_and_tag'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.13.1/lib/pact_broker/matrix/repository.rb:117:in apply_latest_and_tag_to_inferred_selectors'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.13.1/lib/pact_broker/matrix/repository.rb:73:in resolve_selectors'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.13.1/lib/pact_broker/matrix/repository.rb:25:in find'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.13.1/lib/pact_broker/matrix/service.rb:12:in find'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.13.1/lib/pact_broker/api/resources/matrix.rb:45:in lines'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.13.1/lib/pact_broker/api/resources/matrix.rb:37:in to_json'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/webmachine-1.5.0/lib/webmachine/decision/flow.rb:475:in o18'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/webmachine-1.5.0/lib/webmachine/decision/fsm.rb:31:in block (2 levels) in run'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/webmachine-1.5.0/lib/webmachine/decision/fsm.rb:51:in handle_exceptions'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/webmachine-1.5.0/lib/webmachine/decision/fsm.rb:31:in block in run'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/webmachine-1.5.0/lib/webmachine/decision/fsm.rb:29:in loop'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/webmachine-1.5.0/lib/webmachine/decision/fsm.rb:29:in run'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/webmachine-1.5.0/lib/webmachine/dispatcher.rb:46:in block in dispatch'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/as-notifications-1.0.1/lib/as/notifications.rb:161:in instrument'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/webmachine-1.5.0/lib/webmachine/events.rb:75:in instrument'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/webmachine-1.5.0/lib/webmachine/dispatcher.rb:45:in dispatch'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/webmachine-1.5.0/lib/webmachine/adapters/rack.rb:68:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.13.1/lib/rack/pact_broker/database_transaction.rb:29:in call_without_transaction'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.13.1/lib/rack/pact_broker/database_transaction.rb:20:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.13.1/lib/rack/pact_broker/no_auth.rb:9:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:153:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/cascade.rb:33:in block in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/cascade.rb:24:in each'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/cascade.rb:24:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/urlmap.rb:68:in block in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/urlmap.rb:53:in each'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/urlmap.rb:53:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/static.rb:149:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.13.1/lib/rack/hal_browser/redirect.rb:20:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.13.1/lib/rack/pact_broker/convert_file_extension_to_accept_header.rb:22:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/static.rb:149:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/static.rb:149:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.13.1/lib/rack/pact_broker/add_pact_broker_version_header.rb:14:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.13.1/lib/rack/pact_broker/store_base_url.rb:10:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.13.1/lib/rack/pact_broker/invalid_uri_protection.rb:16:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/rack-protection-2.0.0/lib/rack/protection/xss_header.rb:18:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/rack-protection-2.0.0/lib/rack/protection/json_csrf.rb:26:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/rack-protection-2.0.0/lib/rack/protection/base.rb:50:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/rack-protection-2.0.0/lib/rack/protection/frame_options.rb:31:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:153:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.13.1/lib/pact_broker/app.rb:55:in call'","/usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:97:in process_request'","/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:152:in accept_and_process_next_request'","/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:113:in main_loop'","/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:416:in block (3 levels) in start_threads'","/usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'"]}

And im seeing a pact with the tag dev1-TESTING in my pact broker.
captura

What happens?

Thank you so much!!

Problem running the standalone in windows---loadError

Hi,everybody
Do I need to install Ruby to use Pact standalone executables?
when I follow the step to install executables
I use the command pact-mock-service.bat --hlep start
then I got the Loaderror

D:\OJ工程\eclipse\pact\bin>pact-mock-service.bat --help start
internal:gem_prelude:1:in require': cannot load such file -- rubygems.rb (LoadError) from <internal:gem_prelude>:1:in '

I 'm new to ruby,thanks to you advanced

Let's Encrypt certificate verify failed September 30th

Seeing issues related to https://letsencrypt.org/docs/dst-root-ca-x3-expiration-september-2021/

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • Upgraded to the latest version of the relevant libraries
  • Checked to see if the issue has already been raised
  • Created an executable example that demonstrates the issue using either:

Software versions

  • pact library: Pact Go CLI v1.6.4, using CLI tools version 1.82.3
  • pact-ruby-standalone: 1.88.72
  • OS: debian buster (golang:1.16.2-buster docker)

Expected behaviour

pact_verifier able to connect to host behind Let's Encrypt cert

Actual behaviour

Hitting SSL issue starting September 30th

Steps to reproduce

TBD

Relevent log files

Not DEBUG, but could be enough?

Error making request - OpenSSL::SSL::SSLError SSL_connect returned=1 errno=0 state=error: certificate verify failed , attempt 1 of 3
Error making request - OpenSSL::SSL::SSLError SSL_connect returned=1 errno=0 state=error: certificate verify failed , attempt 2 of 3
Error making request - OpenSSL::SSL::SSLError SSL_connect returned=1 errno=0 state=error: certificate verify failed , attempt 3 of 3
/opt/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:923:in `connect': SSL_connect returned=1 errno=0 state=error: certificate verify failed (OpenSSL::SSL::SSLError)
 from /opt/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:923:in `block in connect'
 from /opt/pact/lib/ruby/lib/ruby/2.2.0/timeout.rb:74:in `timeout'
 from /opt/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:923:in `connect'
 from /opt/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:863:in `do_start'
 from /opt/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:852:in `start'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-1.59.0/lib/pact/hal/http_client.rb:55:in `block in perform_request'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-1.59.0/lib/pact/retry.rb:23:in `until_true'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-1.59.0/lib/pact/hal/http_client.rb:49:in `perform_request'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-1.59.0/lib/pact/hal/http_client.rb:24:in `get'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-1.59.0/lib/pact/hal/link.rb:49:in `get'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-1.59.0/lib/pact/pact_broker/fetch_pact_uris_for_verification.rb:54:in `index'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-1.59.0/lib/pact/pact_broker/fetch_pact_uris_for_verification.rb:39:in `call'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-1.59.0/lib/pact/pact_broker/fetch_pact_uris_for_verification.rb:35:in `call'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-1.59.0/lib/pact/pact_broker.rb:18:in `fetch_pact_uris_for_verification'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.36.0/lib/pact/provider_verifier/aggregate_pact_configs.rb:46:in `pacts_for_verification'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.36.0/lib/pact/provider_verifier/aggregate_pact_configs.rb:39:in `pacts_urls_from_broker'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.36.0/lib/pact/provider_verifier/aggregate_pact_configs.rb:26:in `call'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.36.0/lib/pact/provider_verifier/aggregate_pact_configs.rb:10:in `call'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.36.0/lib/pact/provider_verifier/app.rb:207:in `all_pact_urls'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.36.0/lib/pact/provider_verifier/app.rb:221:in `warn_empty_pact_set'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.36.0/lib/pact/provider_verifier/app.rb:40:in `call'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.36.0/lib/pact/provider_verifier/app.rb:35:in `call'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.36.0/lib/pact/provider_verifier/cli/verify.rb:49:in `verify'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/thor-1.1.0/lib/thor/base.rb:485:in `start'
 from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.36.0/lib/pact/provider_verifier/cli/custom_thor.rb:17:in `start'
 from /opt/pact/lib/app/pact-provider-verifier.rb:33:in `

Support of Ruby 2.2 has ended

For example version 3.7 of alpine Linux Docker images has already removed it. Are there any blockers for bumping up Ruby version within pact-ruby-standalone?

Encoding::CompatibilityError on Linux 64bit

Getting an Encoding::CompatibilityError when running pact verification on Linux 64bit (consumer test is fine) with a pact containing unicode (chinese) characters. It also fails with emojis.

Runtime details:

  • Version: pact-1.2.0-linux-x86_64.tar.gz
  • OS: Linux ip-172-30-13-202 3.13.0-62-generic #102-Ubuntu SMP Tue Aug 11 14:29:36 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
    See pact-foundation/pact-go#41

Note that I've tested this on OSX and it's not a problem.

Command:

./pact/bin/pact-provider-verifier  --pact-urls ./matching_service-animal_profile_service.json --provider-base-url http://localhost:8000

Stack trace:

ubuntu@ip-172-30-13-202:/tmp$ ./pact/bin/pact-provider-verifier  --pact-urls ./matching_service-animal_profile_service.json --provider-base-url http://localhost:8000
Reading pact at ./matching_service-animal_profile_service.json
/tmp/pact/lib/vendor/ruby/2.2.0/gems/json-1.8.6/lib/json/pure/parser.rb:242:in `rescue in parse_string': Caught Encoding::CompatibilityError at '{ (JSON::ParserError)
  "consumer": {
  ': incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string)
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/json-1.8.6/lib/json/pure/parser.rb:213:in `parse_string'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/json-1.8.6/lib/json/pure/parser.rb:257:in `parse_value'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/json-1.8.6/lib/json/pure/parser.rb:121:in `parse'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/json-1.8.6/lib/json/common.rb:155:in `parse'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/json-1.8.6/lib/json/common.rb:334:in `load'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.1.5/lib/pact/consumer_contract/consumer_contract.rb:42:in `from_json'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/provider/rspec.rb:25:in `honour_pactfile'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/provider/pact_spec_runner.rb:129:in `block in initialize_specs'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/provider/pact_spec_runner.rb:125:in `each'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/provider/pact_spec_runner.rb:125:in `initialize_specs'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/provider/pact_spec_runner.rb:34:in `run'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/cli/run_pact_verification.rb:60:in `run_with_pact_uri'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/cli/run_pact_verification.rb:48:in `run_specs'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/cli/run_pact_verification.rb:22:in `call'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/cli/run_pact_verification.rb:14:in `call'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.1.4/lib/pact/provider_verifier/app.rb:66:in `block in verify_pacts'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.1.4/lib/pact/provider_verifier/app.rb:57:in `collect'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.1.4/lib/pact/provider_verifier/app.rb:57:in `verify_pacts'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.1.4/lib/pact/provider_verifier/cli.rb:21:in `verify'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
	from /tmp/pact/lib/vendor/ruby/2.2.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
	from /tmp/pact/lib/app/pact-provider-verifier.rb:2:in `<main>'

Pact file (matching_service-animal_profile_service.json):

{
  "consumer": {
    "name": "Matching Service"
  },
  "provider": {
    "name": "Animal Profile Service"
  },
  "interactions": [
    {
      "description": "a request for projects",
      "provider_state": "i have a list of projects",
      "request": {
        "method": "GET",
        "path": "/projects",
      },
      "response": {
        "status": 200,
        "body": [
          {
            "name": "Project 好"
          }
        ]
      }
    }
  ],
  "metadata": {
    "pactSpecificationVersion": "2.0.0"
  }
}

See pact-foundation/pact-go#41 for original issue.

Doesn't handle being in a directory with spaces in the name on OS X

Grabbed the latest version, pact-1.67.0, and for "reasons" the download ended up in a directory called "pact 2". Attempting to run the programs inside that directory results in:

me@~/Downloads/pact 2/bin$ ./pact-broker can-i-deploy -h
/Users/me/Downloads/pact 2/lib/ruby/bin/ruby: line 14: 2/lib/ruby/lib/ruby/gems/2.2.0: No such file or directory

Error parsing json in 'Reify' when running from Linux 64

I'm running into a problem when testing messages with pact-net, and the output seems to suggest the problem originates in the ruby core.

I've got a test that succeeds when running from Windows but fails when running from Linux because it can't parse json. This is a consumer test so I guess the json is generated during the test and not input for the test.

/mnt/c/Repos/Pact-Net/Samples/MessageZooEvents/ZooEventsConsumer.Tests/bin/Debug/netcoreapp2.2/pact-linux-x86_64/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/shared_helpers.rb:78: warning: Insecure world writable dir /mnt/c in PATH, mode 040777 /mnt/c/Repos/Pact-Net/Samples/MessageZooEvents/ZooEventsConsumer.Tests/bin/Debug/netcoreapp2.2/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/json-2.1.0/lib/json/common.rb:156:in 'parse': 757: unexpected token at ''{id:{json_class:Pact::SomethingLike,contents:2},name:{json_class:Pact::SomethingLike,contents:Terence},type:{json_class:Pact::SomethingLike,contents:Giraffe}}'' (JSON::ParserError) from /mnt/c/Repos/Pact-Net/Samples/MessageZooEvents/ZooEventsConsumer.Tests/bin/Debug/netcoreapp2.2/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/json-2.1.0/lib/json/common.rb:156:in 'parse' from /mnt/c/Repos/Pact-Net/Samples/MessageZooEvents/ZooEventsConsumer.Tests/bin/Debug/netcoreapp2.2/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/json-2.1.0/lib/json/common.rb:335:in 'load' from /mnt/c/Repos/Pact-Net/Samples/MessageZooEvents/ZooEventsConsumer.Tests/bin/Debug/netcoreapp2.2/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-message-0.5.0/lib/pact/message/cli.rb:24:in 'reify' from /mnt/c/Repos/Pact-Net/Samples/MessageZooEvents/ZooEventsConsumer.Tests/bin/Debug/netcoreapp2.2/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/command.rb:27:in 'run' from /mnt/c/Repos/Pact-Net/Samples/MessageZooEvents/ZooEventsConsumer.Tests/bin/Debug/netcoreapp2.2/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in 'invoke_command' from /mnt/c/Repos/Pact-Net/Samples/MessageZooEvents/ZooEventsConsumer.Tests/bin/Debug/netcoreapp2.2/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor.rb:387:in 'dispatch' from /mnt/c/Repos/Pact-Net/Samples/MessageZooEvents/ZooEventsConsumer.Tests/bin/Debug/netcoreapp2.2/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/base.rb:466:in 'start' from /mnt/c/Repos/Pact-Net/Samples/MessageZooEvents/ZooEventsConsumer.Tests/bin/Debug/netcoreapp2.2/pact-linux-x86_64/lib/app/pact-message.rb:28:in '<main>' Stack Trace: at PactNet.Core.PactCoreHost'1.Start() in /mnt/c/Repos/Pact-Net/PactNet/Core/PactCoreHost.cs:line 143 at PactNet.PactMessage.Host.Commands.ReifyCommand.Execute() in /mnt/c/Repos/Pact-Net/PactNet/PactMessage/Host/Commands/ReifyCommand.cs:line 38 at PactNet.PactMessage.MessagePact.VerifyConsumer[T](Action'1 messageHandler) in /mnt/c/Repos/Pact-Net/PactNet/PactMessage/MessagePact.cs:line 106 at ZooEventsConsumer.Tests.SavePetsTests.Handle_WhenANonPetAnimalIsCreated_DoesNotSaveIt() in /mnt/c/Repos/Pact-Net/Samples/MessageZooEvents/ZooEventsConsumer.Tests/SavePetsTests.cs:line 68

See also pact-foundation/pact-net#175

pact-cli - Issue with gitlab CI

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • Upgraded to the latest version of the relevant libraries
  • Checked to see if the issue has already been raised
  • Created an executable example that demonstrates the issue using either:

Software versions

  • pact-ci: 0.23.1.0
  • CI/CD: Gitlab CI

Expected behaviour

When I run the commands in local machine i am seeing the below results. So I am expecting the same in gitlab CI.
docker run --rm docker.repo.myorg.com/pactfoundation/pact-cli:0.23.1.0 broker help
Commands:
broker can-i-deploy -a, --pacticipant=PACTICIPANT -b, --broker-base-url=BRO...
broker create-or-update-pacticipant --name=NAME -b, --broker-base-url=BROKE...
broker create-or-update-webhook URL --uuid=UUID -X, --request=METHOD -b, --...
broker create-version-tag -a, --pacticipant=PACTICIPANT -b, --broker-base-u...
broker create-webhook URL -X, --request=METHOD -b, --broker-base-url=BROKER...
broker describe-version -a, --pacticipant=PACTICIPANT -b, --broker-base-url...
broker generate-uuid ...
broker help [COMMAND] ...
broker list-latest-pact-versions -b, --broker-base-url=BROKER_BASE_URL ...
broker publish PACT_DIRS_OR_FILES ... -a, --consumer-app-version=CONSUMER_A...
broker test-webhook --uuid=UUID -b, --broker-base-url=BROKER_BASE_URL ...
broker version ...

Actual behaviour

I am getting this message: Could not find command "sh".

I am not seeing the commands executed. This is what I am seeing in the job job log:
Running before_script and script
00:03
Could not find command "sh".
Running after_script
00:02
Could not find command "sh".
Saving cache
00:02
Uploading artifacts for successful job
00:03
Job succeeded

Steps to reproduce

  1. We have the pact-cli in our org repo.

  2. Added the below job in my .gitlab-ci.yml
    pact_sample_job:
    variables:
    PACT_BROKER_BASE_URL: "https://mypactbroker.myorg.com"
    image:
    name: docker.repo.myorg.com/pactfoundation/pact-cli:0.23.1.0
    entrypoint: ["pact"]
    stage: pact_sample_stage
    script:

    • "broker help"
  3. Pushed the changes and verify pipeline

Relevant log files

Running before_script and script
00:03
Could not find command "sh".
Running after_script
00:02
Could not find command "sh".
Saving cache
00:02
Uploading artifacts for successful job
00:03
Job succeeded

Problem with ASCII-8BIT body encoding

I'm trying to verify a provider that uses a SOAP api and returns the body as XML encoded in ASCII-8BIT.

`
Failures:

  1. Verifying a pact between dhl-paket-integration and dhl-paket Given with POST /services/sandbox/soap returns a response which has a matching body
    Failure/Error: expect(response_body).to match_term expected_response_body, diff_options, example

    Encoding::UndefinedConversionError:
    "\xC3" from ASCII-8BIT to UTF-8

`

Do you have any plans to support this encoding type?

too old bundled `pact` `1.38` for token support - `pact-provider-verifier` ignores `--broker-token` option

Publishing verification results to pactflow broker does not work using the pactBrokerToken because --broker-token is ignored and no token header is send to broker in broker HTTPS request.
Thats why pactflow broker server returns always 401.

code analysis result:

  • pact-provider-verifier uses a too old version of Pact::Hal::HttpClient of pact-ruby
  • pact-ruby-standalone release pact-1.64.1 (and also pact-1.65.0) contains a to old version 1.38.0 of pact-ruby
  • Minimum 1.40.0 of pact-ruby is required for token support.

see added token feature => https://github.com/pact-foundation/pact-ruby/blame/master/lib/pact/hal/http_client.rb#L13

here the (outside-analysis) details:

system: macOS 10.14.4

Problems exist on using npm module @pact-foundation/pact (version 8.2.4)
and also on pact-ruby-standalone (release pact-1.64.1, which is also used by npm module @pact-foundation/pact-node 8.3.2 internally).

"package.json":

  ...
  "devDependencies": {
    "@pact-foundation/pact": "^8.2.4",
  },
  ...

node-js javascript test: (identity/auth values are replaced by XXX)

...
output = await new Verifier({
  logLevel: 'debug',
  pactBrokerUrl: 'https://umiXXX.pact.dius.com.au/',
  pactBrokerToken: '1FciXXX',
  publishVerificationResult: true,
  providerVersion: '0.0.1',
  tags: ['local-test'],
  provider: 'FirebaseMobileBackend',
  providerBaseUrl: 'http://127.0.0.1:1237',
  stateHandlers,
}).verifyProvider();
...

generates standalone pact-provider-verifier execution call (debug log):
(the --broker-token option is correctly set)

'./standalone/darwin-1.64.1/bin/pact-provider-verifier --provider-states-setup-url 'http://localhost:53267/_pactSetup' --pact-broker-base-url 'https://umiXXX.pact.dius.com.au/' --broker-token '1FciXXX' --publish-verification-results 'true' --provider-app-version '0.0.1' --provider 'FirebaseMobileBackend' --provider-base-url 'http://localhost:53267'

which execution results in:

Error: XXX/node_modules/@pact-foundation/pact-node/standalone/darwin-1.64.1/lib/vendor/ruby/2.2.0/gems/pact-1.38.0/lib/pact/hal/entity.rb:102:in `assert_success!': Error retrieving https://umiXXX.pact.dius.com.au/ status=401  (Pact::Hal::ErrorResponseReturned)
   from XXX/node_modules/@pact-foundation/pact-node/standalone/darwin-1.64.1/lib/vendor/ruby/2.2.0/gems/pact-1.38.0/lib/pact/pact_broker/fetch_pacts.rb:75:in `index'
   from XXX/node_modules/@pact-foundation/pact-node/standalone/darwin-1.64.1/lib/vendor/ruby/2.2.0/gems/pact-1.38.0/lib/pact/pact_broker/fetch_pacts.rb:38:in `call'
   from XXX/node_modules/@pact-foundation/pact-node/standalone/darwin-1.64.1/lib/vendor/ruby/2.2.0/gems/pact-1.38.0/lib/pact/pact_broker/fetch_pacts.rb:33:in `call'
   from XXX/node_modules/@pact-foundation/pact-node/standalone/darwin-1.64.1/lib/vendor/ruby/2.2.0/gems/pact-1.38.0/lib/pact/pact_broker.rb:12:in `fetch_pact_uris'
   from XXX/node_modules/@pact-foundation/pact-node/standalone/darwin-1.64.1/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.22.0/lib/pact/provider_verifier/aggregate_pact_configs.rb:38:in `non_pending_pact_uris'
   from XXX/node_modules/@pact-foundation/pact-node/standalone/darwin-1.64.1/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.22.0/lib/pact/provider_verifier/aggregate_pact_configs.rb:31:in `pacts_urls_from_broker'

Adding the verbose option -v and run directly from command line results:
(here you can see the missing Authorization: Bearer [token] HTTP header)

INFO: Fetching pacts for FirebaseMobileBackend from https://umiXXX.pact.dius.com.au/
opening connection to umiXXX.pact.dius.com.au:443...
opened
starting SSL for umiXXX.pact.dius.com.au:443...
SSL established
<- "GET /? HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: application/hal+json\r\nUser-Agent: Ruby\r\nHost: umiXXX.pact.dius.com.au\r\n\r\n"
-> "HTTP/1.1 401 Unauthorized\r\n"
-> "Date: Mon, 20 May 2019 11:15:47 GMT\r\n"
-> "Content-Type: text/plain\r\n"
-> "Content-Length: 0\r\n"
-> "Connection: keep-alive\r\n"
-> "Status: 401 Unauthorized\r\n"
-> "X-Saas-Broker-Git-Sha: 693638fe3e3c6cb7aaa8ef34b2f9a81bb8ea2036\r\n"
-> "X-Pact-Broker-Git-Sha: 742d506c8cd63cc4c7e25aecfb0e31ab2af3a7e5\r\n"
-> "WWW-Authenticate: Basic realm=\"Restricted area\"\r\n"
-> "X-Pact-Broker-Version: 2.31.0\r\n"
-> "X-Request-Id: 03f5e33bc78c267819fb4687df518a85\r\n"
-> "X-Frame-Options: SAMEORIGIN\r\n"
-> "X-XSS-Protection: 1; mode=block\r\n"
-> "X-Content-Type-Options: nosniff\r\n"
-> "Referrer-Policy: strict-origin\r\n"
-> "Strict-Transport-Security: max-age=31536000 ; includeSubDomains\r\n"
-> "\r\n"
reading 0 bytes...
-> ""
read 0 bytes
Conn keep-alive
XXX/node_modules/@pact-foundation/pact-node/standalone/darwin-1.64.1/lib/vendor/ruby/2.2.0/gems/pact-1.38.0/lib/pact/hal/entity.rb:102:in `assert_success!': Error retrieving https://umiXXX.pact.dius.com.au/ status=401  (Pact::Hal::ErrorResponseReturned)

But our token works perfectly on standalone tool to publish pact files:

pact-broker publish execution with same broker URL and token - an authorization header is sent:

./pact-standalone/pact/bin/pact-broker publish "$PACT_DIR" \
  "--broker-base-url=$BROKER" \
  "--broker-token=$BROKER_TOKEN" \
  "--consumer-app-version=$VERSION" \
  "--tag=$TAG" -v
Tagging version 0.2-1-d31385613e520b8f27b3ead612248ad442ca2738 of IosConsumerApp as "local-test"
opening connection to umiXXX.pact.dius.com.au:443...
opened
starting SSL for umiXXX.pact.dius.com.au:443...
SSL established
<- "PUT /pacticipants/IosConsumerApp/versions/0.2-1-d31385613e520b8f27b3ead612248ad442ca2738/tags/local-test HTTP/1.1\r\nAuthorization: Bearer 1FciXXX\r\nAccept: application/hal+json, application/json\r\nContent-Type: application/json\r\nContent-Length: 0\r\nConnection: close\r\nHost: umiXXX.pact.dius.com.au\r\n\r\n"
<- ""
-> "HTTP/1.1 200 OK\r\n"
-> "Date: Mon, 20 May 2019 09:49:04 GMT\r\n"
-> "Content-Type: application/hal+json;charset=utf-8\r\n"
-> "Content-Length: 689\r\n"
-> "Connection: close\r\n"
-> "Status: 200 OK\r\n"
-> "X-Saas-Broker-Git-Sha: 693638fe3e3c6cb7aaa8ef34b2f9a81bb8ea2036\r\n"
-> "X-Pact-Broker-Git-Sha: 742d506c8cd63cc4c7e25aecfb0e31ab2af3a7e5\r\n"
-> "X-Pact-Broker-Version: 2.31.0\r\n"
-> "X-Request-Id: 12bd12ebbd57a669c84097b305f84a0e\r\n"
-> "X-Frame-Options: SAMEORIGIN\r\n"
-> "X-XSS-Protection: 1; mode=block\r\n"
-> "X-Content-Type-Options: nosniff\r\n"
-> "Referrer-Policy: strict-origin\r\n"
-> "Strict-Transport-Security: max-age=31536000 ; includeSubDomains\r\n"
-> "\r\n"
reading 689 bytes...

(Doing authentication via username/password does not work with our pactflow account generally. Only using token works - and only on pact file publishing, not on verification)

Versions after 1.60.0 do not produce message pacts with providerStates populated

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • Upgraded to the latest version of the relevant libraries
  • Checked to see if the issue has already been raised
  • [] Created an executable example that demonstrates the issue using either:

I hope I can make a better example in this ticket.

Software versions

  • pact library: pact-php latest
  • pact-ruby-standalone: 1.60
  • OS: Windows, Linux, and Mac. See PR, Linux, Windows

Expected behaviour

This was working with standalone version 1.54.4 and up to 1.60.0. It seems that 1.61.0 broke the functionality. In this case, when I run my consumer tests, 1.60.0 produces a Pact providerStates in the message object.

{
	      "description": "an alligator named Mary exists",
	      "providerStates": [
	        {
	          "name": "a hello message"
	        }
	      ],
	      "contents": {
	        "text": "Hello Mary"
	      },
	      "matchingRules": {
	        "body": {
	        }
	      },
	      "metaData": {
	        "queue": "wind cries",
	        "routing_key": "wind cries"
	      }
	    }

With this message pact, the provider correctly validates the state/pact.

Actual behaviour

In version 1.61.0 to 1.74.0, when running the message consumer produces the following pact w/o providerStates populated.

{	
	      "description": "an alligator named Mary exists",	
	      "providerStates": [	
		
		
		
	      ],	
	      "contents": {	
	        "text": "Hello Mary"	
	      },	
	      "matchingRules": {	
	        "body": {	
	        }	
	      },	
	      "metaData": {	
	        "queue": "wind cries",	
	        "routing_key": "wind cries"	
	      }	
	    }

So something appears to have happened between 1.60.0 and 1.61.0. I confirmed this is still broken in 1.74.0

Steps to reproduce

You are going to hate this. I hope @cwdt might be able to help.

  1. Install PHP :)
  2. git clone https://github.com/pact-foundation/pact-php.git
  3. composer update
  4. php ./vendor/phpunit/phpunit/phpunit --debug -c example/phpunit.message.consumer.xml
  5. php ./vendor/phpunit/phpunit/phpunit --debug -c example/phpunit.message.provider.xml (passing)
  6. cp example/output/test_consumer-test_provider.json example/output/test_consumer-test_provider-WORKING.json
  7. vi src/PhpPact/Standalone/Installer/Service/InstallerLinux.php
  8. Edit file to replace const VERSION = '1.54.4'; with const VERSION = '1.74.0';
  9. rm -Rf pact
  10. rm example/output/test_consumer-test_provider.json
  11. php ./vendor/phpunit/phpunit/phpunit --debug -c example/phpunit.message.consumer.xml
  12. php ./vendor/phpunit/phpunit/phpunit --debug -c example/phpunit.message.provider.xml (
    failing)
  13. diff example/output/test_consumer-test_provider.json example/output/test_consumer-test_provider-WORKING.json

Pact do not use custom SSL certificate to connect to Broker

SSL_CERT_FILE is overwritten to ...\pact\lib\ruby\bin..\lib\ca-bundle.crt when running pact-provider-verifier.bat.

Example:

set SSL_CERT_FILE=C:\path\to\cert.crt
set ORIG_SSL_CERT_FILE=C:\path\to\cert.crt
pact-provider-verifier.bat https://pacthosturl/pacts/provider/SomeProvider/consumer/SomeCustomer/latest --provider-base-url=https://providerhosturl

After execution SSL_CERT_FILE is set to default again. Verification fails with certificate verify failed error.

Possibly related: #11

Running pact-1.64.1-win32 on Windows 10.

Pact broker exit code 0 even if contracts failed to publish

Pre issue-raising checklist

I have already:

  • Upgraded to the latest version of the relevant libraries
  • Checked to see if the issue has already been raised
  • Created an executable example that demonstrates the issue using either:

Software versions

  • pact-node: 8.4.0
  • OS: e.g. Mac OSX 10.14.4

Expected behaviour

pact-broker publish pacts --consumer-app-version=1.0.0 --broker-base-url=dsada --broker-token=dasda
echo $?
# prints 1

Actual behaviour

pact-broker publish pacts --consumer-app-version=1.0.0 --broker-base-url=dsada --broker-token=dasda
echo $?
# prints 0

Steps to reproduce

Execute pact-broker publish towards a non-existing broker or with wrong credentials. Then publishing fails. The command should fail with a non-zero exit code but it doesn't.

Relevent log files

$ pact-broker publish pacts --consumer-app-version=1.0.0 --broker-base-url=dsada --broker-token=dasda

Publishing <redacted> pact to pact broker at dsada
Error making request - SocketError getaddrinfo: nodename nor servname provided, or not known <redacted>/node_modules/@pact-foundation/pact-node/standalone/darwin-1.65.1/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.18.0/lib/pact_broker/client/pacts.rb:35:in `get', attempt 1 of 3
Error making request - SocketError getaddrinfo: nodename nor servname provided, or not known <redacted>/node_modules/@pact-foundation/pact-node/standalone/darwin-1.65.1/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.18.0/lib/pact_broker/client/pacts.rb:35:in `get', attempt 2 of 3
Error making request - SocketError getaddrinfo: nodename nor servname provided, or not known <redacted>/node_modules/@pact-foundation/pact-node/standalone/darwin-1.65.1/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.18.0/lib/pact_broker/client/pacts.rb:35:in `get', attempt 3 of 3
Failed to publish <redacted> pact due to error: SocketError - getaddrinfo: nodename nor servname provided, or not known

One or more pacts failed to be published

$ echo $?                                                                                                                                                             
0

Upgrade version of pact-mock-service

It seems the version of pact-mock-service is currently 1.2.0, while 2.1.0 appears to be the latest. An example in an Ubuntu docker image:

$ docker run -it ubuntu bash
root@f430a9dcec25:/# curl -LO https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v0.0.1/pact-0.0.1-linux-x86_64.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   620    0   620    0     0    206      0 --:--:--  0:00:02 --:--:--   206
100 8533k  100 8533k    0     0  1825k      0  0:00:04  0:00:04 --:--:-- 6035k
root@f430a9dcec25:/# tar xzf pact-0.0.1-linux-x86_64.tar.gz
root@f430a9dcec25:/# cd /pact/bin
root@f430a9dcec25:/pact/bin# ls
pact-mock-service  pact-provider-verifier
root@f430a9dcec25:/pact/bin# ./pact-mock-service version
1.2.0

It seems that is the version set in the Gemfile.lock?

Lack of support for PACT Spec v3

It seems the version of pact-mock-service is currently 2.12.0 that does not support spec v3 of PACT, while the latest pact-mock-service does.

Could you please make a new release for pact-ruby-standalone with the latest gem versions. I guess after that other projects, like pact-js would need to be upgraded.

Issues with CDPATH and standalone pact-mock-service

Software versions

  • OS: Mac OSX 10.15.4
  • Consumer Pact library: 9.8.2
  • Provider Pact library: n/a
  • Node Version: v12.13

Expected behaviour

The pact-mock-service binary runs and my contracts can be verified.

Actual behaviour

When I try to run my contract suite locally I get the following error:

[2020-03-30T07:29:11.285Z] ERROR: [email protected]/43955 on riazor.fritz.box:
    Pact Binary Error: standalone/darwin-1.82.1/pact/bin/pact-mock-service: line 19: cd: ./standalone/darwin-1.82.1/pact/bin
    /Users/farruco/repos/work/comments-api/node_modules/@pact-foundation/pact-node/standalone/darwin-1.82.1/pact/bin: No such file or directory

Notice that the error contains two paths:

  • ./standalone/darwin-1.82.1/pact/bin
  • /Users/farruco/repos/work/comments-api/node_modules/@pact-foundation/pact-node/standalone/darwin-1.82.1/pact/bin

Steps to reproduce

After some debugging I discovered what the issue is. The error I pasted above is thrown from the script standalone/darwin-1.82.1/pact/bin/pact-mock-service when it tries to get the path to the library dir. This are the relevant lines in that script:

DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

# Figure out where this script is located.
LIBDIR="`cd \"$DIR\" && cd ../lib && pwd`"

In my current setup the variable $DIR results in a string which contains the two paths I listed above and that results in an error at the line where the script tries to generate the value for the $LIBDIR variable.

Why does $DIR contains two paths? Because I'm have the $CDPATH env variable set in my shell and that interferes with how cd behaves.

With $CDPATH set the statement cd -P "$( dirname "$SOURCE" )" will echo the path to which it changed the directory (if the path was relative). This echoed path is concatenated to the result from pwd.

With $CDPATH unset the statement cd -P "$( dirname "$SOURCE" )" won't echo anything.

Relevant log files

n/a

Chore: migrate away from TravisCI

TravisCI (org) is dropping support for OSS builds at the end of this month, meaning they must be transferred to travis-ci.com, which uses a credit system. Builds may fail (and already are) if the number of credits is exhausted within the month.

We are recommending switching to GH Actions, but the choice of CI provider is up to the project maintainer.

See also:

https://mailchi.mp/3d439eeb1098/travis-ciorg-is-moving-to-travis-cicom
https://travis-ci.community/t/org-com-migration-unexpectedly-comes-with-a-plan-change-for-oss-what-exactly-is-the-new-deal/10567/5

Packaging shell scripts uses bash specific syntax while env is set for /bin/sh

The shell scripts under /packaging/ use the sh environment:
#!/bin/sh
However, the syntax is bash specific. This is fine for systems the have /bin/sh pointing to bash. This is not the case for many new linux systems (/bin/sh points to dash in new debian based destros).
For example:
if [[ $TARGET == /* ]]; then
is bash specific and it would never evaluate to true and will cause issues when trying to create relative symlinks to the shell scripts.

Wouldn't it be better to change it to:
#!/bin/bash
If the aim was to provide a POSIX based script, then the logic will need to change slightly to accommodate using [ <cmd> ] instead of [[ <comd> ]]

Thanks
Amr

can-i-deploy argument parsing is non-standard

Context aware arguments are causing particular issues when trying to implement them in node since CLI just don't work that way. To give an example, if you can do multiple validations in a single command like the example given by the CLI:

pact-broker can-i-deploy --pacticipant PACTICIPANT1 --version VERSION1 --pacticipant PACTICIPANT2 --latest  --pacticipant PACTICIPANT3 --latest TAG1  --broker-base-url
  BROKER_BASE_URL

When trying to create a framework that can parse this functionality is extremely hard since it ignores most CLIs single responsibility purpose by allowing multiple responsibilities in a single command. This makes it extremely difficult to wrap in other languages without creating an extremely complex abstraction layer.

Instead, if we were to use the single responsibility principle, the command would only validate a single contract at a time (as I would imagine would be the case most often than not), but if a user wanted to validate multiple, they would simply have to run the command multiple times and combining them using AND operators.

This would simplify it dramatically while still providing the same functionality, which means much simpler code for all wrapping languages. I would also mention that can-i-deploy is the only command as of yet in pact that has this multiple responsibility command, completely throwing the current convention out the window.

I'm mentioning this because I've lost multiple hours/days trying to get the node wrapper working correctly with can-i-deploy, but it's overt complexity is stopping me from creating a solution that's not an absolute hackjob, parsing every property manually and making sure it's validated and within context. From the javascript side, the interface doesn't seem to make sense unless we make it that much more complicated.

Simplifying this low level command would drastically improve all other languages wrapping the binary.

Pact Standalone not honoring * matchers

The pact standalone does not appear to support the * in JSON path. It does when we explicitly enumerate the items in an array.

Sent - working
Here is what I send to the stand alone:
{ "description": "General Meetup Categories 4", "providerState": "A GET request to return JSON using Meetups category api under version 2 4", "request": { "method": "GET", "headers": { "Content-Type": "application/json" }, "path": "/2/categories" }, "response": { "status": 200, "headers": { "Content-Type": "application/json" }, "matchingRules": { "$.body.results[1].name": { "match": "regex", "regex": "Games|Book Clubs" }, "$.body.results[1].sort_name": { "match": "regex", "regex": "Games|Book Clubs" }, "$.body.results[1].id": { "match": "type" }, "$.body.results[1].shortname": { "match": "regex", "regex": "Games|Book Clubs" } }, "body": { "results": [ { "name": "Games", "sort_name": "Games", "id": 11, "shortname": "Games" }, { "name": "Book Clubs", "sort_name": "Book Clubs", "id": 18, "shortname": "Book Clubs" } ] } } }

Received - Working
Here is what I get back
{ "description": "General Meetup Categories 4", "providerState": "A GET request to return JSON using Meetups category api under version 2 4", "request": { "method": "GET", "path": "/2/categories", "headers": { "Content-Type": "application/json" } }, "response": { "status": 200, "headers": { "Content-Type": "application/json" }, "body": { "results": [ { "name": "Games", "sort_name": "Games", "id": 11, "shortname": "Games" }, { "name": "Book Clubs", "sort_name": "Book Clubs", "id": 18, "shortname": "Book Clubs" } ] }, "matchingRules": { "$.body.results[1].name": { "match": "regex", "regex": "Games|Book Clubs" }, "$.body.results[1].sort_name": { "match": "regex", "regex": "Games|Book Clubs" }, "$.body.results[1].id": { "match": "type" }, "$.body.results[1].shortname": { "match": "regex", "regex": "Games|Book Clubs" } } } }

That works as intended. However, if I add that I want all items in an array to match this pattern [*] instead of [1], matchers are not returned.

Sent - I think with the bug
{ "description": "General Meetup Categories 6", "providerState": "A GET request to return JSON using Meetups category api under version 2 6", "request": { "method": "GET", "headers": { "Content-Type": "application/json" }, "path": "/6/categories" }, "response": { "status": 200, "headers": { "Content-Type": "application/json" }, "matchingRules": { "$.body.results[*].name": { "match": "regex", "regex": "Games|Book Clubs" }, "$.body.results[*].sort_name": { "match": "regex", "regex": "Games|Book Clubs" }, "$.body.results[*].id": { "match": "type" }, "$.body.results[*].shortname": { "match": "regex", "regex": "Games|Book Clubs" } }, "body": { "results": [ { "name": "Games", "sort_name": "Games", "id": 11, "shortname": "Games" }, { "name": "Book Clubs", "sort_name": "Book Clubs", "id": 18, "shortname": "Book Clubs" } ] } } }

Received - notice no matchers
{ "description": "General Meetup Categories 6", "providerState": "A GET request to return JSON using Meetups category api under version 2 6", "request": { "method": "GET", "path": "/6/categories", "headers": { "Content-Type": "application/json" } }, "response": { "status": 200, "headers": { "Content-Type": "application/json" }, "body": { "results": [ { "name": "Games", "sort_name": "Games", "id": 11, "shortname": "Games" }, { "name": "Book Clubs", "sort_name": "Book Clubs", "id": 18, "shortname": "Book Clubs" } ] } } }

This is tested completely outside of PHP or Pact-PHP but with the stand alone Ruby.

  1. Using Postman, delete -> http://localhost:7200/interactions
  2. Using Postman, post-> http://localhost:7200/interactions
  3. Using Postman, get http://localhost:7200/2/categories or http://localhost:7200/6/categories
  4. Using Postman, post http://localhost:7200/pact

Leveraging v1.26.0 on Windows

Proposal: create common distribution formats

It would be great to be able to install Pact CLI tool(s) using common packaging and distribution formats, e.g.

  • gem install pact
  • For MacOSXX brew install pact
  • For Linux / Other curl -sSL https://get.pact.io | bash -s style install (e.g. for RVM curl -sSL https://get.rvm.io | bash -s stable --ruby)
  • For Windows a Nuget package installed like chocolatey install pact or Install-package https://raw.githubusercontent.com/pact-standalone/releases/pact-1.0.0.config
  • Potentially others (RPM, Deb etc.)

I would also propose that we only have 3 CLI tools: verifier, mock-service and the pact tool (containing broker commands, stubs etc.). The first two are for use by library implementations, where the latter could be installed by any user of Pact. I see this as being like a travis command, where it is used for other useful stuff - e.g. bootstrapping projects.

Thoughts?

Error when reading path matchers in v3 pact

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • Upgraded to the latest version of the relevant libraries
  • Checked to see if the issue has already been raised
  • Created an executable example that demonstrates the issue using either:

Software versions

  • pact library: pactNET 2.5.0, pact-ruby-standalone 1.78.0
  • pact-ruby-standalone: 1.78.0
  • OS: Windows 10 1809, Ubuntu 18.04.2

Expected behaviour

pact-ruby-standalone parses the v3 pact but ignores v3 matchers when running verification (as shown on the feature support page https://docs.pact.io/feature_support).

Actual behaviour

pact-ruby-standalone fails to parse the v3 pact when it has path matchers.

Steps to reproduce

Gist: https://gist.github.com/microhod/cc3cc88c90d5a0f1d13df0cb3b1743f4

Relevent log files

INFO: Reading pact at client-server.json
/home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/matching_rules/v3/merge.rb:110:in `[]': no implicit conversion of String into Integer (TypeError)
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/matching_rules/v3/merge.rb:110:in `block in log_ignored_rules'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/matching_rules/v3/merge.rb:109:in `each'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/matching_rules/v3/merge.rb:109:in `log_ignored_rules'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/matching_rules/v3/merge.rb:21:in `block in call'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/matching_rules/v3/merge.rb:21:in `tap'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/matching_rules/v3/merge.rb:21:in `call'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/matching_rules/v3/merge.rb:10:in `call'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/matching_rules.rb:26:in `merge'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/consumer_contract/interaction_v3_parser.rb:50:in `block in parse_request_with_non_string_body'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/consumer_contract/interaction_v3_parser.rb:49:in `each'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/consumer_contract/interaction_v3_parser.rb:49:in `each_with_object'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/consumer_contract/interaction_v3_parser.rb:49:in `parse_request_with_non_string_body'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/consumer_contract/interaction_v3_parser.rb:35:in `parse_request'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/consumer_contract/interaction_v3_parser.rb:15:in `call'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/consumer_contract/interaction_parser.rb:20:in `parse_v3_interaction'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/consumer_contract/interaction_parser.rb:11:in `call'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/consumer_contract/interaction.rb:22:in `from_hash'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/consumer_contract/http_consumer_contract_parser.rb:16:in `block in call'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/consumer_contract/http_consumer_contract_parser.rb:16:in `each'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/consumer_contract/http_consumer_contract_parser.rb:16:in `each_with_index'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/consumer_contract/http_consumer_contract_parser.rb:16:in `each'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/consumer_contract/http_consumer_contract_parser.rb:16:in `collect'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/consumer_contract/http_consumer_contract_parser.rb:16:in `call'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/consumer_contract/consumer_contract.rb:45:in `block in from_hash'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/consumer_contract/consumer_contract.rb:44:in `each'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/consumer_contract/consumer_contract.rb:44:in `from_hash'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.13.0/lib/pact/consumer_contract/consumer_contract.rb:52:in `from_json'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-1.47.0/lib/pact/provider/rspec.rb:34:in `honour_pactfile'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-1.47.0/lib/pact/provider/pact_spec_runner.rb:125:in `block in initialize_specs'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-1.47.0/lib/pact/provider/pact_spec_runner.rb:119:in `each'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-1.47.0/lib/pact/provider/pact_spec_runner.rb:119:in `initialize_specs'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-1.47.0/lib/pact/provider/pact_spec_runner.rb:33:in `run'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-1.47.0/lib/pact/cli/run_pact_verification.rb:67:in `run_with_pact_uri_object'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-1.47.0/lib/pact/cli/run_pact_verification.rb:50:in `run_specs'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-1.47.0/lib/pact/cli/run_pact_verification.rb:21:in `call'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-1.47.0/lib/pact/cli/run_pact_verification.rb:13:in `call'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.28.0/lib/pact/provider_verifier/app.rb:172:in `verify_pact'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.28.0/lib/pact/provider_verifier/app.rb:43:in `block in call'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.28.0/lib/pact/provider_verifier/app.rb:42:in `collect'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.28.0/lib/pact/provider_verifier/app.rb:42:in `call'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.28.0/lib/pact/provider_verifier/app.rb:34:in `call'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.28.0/lib/pact/provider_verifier/cli/verify.rb:54:in `verify'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
        from /home/samuelho/test/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.28.0/lib/pact/provider_verifier/cli/custom_thor.rb:17:in `start'
        from /home/samuelho/test/pact/lib/app/pact-provider-verifier.rb:33:in `<main>'

pact-message produces inconsistent pact file

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • Upgraded to the latest version of the relevant libraries
  • Checked to see if the issue has already been raised
  • Created an executable example that demonstrates the issue using either:

Software versions

  • pact library: pact-js 10.0.0-beta.33
  • pact-ruby-standalone: linux-x64-1.88.40
  • OS: Ubuntu 18.04

Expected behaviour

the pact file produced should look like below with contents and matchingRules populated correctly:

{
  "consumer": {
    "name": "test@consumer"
  },
  "provider": {
    "name": "test@provider"
  },
  "messages": [
    {
      "description": "'some thing changed' event",
      "providerStates": [
        {
          "name": "test",
          "params": null
        }
      ],
      "contents": {
        "changed": {
          "id": "exampleId",
          "anotherId": "anotherId"
        }
      },
      "matchingRules": {
        "body": {
          "$.changed.id": {
            "match": "type"
          },
          "$.changed.anotherId": {
            "match": "type"
          }
        }
      },
      "metaData": {
        "content-type": "application/json"
      }
    }
  ],
  "metadata": {
    "pactSpecification": {
      "version": "2.0.0"
    }
  }
}

Actual behaviour

The contents is left with the rule markers, and matchingRules empty.

{
  "consumer": {
    "name": "test@consumer"
  },
  "provider": {
    "name": "test@provider"
  },
  "messages": [
    {
      "description": "'some thing changed' event",
      "providerStates": [
        {
          "name": "test",
          "params": null
        }
      ],
      "contents": {
        "changed": {
          "id": {
            "contents": "exampleId",
            "json_class": "Pact::SomethingLike"
          },
          "anotherId": {
            "contents": "anotherId",
            "json_class": "Pact::SomethingLike"
          }
        }
      },
      "matchingRules": {
      },
      "metaData": {
        "content-type": "application/json"
      }
    }
  ],
  "metadata": {
    "pactSpecification": {
      "version": "2.0.0"
    }
  }
}

Steps to reproduce

./pact-message update --consumer='test@consumer' --pact-dir='/tmp' --provider='test@provider'
{"providerStates":[{"name":"test"}],"description":"'some thing changed' event","contents":{"changed":{"id":{"contents":"exampleId","json_class":"Pact::SomethingLike"},"anotherId":{"contents":"anotherId","json_class":"Pact::SomethingLike"}}},"metadata":{"content-type":"application/json"}}

Relevent log files

NO logging is produced and no --log-level is supported.

Interesting finding

If I run the pact-message again with another message, the previous ones will be updated properly. i.e. after the above step if I run again with:

./pact-message update --consumer='test@consumer' --pact-dir='/tmp' --provider='test@provider'
{"providerStates":[{"name":"test2"}],"description":"'some thing else changed' event","contents":{"changed":{"id":{"contents":"exampleId","json_class":"Pact::SomethingLike"},"anotherId":{"contents":"anotherId","json_class":"Pact::SomethingLike"}}},"metadata":{"content-type":"application/json"}}

then the content of the pact looks like below, where the first message's contents and matching rule now seems correct.

{
  "consumer": {
    "name": "test@consumer"
  },
  "provider": {
    "name": "test@provider"
  },
  "messages": [
    {
      "description": "'some thing changed' event",
      "providerStates": [
        {
          "name": "test",
          "params": null
        }
      ],
      "contents": {
        "changed": {
          "id": "exampleId",
          "anotherId": "anotherId"
        }
      },
      "matchingRules": {
        "body": {
          "$.changed.id": {
            "match": "type"
          },
          "$.changed.anotherId": {
            "match": "type"
          }
        }
      },
      "metaData": {
        "content-type": "application/json"
      }
    },
    {
      "description": "'some thing else changed' event",
      "providerStates": [
        {
          "name": "test2",
          "params": null
        }
      ],
      "contents": {
        "changed": {
          "id": {
            "contents": "exampleId",
            "json_class": "Pact::SomethingLike"
          },
          "anotherId": {
            "contents": "anotherId",
            "json_class": "Pact::SomethingLike"
          }
        }
      },
      "matchingRules": {
      },
      "metaData": {
        "content-type": "application/json"
      }
    }
  ],
  "metadata": {
    "pactSpecification": {
      "version": "2.0.0"
    }
  }
}

Runtime regex error on failing API test

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • Upgraded to the latest version of the relevant libraries
  • Checked to see if the issue has already been raised
  • Created an executable example that demonstrates the issue using either:

Software versions

  • pact-ruby-standalone: eg 1.82.0
  • OS: e.g. Mac OSX 10.14.4

First discovered on linux: Linux eb7f63ba7ce0 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64 Linux

Expected behaviour

When an API with an array body and matchers on a specific element (e.g. "$.body.data[*].actions[0].href") is peresent, but the array body does not match,
I expect an error + diff showing that the expected response was not matching the actual response.

It very much confused me, as it looked like an issue with the contract and not the response from the provider itself.

Actual behaviour

Verifying a pact between Foo and Bar
  Given there is a PDF for the first thing
    A request for a list of things
      with GET /foo
        returns a response which
WARN: Skipping set up for provider state 'there is a PDF for the first thing' for consumer 'Foo' as there is no --provider-states-setup-url specified.
127.0.0.1 - - [24/Mar/2020:09:44:52 +1100] "GET /foo HTTP/1.1" 200 - 0.0007
          has status code 200
          has a matching body (FAILED - 1)

Failures:

  1) Verifying a pact between Foo and Bar Given there is a PDF for the first thing A request for a list of things with GET /foo returns a response which has a matching body
     Failure/Error: expect(response_body).to match_term expected_response_body, diff_options, example

     RuntimeError:
       Sorry, ".*" is too vague, try setting a range: ".{0,3}"

1 interaction, 1 failure

Failed interactions:

* A request for a list of things given there is a PDF for the first thing

Steps to reproduce

https://github.com/pact-foundation/pact-ruby-standalone-e2e-example/tree/repro/regex-too-vague-on-provider-failure

Relevant log files

foo-bar-mock-service.log
pact.log

Uanble to run the pact-mock-service on Mac 10.15 version

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • [ X] Upgraded to the latest version of the relevant libraries
  • [X ] Checked to see if the issue has already been raised
  • Created an executable example that demonstrates the issue using either:

Software versions

  • pact-ruby-standalone: pact-1.84.0
  • OS: e.g. Mac OSX 10.15 catalina

Expected behaviour

$ ./pact-mock-service --help start
should have started the mock service.

Actual behaviour

$ ./pact-mock-service --help start
ended with the error:
$ ./pact-mock-service --help start
/pact/lib/ruby/bin/ruby: line 6: /pact/lib/ruby/bin.real/ruby: No such file or directory

Steps to reproduce

I was trying to work with the Pact-Mock-Server as per the instructions given in the ReadMe at
https://github.com/pact-foundation/pact-ruby-standalone/releases/tag/v1.84.0

  1. Downloaded the pact tar available for Mac OS in the link mentioned above, which is pact-1.84.0-osx.tar.gz.

  2. Mac's Achive Utility tools untars the above mentioned tar into the folder with structure
    pact
    pact/bin/
    pact/lib/
    Readme.md

  3. After the untar, when i try to execute the command
    $ ./pact-mock-service --help start
    /pact/lib/ruby/bin/ruby: line 6: /Users/preethighalke/pact/lib/ruby/bin.real/ruby: No such file or directory
    the command fails with the above error.

Relevent log files

NA

Running the standalone package inside of a ruby container fails

I've encountered something similar to #17, where running the standalone package inside of a container is failing. After spending a few hours troubleshooting I've managed to narrow down the problem. Example dockerfile to reproduce:

FROM ruby:2.6

WORKDIR /opt

RUN curl -LO https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.87.5/pact-1.87.5-linux-x86_64.tar.gz \
    && tar xzf pact-1.87.5-linux-x86_64.tar.gz

I'm currently getting the following error:

C:\temp\pact-standalone> docker run --rm -it pact-standalone:latest /opt/pact/bin/pact-mock-service --help
Could not find rake-13.0.1 in any of the sources
Run `bundle install` to install missing gems.

The cause of this appears to be the BUNDLE_APP_CONFIG set on the ruby container. Adding the follow to the Dockerfile fixes the problem:

RUN echo "echo unset BUNDLE_APP_CONFIG" >> /opt/pact/lib/ruby/bin/ruby_environment

I don't know if this is something that needs to be fixed upstream or in this package, but at the very least I wanted to just document this issue for anyone else that may encounter this.

Getting Openssl Error while using Pact Ruby Standalone CLI 'can-i-deploy' utility

I have pact broker setup inside a k8s cluster, while trying to use 'can-i-deploy' utilty from command line getting below error, any help is much appreciated, tired using the $SSL_CERT_FILE & $SSL_CERT_DIR solution it didn't helped
Error Making request - openSSL::SSL::SSLError SSL_connect returned=1 errno=0 stage=SSLV3 read server
Certificate B: certificate verify failed I:pact/lib/vendor/ruby/2.2.0/gems/pactbroker-client-2.29.1/lib/pact_broker/client/matrix.rb:13 in `get', attempt 1 of 3

Invalid path value for HTTP header matcher.

Hi,

Apparently pact-ruby-standalone does not use the standard header path format of $.header.<header name> when parsing pact files. Instead the non-standard format $.headers.<header name> is used (notice the extra s). This leads to incompatibility with pact-jvm (as mentioned in e.g. pact-foundation/pact-net#184 (comment)) which generates the paths according to the pact specification.

Here's the relevant part of the pact specification:

Matcher Path expressions

Pact does not support the full JSON path expressions, only ones that match the following rules:

  1. All paths start with a dollar ($), representing the root.
  2. All path elements are either separated by periods (.) or use the JSON path bracket notation (square brackets and single quotes around the values: e.g. ['x.y']), except array indices which use square brackets ([]). For elements where the value contains white space or non-alphanumeric characters, the JSON path bracket notation (['']) should be used.
  3. The second element of the path is the http type that the matcher is applied to (e.g., $.body or $.header).
  4. Path elements represent keys.
  5. A star (*) can be used to match all keys of a map or all items of an array (one level only).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.