testlab 1.9.2 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/spec/support/test ADDED
@@ -0,0 +1,27 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ MIIEpAIBAAKCAQEA8NDruvRyFkepElVms+Q1cKcG+lvpKGr4qwNZDrZeRdMNJS9u
3
+ KLGvh9JP3H9Fhwm0IJ9MKvQXeEGe2Tet5kwOevlcor3PVOes+GInytkhUfS0WqNy
4
+ o9kVzIB/YExm2JffKvwF8sjIGFDu54VuB/tlvon8Ea5JuyL+NxHNH8ddJ2CsfZqz
5
+ on6ColrjSVoJYlfK/49D6eYq4xPQD5BENxOxJTqbuQvUGPJBCSa+tZhMpeRe3ptA
6
+ rOyxRqbimpLeojvq3J84fFSpPOnVk7jJsPGooasynYfvf3INTl6O0+zKhXzn8Uef
7
+ hWiCApHZ6TgLX0lERkgkZdRIke9ihQ875xm6oQIDAQABAoIBAQClCln0WCF0WYpq
8
+ 8TKg6S8i1KX4oVMLCzz/Xx0C80Nq0Tj6GiaCJzyodh+be3I4GRNlJCd8bKtFFJv8
9
+ PKem5MsrxoiRVEqq4thtpj+lSugGFhIg6FHiLx48eHhTlCkMGhGtkOm2uZpA5/7D
10
+ l3OQbuANFN43c94+Lb5SGZYeSHD0UX2o1sscfwcNp59R0kUsOw+jAS+0OlllfJNU
11
+ wctko6uOhsonxkcp+V4e6lDfGnwcoV2n4jJnjIuFhntxwYBG2F24duLDi/t6i/d0
12
+ 7gCdO/M1WCvxJfAMhSrF73s5VpaG/5KtjXI1j6lR33Jih+iD4qn1l6jiEw3jZOlM
13
+ 0Q8mXwhBAoGBAPufvS6LqhklB9xIJNqADLP4jaIFwH7ydIcq1vmzMptcwEWkuym5
14
+ LY1VrfPqQ+FM3B64N2amFRiU7psdgGyOFjXzK+21Qgs8TKsNs/P6bWUGXt+G1UhV
15
+ RlKvMQrxwR81c1M8uVxU+73AUpvttwY1tWfndM9E88w4WcvxRDK2GjNZAoGBAPUB
16
+ EFUkXCP5AMOu/hiUDvtt5FClXXqmdtLtATJy4HZ0LwdNHBSzIOSxlTBmTSU1CUN0
17
+ T5UBXuxHfVnHA5Sq/Z4ndwBThmq8l3pTMUQnYMUSlvodf4x7ZqxTk3yeEQSz45yT
18
+ Z+NWiJNwLRq2jbf+90fhrLbz/4gvgUJfRkHGbkCJAoGAIm6RbLUf6aDvmm0k3eF3
19
+ 24i/mNRAqx5yY6yxDio/WpMunFkWY3c7jIOU8jO0ZjgmRu3eZuWDLYHzxLYcxL4M
20
+ vAUylaygBPmTZDTT0ycJoTFl+iBxPxysKtReWakLTEH8Lf+5PbFDYYvXwg6dZPQk
21
+ hrtdeJ9u3Rs47ndtZaMVosECgYEAjUCHwg6scLDml+sT4+e4m4zHzRcJxeSjLQgn
22
+ YIaKksB5PKRgRC7iD/eyI61XXNQu+wzbtPSNXXv58QCkN9o9TilCmpWNMYx5aLT9
23
+ +mUZjYUiNiE7oCqlD0VACuC2vxdXarYxdwg0xYwu9O+61RHST0b05KXX9RQuWa3E
24
+ O7fDaMECgYBK5H+CCZCNcqT4uHbOSETducq9G7YotvIDdv3B06DzEVdF/J7uZQXd
25
+ Cc5yTjcGRHH48doqu+9iI8o3445UtjFEesarek2MKMGFKpPWDbqzyqtu4R/UrgER
26
+ mps4uzrGtPgj5BX8rjSzeIcT+QdbGEv5DlxXi6Mh2RMP9CSxjgktRA==
27
+ -----END RSA PRIVATE KEY-----
@@ -0,0 +1 @@
1
+ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDw0Ou69HIWR6kSVWaz5DVwpwb6W+koavirA1kOtl5F0w0lL24osa+H0k/cf0WHCbQgn0wq9Bd4QZ7ZN63mTA56+Vyivc9U56z4YifK2SFR9LRao3Kj2RXMgH9gTGbYl98q/AXyyMgYUO7nhW4H+2W+ifwRrkm7Iv43Ec0fx10nYKx9mrOifoKiWuNJWgliV8r/j0Pp5irjE9APkEQ3E7ElOpu5C9QY8kEJJr61mEyl5F7em0Cs7LFGpuKakt6iO+rcnzh8VKk86dWTuMmw8aihqzKdh+9/cg1OXo7T7MqFfOfxR5+FaIICkdnpOAtfSURGSCRl1EiR72KFDzvnGbqh zpatten@zsp-desktop
data/spec/testlab_spec.rb CHANGED
@@ -38,70 +38,126 @@ describe TestLab do
38
38
 
39
39
  describe "methods" do
40
40
 
41
- describe "provision" do
42
- it "should provision the test lab" do
43
- subject.stub(:dead?) { false }
44
- subject.nodes.each do |node|
45
- node.stub(:provision) { true }
46
- end
47
- subject.containers.each do |container|
48
- container.stub(:provision) { true }
49
- end
50
- subject.networks.each do |network|
51
- network.stub(:provision) { true }
52
- end
53
- subject.provision
41
+ before(:each) do
42
+ TestLab::Node.any_instance.stub(:state) { :running }
43
+ end
44
+
45
+ describe "#config" do
46
+ it "should return the configuration hash for the lab" do
47
+ subject.config.should be_kind_of Hash
54
48
  end
55
49
  end
56
50
 
57
- describe "deprovision" do
58
- it "should deprovision the test lab" do
59
- subject.stub(:dead?) { false }
60
- subject.nodes.each do |node|
61
- node.stub(:deprovision) { true }
62
- end
63
- subject.containers.each do |container|
64
- container.stub(:deprovision) { true }
65
- end
66
- subject.networks.each do |network|
67
- network.stub(:deprovision) { true }
68
- end
69
- subject.deprovision
51
+ describe "#alive?" do
52
+ it "should return true if the lab is alive" do
53
+ subject.alive?.should == true
54
+ end
55
+ end
56
+
57
+ describe "#dead?" do
58
+ it "should return false if the lab is alive" do
59
+ subject.dead?.should == false
60
+ end
61
+ end
62
+
63
+ describe "#create" do
64
+ it "should online the lab" do
65
+ TestLab::Node.any_instance.stub(:create) { true }
66
+ TestLab::Container.any_instance.stub(:create) { true }
67
+ TestLab::Network.any_instance.stub(:create) { true }
68
+
69
+ subject.create
70
70
  end
71
71
  end
72
72
 
73
- describe "up" do
74
- it "should online the test lab" do
75
- subject.stub(:dead?) { false }
76
- subject.nodes.each do |node|
77
- node.stub(:up) { true }
78
- end
79
- subject.containers.each do |container|
80
- container.stub(:up) { true }
81
- end
82
- subject.networks.each do |network|
83
- network.stub(:up) { true }
84
- end
73
+ describe "#destroy" do
74
+ it "should offline the lab" do
75
+ TestLab::Node.any_instance.stub(:destroy) { true }
76
+ TestLab::Container.any_instance.stub(:destroy) { true }
77
+ TestLab::Network.any_instance.stub(:destroy) { true }
78
+
79
+ subject.destroy
80
+ end
81
+ end
82
+
83
+ describe "#up" do
84
+ it "should online the lab" do
85
+ TestLab::Node.any_instance.stub(:up) { true }
86
+ TestLab::Container.any_instance.stub(:up) { true }
87
+ TestLab::Network.any_instance.stub(:up) { true }
88
+
85
89
  subject.up
86
90
  end
87
91
  end
88
92
 
89
- describe "down" do
90
- it "should offline the test lab" do
91
- subject.stub(:dead?) { false }
92
- subject.nodes.each do |node|
93
- node.stub(:down) { true }
94
- end
95
- subject.containers.each do |container|
96
- container.stub(:down) { true }
97
- end
98
- subject.networks.each do |network|
99
- network.stub(:down) { true }
100
- end
93
+ describe "#down" do
94
+ it "should offline the lab" do
95
+ TestLab::Node.any_instance.stub(:down) { true }
96
+ TestLab::Container.any_instance.stub(:down) { true }
97
+ TestLab::Network.any_instance.stub(:down) { true }
98
+
101
99
  subject.down
102
100
  end
103
101
  end
104
102
 
103
+ describe "#provision" do
104
+ it "should provision the lab" do
105
+ TestLab::Node.any_instance.stub(:provision) { true }
106
+ TestLab::Container.any_instance.stub(:provision) { true }
107
+ TestLab::Network.any_instance.stub(:provision) { true }
108
+
109
+ subject.provision
110
+ end
111
+ end
112
+
113
+ describe "#deprovision" do
114
+ it "should deprovision the lab" do
115
+ TestLab::Node.any_instance.stub(:deprovision) { true }
116
+ TestLab::Container.any_instance.stub(:deprovision) { true }
117
+ TestLab::Network.any_instance.stub(:deprovision) { true }
118
+
119
+ subject.deprovision
120
+ end
121
+ end
122
+
123
+ describe "#build" do
124
+ it "should build the lab" do
125
+ TestLab::Node.any_instance.stub(:build) { true }
126
+ TestLab::Container.any_instance.stub(:build) { true }
127
+ TestLab::Network.any_instance.stub(:build) { true }
128
+
129
+ subject.build
130
+ end
131
+ end
132
+
133
+ describe "#demolish" do
134
+ it "should demolish the lab" do
135
+ TestLab::Node.any_instance.stub(:demolish) { true }
136
+ TestLab::Container.any_instance.stub(:demolish) { true }
137
+ TestLab::Network.any_instance.stub(:demolish) { true }
138
+
139
+ subject.demolish
140
+ end
141
+ end
142
+
143
+ describe "#bounce" do
144
+ it "should bounce the lab" do
145
+ subject.stub(:down) { true }
146
+ subject.stub(:up) { true }
147
+
148
+ subject.bounce
149
+ end
150
+ end
151
+
152
+ describe "#recycle" do
153
+ it "should recycle the lab" do
154
+ subject.stub(:demolish) { true }
155
+ subject.stub(:build) { true }
156
+
157
+ subject.recycle
158
+ end
159
+ end
160
+
105
161
  end
106
162
 
107
163
 
@@ -0,0 +1,100 @@
1
+ ################################################################################
2
+ #
3
+ # Author: Zachary Patten <zachary AT jovelabs DOT com>
4
+ # Copyright: Copyright (c) Zachary Patten
5
+ # License: Apache License, Version 2.0
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+ ################################################################################
20
+ require "spec_helper"
21
+ require "gli"
22
+
23
+ describe TestLab::Utility::Logger do
24
+
25
+ subject {
26
+ TestLab::Utility::Logger
27
+ }
28
+
29
+ describe "class" do
30
+
31
+ it "should be an instance of TestLab::Utility::Logger" do
32
+ subject.should be TestLab::Utility::Logger
33
+ end
34
+
35
+ end
36
+
37
+ describe "methods" do
38
+
39
+ subject {
40
+ @ui = ui_helper
41
+ @testlab = testlab_helper(:ui => @ui)
42
+ @testlab.boot
43
+
44
+ class A
45
+ extend TestLab::Utility::Logger
46
+ end
47
+ A
48
+ }
49
+
50
+ describe "#log_config" do
51
+ it "should return a hash of data when given a testlab instance" do
52
+ subject.log_config(@testlab).should_not be_nil
53
+ subject.log_config(@testlab).should_not be_empty
54
+ subject.log_config(@testlab).should be_kind_of(Hash)
55
+ end
56
+ end
57
+
58
+ describe "#log_details" do
59
+ it "should return a hash of data when given a testlab instance" do
60
+ subject.log_details(@testlab).should_not be_nil
61
+ subject.log_details(@testlab).should_not be_empty
62
+ subject.log_details(@testlab).should be_kind_of(Hash)
63
+ end
64
+ end
65
+
66
+ describe "#log_ruby" do
67
+ it "should return a hash of data when given a testlab instance" do
68
+ subject.log_ruby(@testlab).should_not be_nil
69
+ subject.log_ruby(@testlab).should_not be_empty
70
+ subject.log_ruby(@testlab).should be_kind_of(Hash)
71
+ end
72
+ end
73
+
74
+ describe "#log_gem_dependencies" do
75
+ it "should return a hash of data when given a testlab instance" do
76
+ subject.log_gem_dependencies(@testlab).should_not be_nil
77
+ subject.log_gem_dependencies(@testlab).should_not be_empty
78
+ subject.log_gem_dependencies(@testlab).should be_kind_of(Hash)
79
+ end
80
+ end
81
+
82
+ describe "#log_external_dependencies" do
83
+ it "should return a hash of data when given a testlab instance" do
84
+ subject.log_external_dependencies(@testlab).should_not be_nil
85
+ subject.log_external_dependencies(@testlab).should_not be_empty
86
+ subject.log_external_dependencies(@testlab).should be_kind_of(Hash)
87
+ end
88
+ end
89
+
90
+ describe "#log_header" do
91
+ it "should return a hash of data when given a testlab instance" do
92
+ subject.log_header(@testlab).should_not be_nil
93
+ subject.log_header(@testlab).should_not be_empty
94
+ subject.log_header(@testlab).should be_kind_of(Array)
95
+ end
96
+ end
97
+
98
+ end
99
+
100
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testlab
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.2
4
+ version: 1.10.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-23 00:00:00.000000000 Z
12
+ date: 2013-10-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gli
@@ -237,6 +237,7 @@ files:
237
237
  - lib/commands/container.rb
238
238
  - lib/commands/network.rb
239
239
  - lib/commands/node.rb
240
+ - lib/commands/support.rb
240
241
  - lib/commands/testlab.rb
241
242
  - lib/testlab.rb
242
243
  - lib/testlab/container.rb
@@ -247,7 +248,6 @@ files:
247
248
  - lib/testlab/container/interface.rb
248
249
  - lib/testlab/container/io.rb
249
250
  - lib/testlab/container/lxc.rb
250
- - lib/testlab/container/method_missing.rb
251
251
  - lib/testlab/container/provision.rb
252
252
  - lib/testlab/container/ssh.rb
253
253
  - lib/testlab/container/status.rb
@@ -313,21 +313,25 @@ files:
313
313
  - lib/testlab/user/lifecycle.rb
314
314
  - lib/testlab/utility.rb
315
315
  - lib/testlab/utility/cidr.rb
316
- - lib/testlab/utility/gli.rb
317
316
  - lib/testlab/utility/logger.rb
318
317
  - lib/testlab/utility/misc.rb
319
318
  - lib/testlab/version.rb
320
319
  - spec/container_spec.rb
321
320
  - spec/interface_spec.rb
321
+ - spec/labfile_spec.rb
322
322
  - spec/network_spec.rb
323
323
  - spec/node_spec.rb
324
324
  - spec/provider_spec.rb
325
+ - spec/providers/vagrant_spec.rb
325
326
  - spec/provisioner_spec.rb
326
- - spec/provisioners/shell_spec.rb
327
+ - spec/provisioners/generic_spec.rb
327
328
  - spec/spec_helper.rb
328
329
  - spec/support/Labfile
329
330
  - spec/support/install-lxc.sh
331
+ - spec/support/test
332
+ - spec/support/test.pub
330
333
  - spec/testlab_spec.rb
334
+ - spec/utility/logger_spec.rb
331
335
  - spec/utility_spec.rb
332
336
  - testlab.gemspec
333
337
  homepage: http://hackers.lookout.com/testlab/
@@ -345,7 +349,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
345
349
  version: '0'
346
350
  segments:
347
351
  - 0
348
- hash: 1176029295560886887
352
+ hash: 2948791884791380113
349
353
  required_rubygems_version: !ruby/object:Gem::Requirement
350
354
  none: false
351
355
  requirements:
@@ -354,7 +358,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
354
358
  version: '0'
355
359
  segments:
356
360
  - 0
357
- hash: 1176029295560886887
361
+ hash: 2948791884791380113
358
362
  requirements: []
359
363
  rubyforge_project:
360
364
  rubygems_version: 1.8.25
@@ -372,14 +376,19 @@ test_files:
372
376
  - features/testlab.feature
373
377
  - spec/container_spec.rb
374
378
  - spec/interface_spec.rb
379
+ - spec/labfile_spec.rb
375
380
  - spec/network_spec.rb
376
381
  - spec/node_spec.rb
377
382
  - spec/provider_spec.rb
383
+ - spec/providers/vagrant_spec.rb
378
384
  - spec/provisioner_spec.rb
379
- - spec/provisioners/shell_spec.rb
385
+ - spec/provisioners/generic_spec.rb
380
386
  - spec/spec_helper.rb
381
387
  - spec/support/Labfile
382
388
  - spec/support/install-lxc.sh
389
+ - spec/support/test
390
+ - spec/support/test.pub
383
391
  - spec/testlab_spec.rb
392
+ - spec/utility/logger_spec.rb
384
393
  - spec/utility_spec.rb
385
394
  has_rdoc:
@@ -1,22 +0,0 @@
1
- class TestLab
2
- class Container
3
-
4
- module MethodMissing
5
-
6
- # Provisioner method handler
7
- #
8
- # Proxies missing methods to the containers defined provisioner, if any.
9
- def method_missing(method_name, *method_args)
10
- @ui.logger.debug { "CONTAINER METHOD MISSING: #{method_name.inspect}(#{method_args.inspect})" }
11
-
12
- if (defined?(@provisioner) && @provisioner.respond_to?(method_name))
13
- @provisioner.send(method_name, [self, *method_args].flatten)
14
- else
15
- super(method_name, *method_args)
16
- end
17
- end
18
-
19
- end
20
-
21
- end
22
- end
@@ -1,97 +0,0 @@
1
- class TestLab
2
- module Utility
3
-
4
- # GLI Module
5
- #
6
- # @author Zachary Patten <zachary AT jovelabs DOT com>
7
- module GLI
8
- require 'ztk'
9
-
10
- LAB_ACTION_ORDER = %W(build demolish recycle bounce create destroy up down provision deprovision).map(&:to_sym)
11
-
12
- LAB_ACTIONS = {
13
- :create => ["Initialize %s", "Attempts to create the <%= @component %>."],
14
- :destroy => ["Terminate %s", "Attempts to destroy the <%= @component %>."],
15
- :up => ["On-line %s", "Attempts to online the <%= @component %>."],
16
- :down => ["Off-line %s", "Attempts to offline the <%= @component %>."],
17
- :provision => ["Provision %s", "Attempts to provision the <%= @component %>."],
18
- :deprovision => ["De-provision %s", "Attempts to deprovision the <%= @component %>."],
19
- :bounce => ["Bounce %s (down->up)", <<-EOF],
20
- Attempts to bounce the <%= @component %>. TestLab will attempt to offline, then online the <%= @component %>.
21
-
22
- The <%= @component %> are taken through the following states:
23
-
24
- Current -> Down -> Up
25
- EOF
26
- :recycle => ["Recycle %s (demolish->build)", <<-EOF],
27
- Attempts to recycle the <%= @component %>. TestLab will attempt to demolish, then build the <%= @component %>.
28
-
29
- The <%= @component %> are taken through the following states:
30
-
31
- Current -> Demolish -> Build
32
- EOF
33
- :build => ["Build %s (create->up->provision)", <<-EOF],
34
- Attempts to build the <%= @component %>. TestLab will attempt to create, online and provision the <%= @component %>.
35
-
36
- The <%= @component %> are taken through the following states:
37
-
38
- Current -> Create -> Up -> Provision
39
- EOF
40
- :demolish => ["Demolish %s (deprovision->down->destroy)", <<-EOF]
41
- Attempts to demolish the <%= @component %>. TestLab will attempt to deprovision, offline and destroy the <%= @component %>.
42
-
43
- The <%= @component %> are taken through the following states:
44
-
45
- Current -> Deprovision -> Down -> Destroy
46
- EOF
47
- }
48
-
49
- def build_lab_commands(component, klass, &block)
50
- desc %(Manage lab #{component}s)
51
- command component do |c|
52
- c.desc %(Optional #{component} ID or comma separated list of #{component} IDs)
53
- c.arg_name %(#{component}[,#{component},...])
54
- c.flag [:n, :name]
55
-
56
- LAB_ACTION_ORDER.each do |lab_action|
57
- action_desc = LAB_ACTIONS[lab_action]
58
- c.desc(action_desc.first % "#{component}s")
59
- c.long_desc(ZTK::Template.string(action_desc.last, {:component => "#{component}s"}))
60
-
61
- c.command lab_action do |la|
62
- la.action do |global_options, options, args|
63
- iterate_objects_by_name(options[:name], klass) do |object|
64
- object.send(lab_action)
65
- end
66
- end
67
- end
68
- end
69
-
70
- !block.nil? and block.call(c)
71
- end
72
- end
73
-
74
- def iterate_objects_by_name(name, klass, &block)
75
- objects = Array.new
76
- klass_name = klass.to_s.split('::').last.downcase
77
-
78
- if name.nil?
79
- objects = klass.all.select{ |object| (!object.template rescue true) }
80
- else
81
- names = name.split(',')
82
- objects = klass.find(names).select{ |object| (!object.template rescue true) }
83
- end
84
-
85
- (objects.nil? || (objects.count == 0)) and raise TestLab::TestLabError, "We could not find any of the #{klass_name}s you supplied!"
86
-
87
- objects.each do |object|
88
- !block.nil? and block.call(object)
89
- end
90
-
91
- objects
92
- end
93
-
94
- end
95
-
96
- end
97
- end
@@ -1,71 +0,0 @@
1
- ################################################################################
2
- #
3
- # Author: Zachary Patten <zachary AT jovelabs DOT com>
4
- # Copyright: Copyright (c) Zachary Patten
5
- # License: Apache License, Version 2.0
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
- ################################################################################
20
- require "spec_helper"
21
-
22
- describe TestLab::Provisioner::Shell do
23
-
24
- subject {
25
- @ui = ZTK::UI.new(:stdout => StringIO.new, :stderr => StringIO.new)
26
- @testlab = TestLab.new(:repo_dir => REPO_DIR, :labfile_path => LABFILE_PATH, :ui => @ui)
27
- @testlab.boot
28
- TestLab::Container.first('server-shell')
29
- }
30
-
31
- describe "class" do
32
-
33
- it "should be an instance of TestLab::Provisioner::Shell" do
34
- subject.provisioners.last.new(subject.config, @ui).should be_an_instance_of TestLab::Provisioner::Shell
35
- end
36
-
37
- end
38
-
39
- describe "methods" do
40
-
41
- describe "provision" do
42
- context "bootstrap successful" do
43
- it "should provision the container" do
44
- subject.node.ssh.stub(:file).and_yield(StringIO.new)
45
- subject.stub(:fs_root) { "/var/lib/lxc/#{subject.id}/rootfs" }
46
- subject.ssh.stub(:bootstrap) { "" }
47
- subject.lxc.stub(:bootstrap) { "" }
48
- subject.lxc_clone.stub(:exists?) { false }
49
-
50
- p = TestLab::Provisioner::Shell.new(subject.config, @ui)
51
- p.on_container_provision(subject)
52
- end
53
- end
54
-
55
- context "bootstrap fails" do
56
- it "should raise an exception" do
57
- subject.node.ssh.stub(:file).and_yield(StringIO.new)
58
- subject.stub(:fs_root) { "/var/lib/lxc/#{subject.id}/rootfs" }
59
- subject.ssh.stub(:bootstrap) { "" }
60
- subject.lxc.stub(:bootstrap) { "" }
61
- subject.lxc_clone.stub(:exists?) { false }
62
-
63
- p = TestLab::Provisioner::Shell.new(Hash.new, @ui)
64
- lambda{ p.on_container_provision(subject) }.should raise_error TestLab::Provisioner::ShellError
65
- end
66
- end
67
- end
68
-
69
- end
70
-
71
- end