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' JSONstringify status: 'die' from: '..' id: '...' time: '...' ;// ordockerMockeventsstreamemit'data' dockerMockeventsgenerateEvent;
Please make sure all unit tests pass, lint passes, 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