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 - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

..gitignore.un~

2

lib/index.js

@@ -5,2 +5,3 @@ var _ = require('lodash');

var series = require('middleware-flow').series;
var bodyParser = require('body-parser');

@@ -14,2 +15,3 @@ var containers = {};

app.post('/containers/create',
bodyParser.json(),
mw.createContainer(containers),

@@ -16,0 +18,0 @@ mw.respondContainer(201));

@@ -130,2 +130,3 @@ var _ = require('lodash');

};
data = _.extend(data, req.body);
var returnData = {

@@ -132,0 +133,0 @@ 'Id': Id,

3

package.json
{
"name": "docker-mock",
"version": "0.1.3",
"version": "0.1.4",
"description": "Mock for Docker",

@@ -41,2 +41,3 @@ "main": "lib/index.js",

"blanket": "^1.1.6",
"body-parser": "^1.9.0",
"dockerode": "~2.0.0",

@@ -43,0 +44,0 @@ "mocha": "^1.18.2",

@@ -20,2 +20,19 @@ var dockerMock = require('../lib/index');

});
it('should create a container with env in the body', function (done) {
var createData = {
Env: [ 'MY_AWESOME_ENV_VARIABLE=inconceivable' ]
};
async.waterfall([
docker.createContainer.bind(docker, createData),
function (container, cb) {
container.inspect(cb);
}
], function (err, containerData) {
if (err) return done(err);
Array.isArray(containerData.Env).should.equal(true);
containerData.Env.length.should.equal(1);
containerData.Env[0].should.equal(createData.Env[0]);
docker.getContainer(containerData.Id).remove(done);
});
});
it('should list all the containers when there are none', function (done) {

@@ -141,14 +158,16 @@ docker.listContainers(function (err, containers) {

});
it('should noop if stopped twice', function (done) {
it('should come back with an error if stopped twice', function (done) {
async.series([
container.start.bind(container),
container.stop.bind(container),
container.stop.bind(container)
], function (err) {
if (err) return done(err);
container.inspect(function (err, data) {
if (err) return done(err);
data.State.Running.should.equal(false);
data.State.Pid.should.equal(-1);
done();
container.stop(function (err, data) {
err.statusCode.should.equal(304);
container.inspect(function (err, data) {
if (err) return done(err);
data.State.Running.should.equal(false);
data.State.Pid.should.equal(-1);
done();
});
});

@@ -383,3 +402,3 @@ });

data.Images.should.equal(0);
data.Mock.should.be.true;
data.Mock.should.equal(true);
cb();

@@ -386,0 +405,0 @@ }

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