https://github.com/doochik/mockritsa
Docker image for mountebank
https://github.com/doochik/mockritsa
mock mountebank
Last synced: over 1 year ago
JSON representation
Docker image for mountebank
- Host: GitHub
- URL: https://github.com/doochik/mockritsa
- Owner: doochik
- License: mit
- Created: 2019-03-25T18:51:11.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-25T20:34:04.000Z (over 7 years ago)
- Last Synced: 2025-03-06T15:51:08.245Z (over 1 year ago)
- Topics: mock, mountebank
- Language: JavaScript
- Size: 238 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# mockritsa
[Docker image](https://hub.docker.com/r/doochik/mockritsa) for [moutebank](http://www.mbtest.org) mock server.
## Motivation and architecture
`mountbank` uses port for each imposter (mock).
This is the problem when you run it in the Docker.
At this point you should publish container ports to the host and have the range of free ports to bind.
This solution uses only 2 ports (api and mock).
* API port: exposes the same interface as [mbtest.org](http://www.mbtest.org)
* mock port: exposes proxy to all imposters by cookie `mockritsa_imposter=NNNN`
## Usage
Pass env variables to container and expose ports
`docker run -d -e PORT_API=1025 -e PORT_MOCK=1026 -p 1025:1025 -p 1026:1026 doochik/mockritsa`
Now you can view mountebank interface at `localhost:1025` and mock server at `localhost:1026`.
Example:
1. Create imposter `curl -X POST 'localhost:1025/imposters' --data @examples/imposter.json` (example imposter uses port 42000)
2. Test created imposter
```
$ curl -s 'localhost:1026/api/1.0/test/' --cookie 'mockritsa_imposter=42000'
{
"result": "this is mock response",
"status": "SUCCESS"
}
```
3. Any other request from example will response with 200 OK and empty body. This is default mountebank behaviour.
## Development
1. Run `npm install`
2. Start dev server `npm run dev`
Default ports at development mode:
* mountebank - 1024
* api server - 1025
* mock server - 1026