Tien Vo
04/26/2023, 5:40 PMurl2
method, which allow to use the generator MockServerURL
to generate url with the mock server as the base URL.
It work as expected. But stub server (rust version - https://github.com/pact-foundation/pact-stub-server) doesn't support that generator. Is it expected?
Here is the demo code https://github.com/tienvx/test-mock-server-url-generatorMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Tien Vo
04/27/2023, 3:53 PMProviderState
and MockServerURL
): Mock server --- (use) ---> Generator --- (to generate random data, then send to) ---> Consumer's contract test
• If generator is ProviderState
: Provider verifier --- (grab value from) ---> Provider state handler --- (then send it to) ----> Provider
• If generator is MockServerURL
: Mock server --- (replace base url from) ---> Example value ----- (then send it to) -----------> Consumer's contract test
I'm assuming that stub server (rust version) doesn't care about generators at all? I'm not sure, I didn't use generators other than ProviderState
and MockServerURL
. I think the behavior should be:
• Stub server --- (provide) -----> Example value ----- (to) ------> Consumer's integration test
• if there is generator specified (except ProviderState
and MockServerURL
): Stub server --- (use) ---> Generator --- (to generate random data, then send to) ---> Consumer's integration test
• If generator is MockServerURL
: Stub server --- (replace base url from) ---> Example value ----- (then send it to) -----------> Consumer's integration test
If all of my assumptions are correct, I will create 2 tickets for the last 2 items:
• Stub server should use generators if specified
• Stub server should replace base url if generator MockServerURL
is specifiedTien Vo
05/02/2023, 3:03 AMRandomInt
and both Mock Server and Stub Server use this generator. So I think that Stub Server doesn't replace url if generator MockServerURL
is specified is a bug to me. I will create the ticketTien Vo
05/02/2023, 3:29 AMTien Vo
05/02/2023, 3:33 AMTien Vo
05/02/2023, 4:33 AMTien Vo
05/02/2023, 4:58 AM{
'pact:generator:type': 'RandomInt',
'pact:matcher:type': 'integer',
// value: 101, <--------------- I can't remove this, it's still needed for stub server, not sure why
}
So either my diagram is wrong (about example value on stub server), or stub server has another 'bug' hereMatt (pactflow.io / pact-js / pact-go)
uglyog
Matt (pactflow.io / pact-js / pact-go)