Skip to content

Commit

Permalink
Fixed tests (example plugin, checkpoints)
Browse files Browse the repository at this point in the history
  • Loading branch information
apocas committed Oct 24, 2017
1 parent 21a7410 commit 8b7192f
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 36 deletions.
56 changes: 32 additions & 24 deletions test/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ describe("#container", function() {
});
});

describe("#checkpoints", function() {
it("should create container checkpoint", function(done) {
describe("#archive", function() {
it("should get an archive inside the container", function(done) {
var container = docker.getContainer(testContainer);

function handler(err, data) {
Expand All @@ -62,10 +62,12 @@ describe("#container", function() {
done();
}

container.createCheckpoint(handler);
container.getArchive({
'path': '/var/log/dmesg'
}, handler);
});

it("should list containers checkpoints", function(done) {
it("should put an archive inside the container", function(done) {
var container = docker.getContainer(testContainer);

function handler(err, data) {
Expand All @@ -74,12 +76,12 @@ describe("#container", function() {
done();
}

container.listCheckpoint(handler);
container.putArchive('./test/test.tar', {
'path': '/root'
}, handler);
});
});

describe("#archive", function() {
it("should get an archive inside the container", function(done) {
it("should inspect an archive inside the container", function(done) {
var container = docker.getContainer(testContainer);

function handler(err, data) {
Expand All @@ -88,26 +90,35 @@ describe("#container", function() {
done();
}

container.getArchive({
'path': '/var/log/dmesg'
container.infoArchive({
'path': '/root/Dockerfile'
}, handler);
});
});

describe("#start", function() {
it("should start a container", function(done) {
this.timeout(60000);

it("should put an archive inside the container", function(done) {
var container = docker.getContainer(testContainer);

function handler(err, data) {
expect(err).to.be.null;
expect(data).to.be.ok;
done();
}

container.putArchive('./test/test.tar', {
'path': '/root'
}, handler);
container.start(handler);
});
});

it("should inspect an archive inside the container", function(done) {
describe("#checkpoints", function() {
before(function() {
if(process.platform === 'darwin') {
this.skip();
}
});

it("should create container checkpoint", function(done) {
var container = docker.getContainer(testContainer);

function handler(err, data) {
Expand All @@ -116,24 +127,21 @@ describe("#container", function() {
done();
}

container.infoArchive({
'path': '/root/Dockerfile'
container.createCheckpoint({
'checkpointID': 'testCheckpoint'
}, handler);
});
});

describe("#start", function() {
it("should start a container", function(done) {
this.timeout(60000);

it("should list containers checkpoints", function(done) {
var container = docker.getContainer(testContainer);

function handler(err, data) {
expect(err).to.be.null;
expect(data).to.be.ok;
done();
}

container.start(handler);
container.listCheckpoint(handler);
});
});

Expand Down
29 changes: 17 additions & 12 deletions test/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,29 @@ describe("#plugin", function() {
'remote': 'vieux/sshfs'
},
'_body': [{
'Name': 'network',
'Description': 'permissions to access a network',
'Value': ['host']
Name: 'network',
Description: 'permissions to access a network',
Value: ['host']
},
{
'Name': 'mount',
'Description': 'host path to mount',
'Value': ['/var/lib/docker/plugins/']
Name: 'mount',
Description: 'host path to mount',
Value: ['/var/lib/docker/plugins/']
},
{
'Name': 'device',
'Description': 'host device to access',
'Value': ['/dev/fuse']
Name: 'mount',
Description: 'host path to mount',
Value: ['']
},
{
'Name': 'capabilities',
'Description': 'list of additional capabilities required',
'Value': ['CAP_SYS_ADMIN']
Name: 'device',
Description: 'host device to access',
Value: ['/dev/fuse']
},
{
Name: 'capabilities',
Description: 'list of additional capabilities required',
Value: ['CAP_SYS_ADMIN']
}
]
}, function(err, stream) {
Expand Down

0 comments on commit 8b7192f

Please sign in to comment.