Closed mohanraj-r closed 1 year ago
Thanks @mohanraj-r, have you got a reproducible example I can run? Or at the very least, could you please provide your entire consumer test (I'm assuming it's a consumer test)?
In any case, I haven't yet implemented SSL for the underlying mock service, so this would be expected. In your test you are sending a message to https://<blah>
but the underlying mock service is not running a secure server.
I'll change the title of this to enabling SSL for this case, but in the meanwhile I'd suggest you not use an HTTPS server.
FWIW and IMO I don't think you get a lot of value from testing SSL from Pact, I'm not sure what you gain over other local tests ensuring your client can make HTTPS calls.
(BUT, I'm going to add the feature anyway!).
have you got a reproducible example I can run? Or at the very least, could you please provide your entire consumer test (I'm assuming it's a consumer test)?
I have included the test in the Steps to reproduce
section. I just pass that into a pact.Verify()
Yes it is a consumer test.
FWIW and IMO I don't think you get a lot of value from testing SSL from Pact, I'm not sure what you gain over other local tests ensuring your client can make HTTPS calls.
Agree. But the code under test in my case assumes a https
scheme because it is all that it needs and deals with. But now since the mock server doesn't support https
I have to deal with modifying the code under test to support http
just for testing purpose - which works for now but is not ideal and feels like kind of a code smell.
(BUT, I'm going to add the feature anyway!). thanks!
Agree. But the code under test in my case assumes a https scheme because it is all that it needs and deals with. But now since the mock server doesn't support https I have to deal with modifying the code under test to support http just for testing purpose - which works for now but is not ideal and feels like kind of a code smell.
Pretty much any code you write for production will need to take a parameter to configure the URL/endpoint to call. It's a pretty trivial matter to modify this.
Don't forget, we can add SSL support to the mock service, but you'll then need to either:
As I said, I'll leave this ticket open and when time permits add this feature in.
Pretty much any code you write for production will need to take a parameter to configure the URL/endpoint to call. It's a pretty trivial matter to modify this.
In this case it does - it takes the hostname and formats the endpoint with a known scheme. But on the whole I agree. This isn't a huge issue.
As I said, I'll leave this ticket open and when time permits add this feature in.
If you want you can also label it appropriately (low_priority_feature, help_needed, when_time_permits etc) and then close it - to be able to give the high priority issues the needed visibility and attention. Maybe have one meta issue with pointers to such low priority closed issues. Because one of the signs of health I (like many others I presume) look for in a project is number of open issues and more importantly activity/staleness of the issues.
Thanks @mohanraj-r, appreciate all of the effort going into these tickets BTW!
A custom tls config can be passed into the provider verification of 2.x.x, closing.
When tests are run against
https
URL, following error is returnedI have a server object under test which accepts hostname and based on the hostname passed in sets the base URL for the subsequent requests as
https://<hostname>/api
. But testing this with pact gives the errorhttp: server gave HTTP response to HTTPS client
. Is it possible to have a pact interaction work withhttps
scheme instead ofhttp
?Software versions
1.9.2
Expected behaviour
Pact tests are runnable against
https
URLActual behaviour
Tests fail with following error message when running against
https
urlSteps to reproduce
Create a consumer test that sends a request to
https
url instead ofhttp
Relevant log files
No relevant logs in
pact.log