Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can-i-deploy passes for auto-created provider version that misses verification #485

Closed
4 tasks done
p0deje opened this issue Aug 10, 2021 · 3 comments · Fixed by #486
Closed
4 tasks done

can-i-deploy passes for auto-created provider version that misses verification #485

p0deje opened this issue Aug 10, 2021 · 3 comments · Fixed by #486

Comments

@p0deje
Copy link

p0deje commented Aug 10, 2021

Pre issue-raising checklist

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

  • Upgraded to the latest Pact Broker OR
  • Checked the CHANGELOG to see if the issue I am about to raise has been fixed
  • Created an executable example that demonstrates the issue using either a:
    • Dockerfile
    • Git repository with a Travis or Appveyor (or similar) build
  • Confirmed that this behavior is a bug in Pact Slack - https://pact-foundation.slack.com/archives/C5F4KFKR8/p1628106800045800

Software versions

  • pact-broker gem version: not used
  • pact-broker docker version: eg 2.81.0.1
  • OS: e.g. Mac OSX 12.0.beta4
  • pact broker client details: eg. pact-ruby-standalone CLI v 0.47.1

Expected behaviour

When a new version of the provider is created and no verification results are published yet, can-i-deploy used with --to should fail and say that there are missing verifications.

First, we create a new version of the provider and tag it:

pact-broker create-version-tag --pacticipant "Example API" --version 4.5.8 --tag rc1 --auto-create-version

Next, we want to make sure that this new version has passed verification and can be deployed:

pact-broker can-i-deploy --pacticipant "Example API" --version 4.5.8 --to main

The latter command should fail because there are no verification results for this version of the provider. So it should print something like the following and fail:

Computer says no ¯_(ツ)_/¯

CONSUMER    | C.VERSION  | PROVIDER    | P.VERSION | SUCCESS? | RESULT#
------------|------------|-------------|-----------|----------|--------
Example App | 5556b81... | Example API | ???       | ???      |

Actual behaviour

can-i-deploy passes like there are no consumer to check at all:

Computer says yes \o/

There are no missing dependencies

Steps to reproduce

You can observe this behavior by creating the following docker-compose.yml file and running docker-compose up --exit-code-from test:

version: "3"

services:
  postgres:
    image: postgres:13.3-alpine
    healthcheck:
      test: psql postgres --command "select 1" -U postgres
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: postgres

  pact-broker:
    image: pactfoundation/pact-broker:2.81.0.1
    ports:
      - 9292:9292
    depends_on:
      - postgres
    environment:
      PACT_BROKER_PORT: 9292
      PACT_BROKER_DATABASE_URL: postgres://postgres:postgres@postgres/postgres
      PACT_BROKER_LOG_LEVEL: INFO
      PACT_BROKER_SQL_LOG_LEVEL: DEBUG
    entrypoint: |
      /bin/sh -c "
        sleep 5 # wait for PostgreSQL
        /pact_broker/entrypoint.sh
      "

  test:
    image: pactfoundation/pact-cli:0.47.1.0
    depends_on:
      - pact-broker
    environment:
      PACT_BROKER_BASE_URL: http://pact-broker:9292
    entrypoint: |
      /bin/sh -xc '
        sleep 5 # wait for Pact Broker

        # First, check that can-i-deploy works fine for existing version
        pact-broker can-i-deploy --pacticipant "Example API" --version 4fdf20082263d4c5038355a3b734be1c0054d1e1 --to main || exit 1

        # Second, create new version of pacticipant to be deployed
        pact-broker create-version-tag --pacticipant "Example API" --version 4.5.8 --tag rc1 --auto-create-version || exit 1

        # Third, make sure that can-i-deploy fails for this new version when used against explicit consumer version
        pact-broker can-i-deploy --pacticipant "Example API" --version 4.5.8 --pacticipant "Example App" --version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30

        # Fourth, check that can-i-deploy fails for this new version
        pact-broker can-i-deploy --pacticipant "Example API" --version 4.5.8 --to main && exit 1
      '

The test image is the one reproducing the failure and its entrypoint shows the actual steps.

Relevant log files

The logs can be seen by running the docker-compose file.

@bethesque
Copy link
Member

Thank you for the very nice reproduction steps. I've fixed this, and should have the next release out tomorrow.

@p0deje
Copy link
Author

p0deje commented Aug 11, 2021

Thank you for a quick fix!

@bethesque
Copy link
Member

This has been released in v2.82.0

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