Skip to content

Commit 8b7192f

Browse files
committed
Fixed tests (example plugin, checkpoints)
1 parent 21a7410 commit 8b7192f

File tree

2 files changed

+49
-36
lines changed

2 files changed

+49
-36
lines changed

test/container.js

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ describe("#container", function() {
5252
});
5353
});
5454

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

5959
function handler(err, data) {
@@ -62,10 +62,12 @@ describe("#container", function() {
6262
done();
6363
}
6464

65-
container.createCheckpoint(handler);
65+
container.getArchive({
66+
'path': '/var/log/dmesg'
67+
}, handler);
6668
});
6769

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

7173
function handler(err, data) {
@@ -74,12 +76,12 @@ describe("#container", function() {
7476
done();
7577
}
7678

77-
container.listCheckpoint(handler);
79+
container.putArchive('./test/test.tar', {
80+
'path': '/root'
81+
}, handler);
7882
});
79-
});
8083

81-
describe("#archive", function() {
82-
it("should get an archive inside the container", function(done) {
84+
it("should inspect an archive inside the container", function(done) {
8385
var container = docker.getContainer(testContainer);
8486

8587
function handler(err, data) {
@@ -88,26 +90,35 @@ describe("#container", function() {
8890
done();
8991
}
9092

91-
container.getArchive({
92-
'path': '/var/log/dmesg'
93+
container.infoArchive({
94+
'path': '/root/Dockerfile'
9395
}, handler);
9496
});
97+
});
98+
99+
describe("#start", function() {
100+
it("should start a container", function(done) {
101+
this.timeout(60000);
95102

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

99105
function handler(err, data) {
100106
expect(err).to.be.null;
101-
expect(data).to.be.ok;
102107
done();
103108
}
104109

105-
container.putArchive('./test/test.tar', {
106-
'path': '/root'
107-
}, handler);
110+
container.start(handler);
108111
});
112+
});
109113

110-
it("should inspect an archive inside the container", function(done) {
114+
describe("#checkpoints", function() {
115+
before(function() {
116+
if(process.platform === 'darwin') {
117+
this.skip();
118+
}
119+
});
120+
121+
it("should create container checkpoint", function(done) {
111122
var container = docker.getContainer(testContainer);
112123

113124
function handler(err, data) {
@@ -116,24 +127,21 @@ describe("#container", function() {
116127
done();
117128
}
118129

119-
container.infoArchive({
120-
'path': '/root/Dockerfile'
130+
container.createCheckpoint({
131+
'checkpointID': 'testCheckpoint'
121132
}, handler);
122133
});
123-
});
124-
125-
describe("#start", function() {
126-
it("should start a container", function(done) {
127-
this.timeout(60000);
128134

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

131138
function handler(err, data) {
132139
expect(err).to.be.null;
140+
expect(data).to.be.ok;
133141
done();
134142
}
135143

136-
container.start(handler);
144+
container.listCheckpoint(handler);
137145
});
138146
});
139147

test/plugin.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,29 @@ describe("#plugin", function() {
4747
'remote': 'vieux/sshfs'
4848
},
4949
'_body': [{
50-
'Name': 'network',
51-
'Description': 'permissions to access a network',
52-
'Value': ['host']
50+
Name: 'network',
51+
Description: 'permissions to access a network',
52+
Value: ['host']
5353
},
5454
{
55-
'Name': 'mount',
56-
'Description': 'host path to mount',
57-
'Value': ['/var/lib/docker/plugins/']
55+
Name: 'mount',
56+
Description: 'host path to mount',
57+
Value: ['/var/lib/docker/plugins/']
5858
},
5959
{
60-
'Name': 'device',
61-
'Description': 'host device to access',
62-
'Value': ['/dev/fuse']
60+
Name: 'mount',
61+
Description: 'host path to mount',
62+
Value: ['']
6363
},
6464
{
65-
'Name': 'capabilities',
66-
'Description': 'list of additional capabilities required',
67-
'Value': ['CAP_SYS_ADMIN']
65+
Name: 'device',
66+
Description: 'host device to access',
67+
Value: ['/dev/fuse']
68+
},
69+
{
70+
Name: 'capabilities',
71+
Description: 'list of additional capabilities required',
72+
Value: ['CAP_SYS_ADMIN']
6873
}
6974
]
7075
}, function(err, stream) {

0 commit comments

Comments
 (0)