testlab 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/testlab/version.rb +1 -1
- data/spec/container_spec.rb +26 -5
- data/spec/network_spec.rb +16 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjVlY2RkMzUzYzVhZjA4NTBlM2FjMDQxZjJiMzY0ZTEwOTgwMTExYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzQwNzNmZDcxYmUzZjBhNjEwYTAzZWMxYjA1YTgyNDU3MzViMmFhYw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2VmM2YwZDg1YmUzNTliNGQ3ODhlNGYyY2YyYzU2YzliZmY3NTM3MmMxNDI0
|
10
|
+
Zjc1YjJlODYxYWIyNzJiYjZkMWQzNGU3MTM1ODc4MTdlYTM1OWRlNDVlNGU5
|
11
|
+
ZjRmMzIwODA1NThjZTUzYWEwMzQxZjJiYTJkYmYzMmYzY2Q5ZTI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
N2UwN2Q2ZjE5YWMzNTUxZTkzNWU1NDM4MjMwM2NkN2EyYjQwNDhhMWViZGY2
|
14
|
+
MTg1NmIwNzZjNDdjNjRkY2JlYjNjY2FmZDMwNTY0NTU5YmYxYzRhMTFjMWJj
|
15
|
+
ZDJiNDQ5OTA0YjI4N2I2MDlkYTkxYTY2MWU5NjBhMjNjZTAxMzM=
|
data/lib/testlab/version.rb
CHANGED
data/spec/container_spec.rb
CHANGED
@@ -22,7 +22,8 @@ require "spec_helper"
|
|
22
22
|
describe TestLab::Container do
|
23
23
|
|
24
24
|
subject {
|
25
|
-
@
|
25
|
+
@logger = ZTK::Logger.new('/tmp/test.log')
|
26
|
+
@ui = ZTK::UI.new(:stdout => StringIO.new, :stderr => StringIO.new, :logger => @logger)
|
26
27
|
@testlab = TestLab.new(:repo_dir => REPO_DIR, :labfile_path => LABFILE_PATH, :ui => @ui)
|
27
28
|
@testlab.boot
|
28
29
|
@testlab.containers.first
|
@@ -52,6 +53,7 @@ describe TestLab::Container do
|
|
52
53
|
|
53
54
|
describe "#status" do
|
54
55
|
it "should return a hash of status information about the container" do
|
56
|
+
subject.node.stub(:dead?) { false }
|
55
57
|
subject.node.stub(:state) { :running }
|
56
58
|
subject.lxc.stub(:state) { :not_created }
|
57
59
|
subject.lxc_clone.stub(:exists?) { false }
|
@@ -150,13 +152,17 @@ describe TestLab::Container do
|
|
150
152
|
|
151
153
|
describe "#create" do
|
152
154
|
it "should create the container" do
|
155
|
+
subject.node.stub(:alive?) { true }
|
153
156
|
subject.node.stub(:state) { :running }
|
154
|
-
subject.
|
155
|
-
|
157
|
+
subject.node.ssh.stub(:exec)
|
158
|
+
|
156
159
|
subject.lxc.stub(:create) { true }
|
157
160
|
subject.lxc.stub(:state) { :not_created }
|
161
|
+
subject.lxc.config.stub(:save) { true }
|
162
|
+
|
158
163
|
subject.lxc_clone.stub(:exists?) { false }
|
159
|
-
|
164
|
+
|
165
|
+
subject.stub(:detect_arch) { "amd64" }
|
160
166
|
subject.stub(:provisioners) { Array.new }
|
161
167
|
|
162
168
|
subject.create
|
@@ -165,12 +171,16 @@ describe TestLab::Container do
|
|
165
171
|
|
166
172
|
describe "#destroy" do
|
167
173
|
it "should destroy the container" do
|
174
|
+
subject.node.stub(:alive?) { true }
|
168
175
|
subject.node.stub(:state) { :running }
|
176
|
+
|
169
177
|
subject.lxc.stub(:exists?) { true }
|
170
178
|
subject.lxc.stub(:state) { :stopped }
|
171
179
|
subject.lxc.stub(:destroy) { true }
|
180
|
+
|
172
181
|
subject.lxc_clone.stub(:exists?) { false }
|
173
182
|
subject.lxc_clone.stub(:destroy) { false }
|
183
|
+
|
174
184
|
subject.stub(:provisioners) { Array.new }
|
175
185
|
|
176
186
|
subject.destroy
|
@@ -179,16 +189,21 @@ describe TestLab::Container do
|
|
179
189
|
|
180
190
|
describe "#up" do
|
181
191
|
it "should up the container" do
|
192
|
+
subject.node.stub(:dead?) { false }
|
193
|
+
subject.node.stub(:alive?) { true }
|
182
194
|
subject.node.stub(:state) { :running }
|
195
|
+
subject.node.stub(:arch) { "x86_64" }
|
196
|
+
subject.node.stub(:exec) { }
|
183
197
|
|
184
198
|
subject.lxc.stub(:exists?) { true }
|
185
199
|
subject.lxc.stub(:start) { true }
|
186
200
|
subject.lxc.stub(:wait) { true }
|
187
201
|
subject.lxc.stub(:state) { :running }
|
188
|
-
subject.lxc.stub(:attach)
|
189
202
|
|
190
203
|
subject.lxc_clone.stub(:exists?) { false }
|
191
204
|
|
205
|
+
subject.stub(:exec) { }
|
206
|
+
subject.stub(:configure) { }
|
192
207
|
subject.stub(:provisioners) { Array.new }
|
193
208
|
|
194
209
|
ZTK::TCPSocketCheck.any_instance.stub(:wait) { true }
|
@@ -199,6 +214,8 @@ describe TestLab::Container do
|
|
199
214
|
|
200
215
|
describe "#down" do
|
201
216
|
it "should down the container" do
|
217
|
+
subject.node.stub(:dead?) { false }
|
218
|
+
subject.node.stub(:alive?) { true }
|
202
219
|
subject.node.stub(:state) { :running }
|
203
220
|
|
204
221
|
subject.lxc.stub(:exists?) { true }
|
@@ -217,6 +234,7 @@ describe TestLab::Container do
|
|
217
234
|
describe "#provision" do
|
218
235
|
context "with no provisioner" do
|
219
236
|
it "should provision the container" do
|
237
|
+
subject.node.stub(:alive?) { true }
|
220
238
|
subject.node.stub(:state) { :running }
|
221
239
|
|
222
240
|
subject.lxc.stub(:exists?) { true }
|
@@ -234,6 +252,7 @@ describe TestLab::Container do
|
|
234
252
|
it "should provision the container" do
|
235
253
|
subject and (subject = TestLab::Container.first('server-shell'))
|
236
254
|
|
255
|
+
subject.node.stub(:alive?) { true }
|
237
256
|
subject.node.stub(:state) { :running }
|
238
257
|
|
239
258
|
subject.lxc.stub(:exists?) { true }
|
@@ -251,6 +270,7 @@ describe TestLab::Container do
|
|
251
270
|
describe "#deprovision" do
|
252
271
|
context "with no provisioner" do
|
253
272
|
it "should deprovision the container" do
|
273
|
+
subject.node.stub(:alive?) { true }
|
254
274
|
subject.node.stub(:state) { :running }
|
255
275
|
|
256
276
|
subject.lxc.stub(:exists?) { true }
|
@@ -268,6 +288,7 @@ describe TestLab::Container do
|
|
268
288
|
it "should deprovision the container" do
|
269
289
|
subject and (subject = TestLab::Container.first('server-shell'))
|
270
290
|
|
291
|
+
subject.node.stub(:alive?) { true }
|
271
292
|
subject.node.stub(:state) { :running }
|
272
293
|
|
273
294
|
subject.lxc.stub(:exists?) { true }
|
data/spec/network_spec.rb
CHANGED
@@ -110,9 +110,11 @@ describe TestLab::Network do
|
|
110
110
|
|
111
111
|
describe "#create" do
|
112
112
|
it "should create the network bridge" do
|
113
|
+
subject.node.stub(:alive?) { true }
|
113
114
|
subject.node.stub(:state) { :running }
|
114
|
-
subject.stub(:state) { :not_created }
|
115
115
|
subject.node.ssh.stub(:bootstrap) { true }
|
116
|
+
|
117
|
+
subject.stub(:state) { :not_created }
|
116
118
|
subject.stub(:provisioners) { Array.new }
|
117
119
|
|
118
120
|
subject.create
|
@@ -121,9 +123,11 @@ describe TestLab::Network do
|
|
121
123
|
|
122
124
|
describe "#destroy" do
|
123
125
|
it "should destroy the network bridge" do
|
126
|
+
subject.node.stub(:alive?) { true }
|
124
127
|
subject.node.stub(:state) { :running }
|
125
|
-
subject.stub(:state) { :stopped }
|
126
128
|
subject.node.ssh.stub(:bootstrap) { true }
|
129
|
+
|
130
|
+
subject.stub(:state) { :stopped }
|
127
131
|
subject.stub(:provisioners) { Array.new }
|
128
132
|
|
129
133
|
subject.destroy
|
@@ -132,9 +136,11 @@ describe TestLab::Network do
|
|
132
136
|
|
133
137
|
describe "#up" do
|
134
138
|
it "should online the network bridge" do
|
139
|
+
subject.node.stub(:alive?) { true }
|
135
140
|
subject.node.stub(:state) { :running }
|
136
|
-
subject.stub(:state) { :stopped }
|
137
141
|
subject.node.ssh.stub(:bootstrap) { true }
|
142
|
+
|
143
|
+
subject.stub(:state) { :stopped }
|
138
144
|
subject.stub(:provisioners) { Array.new }
|
139
145
|
|
140
146
|
subject.up
|
@@ -143,9 +149,11 @@ describe TestLab::Network do
|
|
143
149
|
|
144
150
|
describe "#down" do
|
145
151
|
it "should offline the network bridge" do
|
152
|
+
subject.node.stub(:alive?) { true }
|
146
153
|
subject.node.stub(:state) { :running }
|
147
|
-
subject.stub(:state) { :running }
|
148
154
|
subject.node.ssh.stub(:bootstrap) { true }
|
155
|
+
|
156
|
+
subject.stub(:state) { :running }
|
149
157
|
subject.stub(:provisioners) { Array.new }
|
150
158
|
|
151
159
|
subject.down
|
@@ -154,7 +162,9 @@ describe TestLab::Network do
|
|
154
162
|
|
155
163
|
describe "#provision" do
|
156
164
|
it "should create and online the network" do
|
165
|
+
subject.node.stub(:alive?) { true }
|
157
166
|
subject.node.stub(:state) { :running }
|
167
|
+
|
158
168
|
subject.stub(:state) { :running }
|
159
169
|
subject.stub(:create) { true }
|
160
170
|
subject.stub(:up) { true }
|
@@ -166,7 +176,9 @@ describe TestLab::Network do
|
|
166
176
|
|
167
177
|
describe "#deprovision" do
|
168
178
|
it "should create and online the network" do
|
179
|
+
subject.node.stub(:alive?) { true }
|
169
180
|
subject.node.stub(:state) { :running }
|
181
|
+
|
170
182
|
subject.stub(:state) { :running }
|
171
183
|
subject.stub(:down) { true }
|
172
184
|
subject.stub(:destroy) { true }
|