Mock for Docker
A mock for Docker!
Require it from your node program:
var dockerMock = require'docker-mock';dockerMocklisten5354;
You can also use the command line interface, just run
docker-mock after installing the package globally.
See the tests for some sample usage, but you should be able to point your docker client at this mock and test against it.
This does have support for simulating failures during build. This is done (using
dockerode) by doing the following:
// file is a tar containing at minimum a Dockerfilevar file = ;dockerbuildImagefilet: 'doomedImage'fail: true// err will not be null;
If you want to disable randomly generated events exposed under
/events endpoint please use ENV var:
You can manually emit docker mock events.
var dockerMock = require'docker-mock';dockerMocklisten5354;dockerMockeventsstreamemit'data' JSONstringifystatus: 'die' from: '..' id: '...' time: '...';// ordockerMockeventsstreamemit'data' dockerMockeventsgenerateEvent;
This is currently a work in progress, being built up as use cases come to light. If you would like to contribute, please note this repository is using a git-flow pattern, so please submit pull requests against the
develop branch, and they will be merged into the future release branch and master.
Please make sure all unit tests pass and coverage remains high during development (see below for details).
Testing is done locally via
Coverage is now run by Lab via
npm test. Output at the bottom shows percent coverage verses a threshold set in