Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

docker-mock

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docker-mock

Mock for Docker

  • 0.5.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19
increased by111.11%
Maintainers
2
Weekly downloads
 
Created
Source

docker-mock

Build Status Dependency Status devDependency Status

NPM

A mock for Docker!

Usage

Require it from your node program:

var dockerMock = require('docker-mock');
dockerMock.listen(5354);

You can also use the command line interface, just run docker-mock after installing the package globally.

Examples

See the tests for some sample usage, but you should be able to point your docker client at this mock and test against it.

Failures

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 Dockerfile
var file = ...;
docker.buildImage(
  file,
  {
    t: 'doomedImage',
    fail: true
  },
  function (err, res) {
    // err will not be null
  });

Configuration

If you want to disable randomly generated events exposed under /events endpoint please use ENV var: DISABLE_RANDOM_EVENTS=true.

Events

You can manually emit docker mock events.

  var dockerMock = require('docker-mock');
  dockerMock.listen(5354);
  dockerMock.events.stream.emit('data', JSON.stringify({status: 'die', from: '..', id: '...', time: '...'}));
  // or
  dockerMock.events.stream.emit('data', dockerMock.events.generateEvent());

Contributing

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

Testing is done locally via npm test.

Coverage

Coverage is done in two ways. First is a readable HTML report:

npm run coverage

Second is coverage reported for Travis CI by travis-cov. This is invoked via:

npm run travis

If you wish to run both to make sure they pass, you can run:

npm run coverage-all

Keywords

FAQs

Package last updated on 15 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc