-
Notifications
You must be signed in to change notification settings - Fork 435
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
Improve browsing registered stubs #355
Comments
I also had an idea. On
that way every implementor of the stub mechanism (you can inject sth else than WireMock) would have to provide a way to access the mappings. What do you think about this? |
I'm not sure:
File in |
So how about doing both (one would be actually required to the other). Meaning we could have
where for each started stub server, a file with all registered mappings would be dumped. |
Great! +1 |
without this feature we're missing an option to print all mappings registered for servers with this feature it will be much easier to debug what was registered in which http server stub. The mappings will be dumped to files with name artifactName_registeredPort fixes #355
I've implemented the feature please check out the PR #356 . You can focus on the documentation and tests where I describe the usage. The usage would look like this Extract from docs: Viewing registered mappingsEvery stubbed collaborator exposes list of defined mappings under You can also use the @AutoConfigureStubRunner(ids="a.b.c:loanIssuance,a.b.c:fraudDetectionServer",
mappingsOutputFolder = "target/outputmappings/") and for the JUnit approach like this: @ClassRule @Shared StubRunnerRule rule = new StubRunnerRule()
.repoRoot("http://some_url")
.downloadStub("a.b.c", "loanIssuance")
.downloadStub("a.b.c:fraudDetectionServer")
.withMappingsOutputFolder("target/outputmappings") Then if you check out the folder .
├── fraudDetectionServer_13705
└── loanIssuance_12255 That means that there were two stubs registered. [{
"id" : "f9152eb9-bf77-4c38-8289-90be7d10d0d7",
"request" : {
"url" : "/name",
"method" : "GET"
},
"response" : {
"status" : 200,
"body" : "fraudDetectionServer"
},
"uuid" : "f9152eb9-bf77-4c38-8289-90be7d10d0d7"
},
...
] |
without this feature we're missing an option to print all mappings registered for servers with this feature it will be much easier to debug what was registered in which http server stub. The mappings will be dumped to files with name artifactName_registeredPort fixes #355
Looking good. I was waiting for this feature :) |
without this feature we're missing an option to print all mappings registered for servers with this feature it will be much easier to debug what was registered in which http server stub. The mappings will be dumped to files with name artifactName_registeredPort fixes #355
Gj, thanks @marcingrzejszczak |
Hi
During my regular work with contracts I often have to resolve some bugs connected with defined contracts (eg 404 caused by missing header ;) ), when I'd like to browse registered stubs I have two options:
a) Add break point in spring-cloud-contract internals to read random generated wire mock ports
b) Add Thread.sleep(100000000) in my business code
c) Evaluate
curl http://localhost:{wiremockPort}/__admin
(I can't evaluate it without step b) cause thread is blocked)or
a) read from logs paths with mappings generated in /tmp/..
b) explore generated files
Both of them (in my opinion) are not user friendly, in first approach I have to remember wiremock ports and modify my code (adding thread.sleep()) which is really not cool. In second approach I have to explore my /tmp catalog, after whole day there is a big mess, and I just don't like to explore spring-cloud-contract internals.
My idea to make it more useful is to create temporary file with content similar to response from wiremock
.../__admin
and add this file to{project}/build/
- just next to generated Spock tests. This file should contain mappings from all set up wiremock instances.The text was updated successfully, but these errors were encountered: