-
-
Notifications
You must be signed in to change notification settings - Fork 349
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
anything after a slash in providerBaseUrl
gets ignored when verifyProvider is run
#131
Comments
AFAIK this is expected behaviour. Perhaps the parameter name is confusing, however this makes sense. The contract specifies a very specific path, so we must test that the service works on that path else we can't guarantee the contract is working as expected. @bethesque - thoughts? |
If this is expected behavior, it eliminates the ability to run the same contract against a different instance of the same provider running at a url with a slash. I'll give you a real example from my use case. We are using DC/OS to deploy our services. DC/OS is capable of maintaining multiple namespaces in folders. It provides urls that include the folders, allowing you to uniquely identify your service. So I may have the same service running in a development namespace at |
@ewortzman that makes sense. I'll see what I can do. |
This allows /foo to be replayed against http://provider/bar/foo For pact-foundation/pact-js#131
I've fixed the reverse proxy so that the path is taken into consideration. Can you update to standalone v1.21.0 when you have a moment @mefellows. |
Obviously, as Matt says, you take a risk when you're doing this, because you're getting less confidence from your verifications. But given that the path configuration is likely to be static (eg. it's not going to change between builds, it's a set and forget thing) I think the risk is worth the payoff. |
hey @bethesque, how do I update the standalone if I have pact-js installed for a specific project? Or is that not something I should do and I should wait for you to do another release of pact-js? Also, the same question for pact-python. |
It's in some upstream components. I'll update them now and will make generally available in the 4.x.x and 5.x.x releases tomorrow. |
FYI I'm having some trouble updating to the latest, some tests have failed and I'm just investigating. Please bare with me. |
|
This should now be available in both the See npmjs.com/package/pact (4.x.x) and npmjs.com/package/@pact-foundation/pact (5.x.x). Note latest builds have been migrated to the pact-foundation scope in line with other JS packages. |
Software versions
Expected behaviour
Requests are sent to the url provided by
providerBaseUrl
with the path defined in the contract appendedActual behaviour
Anything after a slash in the
providerBaseUrl
is dropped before the path defined in the contract is appended. For example, if theproviderBaseUrl
ishttp://localhost:8081/myProvider
and the request isGET /api/cool/stuff
, the actual request is sent tohttp://localhost:8081/api/cool/stuff
instead ofhttp://localhost:8081/myProvider/api/cool/stuff
.Steps to reproduce
npm install
cd test
python reflect.py
. This starts a simple reflect server that prints any requests it receives to the console and responds with a 200.mocha provider-contract.js
. This will attempt to verify the contract that is included intest/pacts/myconsumer-myprovider.json
against the reflect server. It will pass, because all it expects is a 200, but the bug is evident in the output of the reflect server.At this point, you will see in the output of the reflect server that the request for a provider state is correctly going to
/myProvider/api/_pact/state
, but the request defined by the contract is going to/api/cool/stuff
, erroneously omitting the leading/myProvider
.The text was updated successfully, but these errors were encountered: