pactflow / example-provider-springboot

Spring boot example provider
MIT License
4 stars 18 forks source link

Test failing - No HAL document found at path #3

Open lulubobst opened 2 years ago

lulubobst commented 2 years ago

Hi all I am trying to do the CI/CD workshop with a colleague. The java-provider has a failing test in github actions that is not the auth in step 2. I think its broken can someone verify with me?

https://docs.pactflow.io/docs/workshops/ci-cd/set-up-ci/configure-consumer-and-provider-pipelines

Unexpected Test failing "No HAL document found at path"

Screen Shot 2022-05-12 at 11 51 08 AM
YOU54F commented 2 years ago

@lulubobst Have you updated your credentials PACT_BROKER_TOKEN with the correct read/write token

https://github.com/guptadeepesh/example-provider-springboot/runs/6411738288?check_suite_focus=true#step:4:7

https://docs.pactflow.io/#configuring-your-api-token

lulubobst commented 2 years ago

PACT_BROKER_TOKEN with the correct read/write token? Yes double checked that in github/actions/secrets/. That was the first thing I asked. There is a secret there. I am doing the consumer side so I just checked with guptadeepesh (doing the provider side) and yes indeed there was a secret present in github.

lulubobst commented 2 years ago

That test is a little hard to read, do you know it means the key was wrong?

lulubobst commented 2 years ago

I cant verify with him because he is in another timezone. I can checkout the repo and try myself though if that is your suspicions.

YOU54F commented 2 years ago

That test is a little hard to read, do you know it means the key was wrong?

Not 100% but that is my initial suspicion, because I built the GH actions, and I've just ran the build from master in GH actions and it passes

https://github.com/pactflow/example-provider-springboot/actions/runs/2320407061

definitely forking it / checking it out locally is the way to go.

YOU54F commented 2 years ago

Or maybe he is seeing there is no pacts to verify. hmm. I haven't got round to setting up the webhooks yet for when consumer contracts are published, it was still on my list

https://docs.pact.io/pact_broker/webhooks#using-webhooks-with-the-contract_requiring_verification_published-event

guptadeepesh commented 2 years ago

@lulubobst Have you updated your credentials PACT_BROKER_TOKEN with the correct read/write token

https://github.com/guptadeepesh/example-provider-springboot/runs/6411738288?check_suite_focus=true#step:4:7

https://docs.pactflow.io/#configuring-your-api-token

yes i double checked and it is a read/Write token that i am using

YOU54F commented 2 years ago

Link me up the consumer and provider examples you are using, I will set up some forks and quick it a quick test

YOU54F commented 2 years ago

https://github.com/YOU54F/example-provider-springboot/runs/6427034752?check_suite_focus=true#step:4:998

^ same error

This is just running the Provider flow, with no contracts to verify

Can I see your consumer pact that is in your broker? or can you show me the consumer build you are using

lulubobst commented 2 years ago

So you can reproduce?

lulubobst commented 2 years ago

I am not sure how to get the consumer pact for you off the broker. How can I show you the consumer build?

Screen Shot 2022-05-13 at 11 49 59 AM
YOU54F commented 2 years ago

Signed off for the weekend now buddy as it’s 8pm Friday but will take a look on Friday. I really would appreciate a full structured report of the different issues faced and steps you are trying.

Imagine you are raising an issue to someone at work, you need to present them with as much information to help ascertain the root cause.

Will see where we get to on Monday and we can all be Pact champions together 🤘🏽

Sent from my iPhone

On 13 May 2022, at 19:49, Brennon Obst @.***> wrote:

 So you can reproduce?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

lulubobst commented 2 years ago

Sounds good, enjoy the weekend. See you Monday, when I will start fresh again. I intend to do the full consumer/provider java examples so I can have all the details you need. I will be using a personal repo so I can publish the links.

To the championships!

mefellows commented 2 years ago

The name of the provider above as published by your consumer test is pactflow-example-provider but the correct name of the springboot provider is pactflow-example-provider-springboot (all of the non-canonical examples have a suffix like that).

The springboot provider will search the broker for contracts with that name and by default fail if it can't find any pacts.

The solution is to either:

  1. Override the environmont variable PACT_PROVIDER=pactflow-example-provider-springboot
  2. Update this line: https://github.com/pactflow/example-consumer/blob/master/src/api.pact.spec.js#L9

I note neither the readme or https://docs.pactflow.io/docs/examples/ make this clear, so we should do that.