Micro Mockers
Mock multiple (micro-)services with Docker boxes and gateway with Kong.
How to use
- Always shutdown the docker boxes before you change anything
- Download and install Docker
npm install -g micro-mockers
cd
to your work directory (see test/fixture
as an example)mm build
mm up
mm down
Features
Mock service boxes management
TODO
Kong admin API libraries
const mm = require('micro-mockers');
const adminApi = mm.kong.adminApi;
Status
can be used to ping the Admin API.
const status = new adminApi.Status('http://localhost:8001');
status.ping([max]).then(...);
Plugins
can be used to ensure what in Kong matches an array of plugin definitions.
const plugins = new adminApi.Plugins('http://localhost:8001');
plugins.syncAll([{
name: 'rate-limiting',
config: {
hour: 3000
}
}, {
name: 'syslog',
config: {}
}]).then(...);
Apis
can be used to ensure what in Kong matches an array of API definitions.
const apis = new adminApi.Apis('http://localhost:8001');
apis.syncAll([{
name: 'lorem',
hosts: ['...'],
upstream_url: '...',
plugins: [...]
}, ...]).then(...);