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

docker-mock

Package Overview
Dependencies
Maintainers
1
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.0.7 to 0.0.8

33

lib/middleware.js

@@ -22,3 +22,7 @@ var _ = require('lodash');

return function (req, res, next) {
var name = req.data.repository;
var repoSplit = req.params.repository.split(':');
var repo = repoSplit[0];
var tag = repoSplit[1] || 'latest';
repo = repo +':'+ tag;
var name = [req.params.registry, req.params.namespace, repo].filter(exists).join('/');
var imageId = tags[name];

@@ -35,3 +39,8 @@ if (!imageId) return res.send(404);

var foundDockerFile = false;
var tag = req.query ? req.query.t : false;
// TODO query.t is required
var repoSplit = req.query.t.split(':');
var repo = repoSplit[0];
var tag = repoSplit[1] || 'latest';
repo = repo +':'+ tag;
var name = [req.params.registry, req.params.namespace, repo].filter(exists).join('/');
var intentionalFail = req.query.fail || false;

@@ -54,3 +63,3 @@ // for a little extra flexability, we'll support gzip

};
if (tag) tags[tag] = id;
tags[name] = id;
res.json(200, { 'stream': 'Successfully built ' + id });

@@ -127,7 +136,13 @@ });

var imageId = utils.randomId();
tag = tag || 'latest';
var name = [repo, tag].filter(exists).join(':');
tags[name] = imageId;
images[imageId] = {
'id': imageId,
'container': container.Id
id: imageId,
container: container.Id,
RepoTags: [name]
};
if (tag) tags[tag] = imageId;
req.data = { image: { 'Id': imageId } };

@@ -247,3 +262,7 @@ next();

return function (req, res, next) {
var name = [req.params.registry, req.params.namespace, req.params.repository].filter(exists).join('/');
var repoSplit = req.params.repository.split(':');
var repo = repoSplit[0];
var tag = repoSplit[1] || 'latest';
repo = repo +':'+ tag;
var name = [req.params.registry, req.params.namespace, repo].filter(exists).join('/');
var imageId = tags[name];

@@ -250,0 +269,0 @@ if (!imageId) {

{
"name": "docker-mock",
"version": "0.0.7",
"version": "0.0.8",
"description": "Mock for Docker",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -64,3 +64,3 @@ var dockerMock = require('../lib/index');

container.commit({
tag: 'committedContainer'
repo: 'committedContainer'
}, cb);

@@ -210,4 +210,4 @@ },

pack.finalize();
var image = docker.getImage('localhost:5000/docker-mock/buildTest');
docker.buildImage(pack, { t: 'localhost:5000/docker-mock/buildTest' }, watchBuild(image, done));
var image = docker.getImage('private.com/docker-mock/buildTest');
docker.buildImage(pack, { t: 'private.com/docker-mock/buildTest' }, watchBuild(image, done));
});

@@ -265,3 +265,3 @@ it('should fail building an image w/o a dockerfile', function (done) {

images[0].RepoTags.length.should.equal(1);
images[0].RepoTags[0].should.equal('testImage');
images[0].RepoTags[0].should.equal('testImage:latest');
done();

@@ -268,0 +268,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