Comments (15)
There's a good chance that the documentation is missing. However I've had a look around (it's been a while!) and essentially all you do this add a flag to your SBT config:
scalaPactEnv := ScalaPactEnv.defaults
.withPort(8080)
.enablePublishResults("<provider version>", Option("<url to ci build>"))
Hope that helps!
from scala-pact.
Hi @sallareznov,
Sorry for the delay, I've been rather hectic lately.
400 is a bad request so it doesn't like something. I'm a bit suspicious of your use of the git commit id - not a bad idea but I don't know if pact broker will accept that. At one point it used to try and order by the version number for example.
Perhaps @jbwheatley or @dantb could have a dig though?
from scala-pact.
If it's a 400, the most likely reason is that the provider version number has not been provided.
Can someone update the scala code to print out out the body of the response whenever there is an error? The response body has the error description in it.
from scala-pact.
Btw, using the Git SHA is actually the recommended approach (earlier versions of the documentation often had a semantic version in the examples, but now we recommend the SHA). Docs here: https://docs.pact.io/getting_started/versioning_in_the_pact_broker#guidelines
from scala-pact.
Thank you for the question, I'm not sure when they added that feature to Pact Broker (available since 2.0 it seems) but I wasn't aware of it! How embarrassing... :-)
So put simply: Scala-Pact doesn't know how to do that right now, but I'll look into it.
The way we do this at ITV is simply that a failed verification causes the CI build to fail. CI builds are monitored as normal so the provider team will investigate and send a message to the consumer team. This works just fine for us, but I can see the use case. Truthfully I'd never even considered the need for such a thing, but thank you for making me aware of it.
As I said, I shall investigate.
from scala-pact.
Okay, thank you. Can I hope this feature in near future for Scala also?
from scala-pact.
No promises, but I have followed this up with the lovely people that make Pact Broker. If it's not too must work I'll try and squeeze it in. In the meantime, you may have to communicate with your colleagues the old fashioned way for a while. :-)
from scala-pact.
Sure, please let me know if you find any workaround :)
from scala-pact.
Hi @davesmith00000 , is there any update on the above issue
from scala-pact.
@davesmith00000 Sorry I didn't think to mention this to you. Until recently, I wasn't aware that the scala implementation existed as a separate entity. All the other implementations (apart from the php one which I recently discovered) either use the DiUS JVM code or wrap the Ruby implementation. I'll try to remember to keep you in the loop. I might set up an email list just for the maintainers.
Anyway, in regards to this issue, I've done a bit of an explanation of what is required here: https://stackoverflow.com/questions/47418840/publishing-results-of-pact-verify-to-pact-broker/47426111?noredirect=1#comment81817865_47426111
In summary, a configurable flag should allow the publishing to be turned on or off depending on context (eg. should only run from the CI). It should require that a provider application version is provided to be able to publish the results. The results should be published for both successes and failures, and should be based on the results for that pact alone, not the overall verification result.
Here's the verification results API documentation. https://github.com/pact-foundation/pact_broker/blob/master/lib/pact_broker/doc/views/publish-verification-results.markdown
We're working on being able to publish the actual test results as well.
from scala-pact.
You can publish the individual test results JSON (any format currently, we haven't worked out a standard) using the testResults
key.
from scala-pact.
This is now fixed on Master, many thanks to @garraspin. Will go out very shortly, but I need to update the docs to explain how to use it.
from scala-pact.
This is now fixed on Master, many thanks to @garraspin. Will go out very shortly, but I need to update the docs to explain how to use it.
Can you please point me to the documentation on using the results publishing?
from scala-pact.
Hi @davesmith00000 , do you have a working example using the setting enablePublishResults
?
I've used it on my project, and when I run the command sbt "infrastructure/pactVerify --host localhost --port 8080 --clientTimeout 5"
, I encounter a Publish verification results failed with 400
error after the verification succeeds.
Do I need to give a token since I use credentials?
Here is my complete settings in SBT related to pact:
providerName := "xxx",
consumerNames := List("yyy"),
pactBrokerAddress := "<broker-address>",
pactBrokerCredentials := "<username>" -> "<password>",
scalaPactEnv := ScalaPactEnv.defaults
.withClientTimeOut(5 seconds)
.enablePublishResults("GIT_COMMIT", Some("https://<broker-address>/pacts/provider/xxx/consumer/yyy/pact-version/7f8374cf668ce96935bbbc753b7efd5410516572/verification-results")) // not sure about the url though
Thank you! :)
from scala-pact.
Thanks @bethesque, good to know!
from scala-pact.
Related Issues (20)
- matching on path HOT 4
- PactForger creates a stub server for every test HOT 5
- Add sbt command for deleting tags from the broker (for rollbacks)
- Always print pact broker errors
- Modifying requests before verification HOT 3
- Support async tests HOT 2
- Better support for multi-project builds HOT 5
- Update documentation HOT 4
- Remove logic around publishing pacts for SNAPSHOT consumer versions
- Pact verification does not publish provider tags HOT 3
- Pact file output folders differ between SBT and tests for sub-projects HOT 4
- Upgrade http4s to 0.21.17
- Unexpected exit behavior for verify and publish tasks
- Add support for consumer version selectors for deployed and released versions HOT 5
- Add support for consumer version selectors for deployed and released versions HOT 1
- Set "enable pending" to true by default HOT 1
- Add support for branches in consumer version selectors
- Inconsistent parsing of Pact Links HOT 3
- Be able to configure port on which ScalaMockPactServer listens HOT 2
- Issue with supporting XML requests which sends a DTD in the latest scala-xml version
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scala-pact.