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

WARNING: Pact file has no interactions with pact-verify in Leiningen plugin #1372

Open
jarmy opened this issue May 27, 2021 · 4 comments
Open

Comments

@jarmy
Copy link

jarmy commented May 27, 2021

I have a pact that is using pact-specification 2.0 that I'm trying to verify with the au.com.dius.pact.provider/lein "4.1.20" plugin. When we run the pact-verify task, we get the following message:

% ./lein with-profile pact pact-verify

Verifying a pact between :graphql and :sod
  [from URL https://pact-broker.docker.savagebeast.com]
         WARNING: Pact file has no interactions
% ./lein --version
Leiningen 2.6.1 on Java 1.8.0_272 OpenJDK 64-Bit Server VM

Here's the clojure/lein definition:

  :profiles {:pact {:plugins [[au.com.dius.pact.provider/lein "4.1.20" :exclusions [commons-logging]]]}}
  :pact {
         :service-providers {
             :sod {
                 :protocol "http"
                 :host "localhost"
                 :port 3000
                 :has-pact-with {
                     :graphql {
                               :pact-source "https://pact-broker.docker.savagebeast.com"
                               }
                     }
                 }
             }
         }

And the pact file we're trying to verify:

{
  "consumer": {
    "name": "graphql"
  },
  "provider": {
    "name": "sod"
  },
  "interactions": [
    {
      "description": "POST request for search on demand results",
      "request": {
        "method": "POST",
        "path": "/sod/jsonrpc",
        "headers": {
          "Accept": "application/json"
        },
        "body": {
          "jsonrpc": "2.0",
          "method": "sod-v3.search",
          "params": [
            "jamiro",
            [
              "AR",
              "TR"
            ],
            {
              "listenerId": "399"
            },
            0,
            20,
            false
          ]
        }
      },
      "response": {
        "status": 200,
        "headers": {
        },
        "body": {
          "jsonrpc": "2.0",
          "id": "null",
          "result": {
            "annotations": {
            },
            "results": [
              "AR:1483",
              "AR:431482",
              "TR:5761576",
              "AR:4553512",
              "AR:5276999",
              "AR:1291911",
              "AR:3183539",
              "AR:2587975",
              "AR:4804250",
              "AR:4099386",
              "TR:13374694",
              "AR:683520",
              "TR:5164843",
              "AR:3585588",
              "AR:1311776",
              "AR:220003",
              "TR:13647594",
              "TR:5973496",
              "AR:853471",
              "AR:2076170"
            ]
          }
        },
        "matchingRules": {
          "$.body.result": {
            "match": "type"
          },
          "$.body.result.annotations": {
            "match": "type"
          },
          "$.body.result.results": {
            "match": "type"
          }
        }
      }
    }
  ],
  "metadata": {
    "pactSpecification": {
      "version": "2.0.0"
    }
  }
}
@uglyog
Copy link
Member

uglyog commented Jun 12, 2021

I'm not able to replicate this. See my test project here: https://github.com/uglyog/pact-lein-test

In that project, I started the broker using docker-compose, published your pact to it, and the ran the verify and it worked as expected.

$ lein with-profile pact pact-verify

Verifying a pact between :consumer1 and :provider1
  [from URL http://localhost:9292/pacts/provider/sod/consumer/graphql/version/1.0.3]
  POST request for search on demand results
      Request Failed - Connect to localhost:5050 [localhost/127.0.0.1] failed: Connection refused (Connection refused)

NOTE: Skipping publishing of verification results as it has been disabled (pact.verifier.publishResults is not 'true')


Failures:

1) Verifying a pact between :consumer1 and :provider1 - POST request for search on demand results

    1.1)       Connect to localhost:5050 [localhost/127.0.0.1] failed: Connection refused (Connection refused)

Note that I've given the full URL to the Pact file in the broker.

@uglyog
Copy link
Member

uglyog commented Jun 12, 2021

Oh, I see the issue. You're pointing to the root of the broker. Let me add support for that.

@uglyog
Copy link
Member

uglyog commented Jun 12, 2021

I'm trying to enable this for you, but I need to enable debug logs with Leiningen. I can't work out how to do this.

You will have to use the full URL to the Pact in the broker.

@jarmy
Copy link
Author

jarmy commented Jun 15, 2021

Aha, very nice! I was able to get the test to run using :pact-source "https://pact-broker.docker.savagebeast.com/pacts/provider/sod/consumer/graphql/latest"

./lein with-profile pact pact-verify

Verifying a pact between :graphql and :sod
  [from URL https://pact-broker.docker.savagebeast.com/pacts/provider/sod/consumer/graphql/latest]
  POST request for search on demand results
    returns a response which
      has status code 200 (OK)
      has a matching body (OK)

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

No branches or pull requests

3 participants