-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathcompose.js
More file actions
223 lines (209 loc) · 7.39 KB
/
compose.js
File metadata and controls
223 lines (209 loc) · 7.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
const expect = require('chai').expect,
assert = require('assert');
var compose = require('./spec_helper').compose;
var compose_complex = require('./spec_helper').compose_complex;
var compose_build = require('./spec_helper').compose_build;
var compose_build_context = require('./spec_helper').compose_build_context;
var docker = require('./spec_helper').docker;
describe('compose', function () {
describe('#pull', function () {
it("should pull all needed images with verbose", function (done) {
this.timeout(600000);
(async () => {
await compose.pull(null, { 'verbose': true });
done();
})();
});
it("should pull all needed images silently", function (done) {
this.timeout(600000);
(async () => {
await compose.pull();
done();
})();
});
it("should pull all needed images returning streams", function (done) {
this.timeout(600000);
(async () => {
var streams = await compose.pull(null, { 'streams': true });
expect(streams).to.be.ok;
done();
})();
});
});
describe('#up', function () {
it("should do compose up", function (done) {
this.timeout(60000);
(async () => {
var report = await compose.up();
expect(report.services).to.be.ok;
done();
})();
});
afterEach('clean up', function (done) {
this.timeout(60000);
(async () => {
await compose.down({ volumes: true });
done();
})();
});
});
describe('#down', function () {
beforeEach('bring up', function (done) {
this.timeout(20000);
(async () => {
await compose.up();
done();
})();
});
it("should do compose down", function (done) {
this.timeout(60000);
(async () => {
await compose.down({volumes: true});
let listContainers = await docker.listContainers({ 'all': true, 'filters': {"label":[`com.docker.compose.project=${compose.projectName}`]}});
expect(listContainers).to.be.empty
let listVolumes = await docker.listVolumes({ 'filters': {"label":[`com.docker.compose.project=${compose.projectName}`]}})
expect(listVolumes.Volumes).to.be.empty
expect(listVolumes.Warnings).to.be.null
let listNetworks = await docker.listNetworks({ 'filters': {"label":[`com.docker.compose.project=${compose.projectName}`]}})
expect(listNetworks).to.be.empty
done();
})();
});
});
describe('#up_complex', function () {
it("should do compose up complex example with extends and build", function (done) {
this.timeout(300000);
(async () => {
var report = await compose_complex.up();
expect(report.services).to.be.ok;
done();
})();
});
afterEach('clean up', function (done) {
this.timeout(60000);
(async () => {
await compose_complex.down({ volumes: true });
done();
})();
});
});
describe('#down_complex', function () {
beforeEach('bring up', function (done) {
this.timeout(300000);
(async () => {
await compose_complex.up();
done();
})();
});
it("should do compose down complex example with extends and build", function (done) {
this.timeout(60000);
(async () => {
await compose_complex.down({volumes: true});
let listContainers = await docker.listContainers({ 'all': true, 'filters': {"label":[`com.docker.compose.project=${compose.projectName}`]}});
expect(listContainers).to.be.empty
let listVolumes = await docker.listVolumes({ 'filters': {"label":[`com.docker.compose.project=${compose.projectName}`]}})
expect(listVolumes.Volumes).to.be.empty
expect(listVolumes.Warnings).to.be.null
let listNetworks = await docker.listNetworks({ 'filters': {"label":[`com.docker.compose.project=${compose.projectName}`]}})
expect(listNetworks).to.be.empty
done();
})();
});
});
describe('#up_build', function () {
it("should do compose up example with build", function (done) {
this.timeout(300000);
(async () => {
var report = await compose_build.up();
expect(report.services).to.be.ok;
done();
})();
});
it("should do compose up example with build(verbose)", function (done) {
this.timeout(300000);
(async () => {
var report = await compose_build.up({ 'verbose': true });
expect(report.services).to.be.ok;
done();
})();
});
afterEach('clean up', function (done) {
this.timeout(60000);
(async () => {
await compose_build.down({ volumes: true });
done();
})();
});
});
describe('#down_build', function () {
beforeEach('bring up', function (done) {
this.timeout(300000);
(async () => {
await compose_build.up();
done();
})();
});
it("should do compose down example with build", function (done) {
this.timeout(60000);
(async () => {
await compose_build.down({volumes: true});
let listContainers = await docker.listContainers({ 'all': true, 'filters': {"label":[`com.docker.compose.project=${compose.projectName}`]}});
expect(listContainers).to.be.empty
let listVolumes = await docker.listVolumes({ 'filters': {"label":[`com.docker.compose.project=${compose.projectName}`]}})
expect(listVolumes.Volumes).to.be.empty
expect(listVolumes.Warnings).to.be.null
let listNetworks = await docker.listNetworks({ 'filters': {"label":[`com.docker.compose.project=${compose.projectName}`]}})
expect(listNetworks).to.be.empty
done();
})();
});
});
describe('#up_build_context', function () {
it("should do compose up example with build", function (done) {
this.timeout(300000);
(async () => {
var report = await compose_build_context.up();
expect(report.services).to.be.ok;
done();
})();
});
it("should do compose up example with build(verbose)", function (done) {
this.timeout(300000);
(async () => {
await compose_build_context.up({ 'verbose': true });
done();
})();
});
afterEach('clean up', function (done) {
this.timeout(60000);
(async () => {
await compose_build_context.down({ volumes: true });
done();
})();
});
});
describe('#down_build_context', function () {
beforeEach('bring up', function (done) {
this.timeout(300000);
(async () => {
await compose_build_context.up();
done();
})();
});
it("should do compose down example with build", function (done) {
this.timeout(60000);
(async () => {
await compose_build_context.down({volumes: true});
let projectName = compose_build_context.projectName;
let listContainers = await docker.listContainers({ 'all': true, 'filters': {"label":[`com.docker.compose.project=${projectName}`]}});
expect(listContainers).to.be.empty
let listVolumes = await docker.listVolumes({ 'filters': {"label":[`com.docker.compose.project=${projectName}`]}})
expect(listVolumes.Volumes).to.be.empty
expect(listVolumes.Warnings).to.be.null
let listNetworks = await docker.listNetworks({ 'filters': {"label":[`com.docker.compose.project=${projectName}`]}})
expect(listNetworks).to.be.empty
done();
})();
});
});
});