Running pact mock service as a docker container with interactions #458
-
Hi, Here is what I did -
Go Test Code
Generated pact file from the above test {
"consumer": {
"name": "PactGoProductAPIConsumer"
},
"interactions": [
{
"description": "A request for Product 10",
"pending": false,
"providerStates": [
{
"name": "A product with ID 10 exists"
}
],
"request": {
"method": "GET",
"path": "/products/10"
},
"response": {
"body": {
"content": {
"id": 10,
"name": "Billy",
"price": "23.33"
},
"contentType": "application/json",
"encoded": false
},
"headers": {
"Content-Type": [
"application/json"
]
},
"matchingRules": {
"body": {
"$.id": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
},
"$.name": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
},
"$.price": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
}
}
},
"status": 200
},
"transport": "http",
"type": "Synchronous/HTTP"
}
],
"metadata": {
"pactRust": {
"ffi": "0.4.23",
"mockserver": "1.2.10",
"models": "1.2.5"
},
"pactSpecification": {
"version": "4.0"
}
},
"provider": {
"name": "PactGoProductAPI"
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is not how the It's superseded by the FFI. I think you want to create a stub API from an existing Pact file - if so, you can use https://github.com/pact-foundation/pact-stub-server for that. |
Beta Was this translation helpful? Give feedback.
This is not how the
pact-mock-service
is supposed to be used. The service is designed to be an administrative system used by the Pact SDKs to manage the pact consumer test. For the API, see https://github.com/pact-foundation/pact-mock_service.It's superseded by the FFI.
I think you want to create a stub API from an existing Pact file - if so, you can use https://github.com/pact-foundation/pact-stub-server for that.