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

Skipping verification of certain interactions or provider states (mark tests as pending) #115

Open
argos83 opened this issue Oct 7, 2016 · 6 comments

Comments

@argos83
Copy link

argos83 commented Oct 7, 2016

Hi!

Is there a way to flag a certain provider state as pending, so it's skipped during verification? For instance, if the set up of that state is tricky or hasn't been implemented yet. Or in my case, I'm using the pact-provider-proxy so I don't have much control of the actual provider state in some cases.

I was not able to find something similar in the docs. I was thinking of something around these lines:

Pact.provider_states_for 'my-consumer' do
  provider_state 'aHealthyStateICanProvide' do
    set_up do
      ...
    end
  end

  provider_state 'aStateThatIsNotImplementedYet' do
    pending('To be implemented')
  end
end

Similarly, a specific interaction could be skipped. (e.g. if the consumer has created tests of a new API endpoint that is not yet implemented in the provider)

The motivation is that you can still run the tests and verify what is implemented works without failing the build because of WIP functionallity.

wdyt?

Thanks!

@bethesque
Copy link
Member

It's something that has been discussed, but never implemented because we
couldn't work out a "safe" way of doing it. Unfortunately, you'll have to
disable the specs on the consumer side.

On 7 Oct 2016 3:14 PM, "argos83" notifications@github.com wrote:

Hi!

Is there a way to flag a certain provider state as pending, so it's
skipped during verification? For instance, if the set up of that state is
tricky or hasn't been implemented yet. Or in my case, I'm using the
pact-provider-proxy so I don't have much control of the actual provider
state in some cases.

I was not able to find something similar in the docs. I was thinking of
something around these lines:

Pact.provider_states_for 'my-consumer' do
provider_state 'aHealthyStateICanProvide' do
set_up do
...
end
end

provider_state 'aStateThatIsNotImplementedYet' do
pending('To be implemented')
endend

Similarly, a specific interaction could be skipped. (e.g. if the consumer
has created tests of a new API endpoint that is not yet implemented in the
provider)

The motivation is that you can still run the tests and verify what is
implemented works without failing the build because of WIP functionallity.

wdyt?

Thanks!


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/realestate-com-au/pact/issues/115, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAbPFMeRmTgv1OpnZIjzeaWugVmyPgd0ks5qxccpgaJpZM4KQqVc
.

@argos83
Copy link
Author

argos83 commented Oct 11, 2016

Thanks @bethesque, I've workarounded it for now.

I guess that, by "safe" you mean a way in which the state doesn't get skipped forever and ever without nobody noticing it, even when the provider has already implemented what was missing.

In that case I understand is not a trivial to make it safe. I though of using RSpec's pending with block, and don't skip the validation but run it in that block, so it will start failing when the provider's api endpoint is fixed/implemented (so the 'pending' can be removed), but if the provider implementation is wrong and breaks the contract it will keep passing and we are back to square one.

@bethesque
Copy link
Member

I guess that, by "safe" you mean a way in which the state doesn't get skipped forever and ever without nobody noticing it, even when the provider has already implemented what was missing.

Exactly.

You could use the pact broker with tags to solve something like this. If you had a master pact that the CI ran against, and a feature tag which you could push to and then tell your provider team to do the development to support the new interactions when they can. When they've got both the master and the feature pact green, push the feature pact to master.

@ivan-kolmychek
Copy link

@bethesque that explaination/example is nice and really looks like something that would be nice to have in wiki or docs. :)

@bethesque
Copy link
Member

I feel like I've written it somewhere before. Let me have a think.

@bethesque
Copy link
Member

I've thrown something together here: https://github.com/bethesque/pact_broker/wiki/How-to-add-new-interactions-without-breaking-everything

The problem is, the Pact Broker Client needs to be able to tag pacts, and I don't think this dev was ever done, so it's a manual process at the moment.

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