testlab 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -181,7 +181,17 @@ class TestLab
181
181
  @ui.logger.debug { "command == #{command.inspect}" }
182
182
 
183
183
  render_vagrantfile
184
- ZTK::Command.new(:ui => @ui, :silence => true).exec(command)
184
+ result = ZTK::Command.new(:ui => @ui, :silence => true, :ignore_exit_status => true).exec(command)
185
+
186
+ if result.exit_code != 0
187
+ @ui.stderr.puts
188
+ @ui.stderr.puts
189
+ @ui.stderr.puts(result.output)
190
+
191
+ raise VagrantError, "Vagrant failed to execute!"
192
+ end
193
+
194
+ result
185
195
  end
186
196
 
187
197
  def render_vagrantfile
@@ -1,6 +1,6 @@
1
1
  class TestLab
2
2
  unless const_defined?(:VERSION)
3
3
  # TestLab Gem Version
4
- VERSION = "0.8.3"
4
+ VERSION = "0.8.4"
5
5
  end
6
6
  end
@@ -23,7 +23,7 @@ describe TestLab::Container do
23
23
 
24
24
  subject {
25
25
  @ui = ZTK::UI.new(:stdout => StringIO.new, :stderr => StringIO.new)
26
- @testlab = TestLab.new(:labfile_path => LABFILE, :ui => @ui)
26
+ @testlab = TestLab.new(:repo_dir => REPO_DIR, :labfile_path => LABFILE_PATH, :ui => @ui)
27
27
  @testlab.boot
28
28
  @testlab.containers.first
29
29
  }
@@ -207,7 +207,7 @@ describe TestLab::Container do
207
207
 
208
208
  context "with the shell provisioner" do
209
209
  it "should setup the container" do
210
- subject = TestLab::Container.first('server-shell')
210
+ subject and (subject = TestLab::Container.first('server-shell'))
211
211
 
212
212
  subject.node.stub(:state) { :running }
213
213
  subject.lxc.stub(:exists?) { true }
@@ -233,7 +233,7 @@ describe TestLab::Container do
233
233
 
234
234
  context "with the shell provisioner" do
235
235
  it "should teardown the container" do
236
- subject = TestLab::Container.first('server-shell')
236
+ subject and (subject = TestLab::Container.first('server-shell'))
237
237
 
238
238
  subject.node.stub(:state) { :running }
239
239
  subject.lxc.stub(:exists?) { true }
data/spec/network_spec.rb CHANGED
@@ -23,7 +23,7 @@ describe TestLab::Network do
23
23
 
24
24
  subject {
25
25
  @ui = ZTK::UI.new(:stdout => StringIO.new, :stderr => StringIO.new)
26
- @testlab = TestLab.new(:labfile_path => LABFILE, :ui => @ui)
26
+ @testlab = TestLab.new(:repo_dir => REPO_DIR, :labfile_path => LABFILE_PATH, :ui => @ui)
27
27
  @testlab.boot
28
28
  @testlab.networks.first
29
29
  }
data/spec/node_spec.rb CHANGED
@@ -23,7 +23,7 @@ describe TestLab::Node do
23
23
 
24
24
  subject {
25
25
  @ui = ZTK::UI.new(:stdout => StringIO.new, :stderr => StringIO.new)
26
- @testlab = TestLab.new(:labfile_path => LABFILE, :ui => @ui)
26
+ @testlab = TestLab.new(:repo_dir => REPO_DIR, :labfile_path => LABFILE_PATH, :ui => @ui)
27
27
  @testlab.boot
28
28
  @testlab.nodes.first
29
29
  }
@@ -23,7 +23,7 @@ describe TestLab::Provisioner::Shell do
23
23
 
24
24
  subject {
25
25
  @ui = ZTK::UI.new(:stdout => StringIO.new, :stderr => StringIO.new)
26
- @testlab = TestLab.new(:labfile_path => LABFILE, :ui => @ui)
26
+ @testlab = TestLab.new(:repo_dir => REPO_DIR, :labfile_path => LABFILE_PATH, :ui => @ui)
27
27
  @testlab.boot
28
28
  TestLab::Container.first('server-shell')
29
29
  }
data/spec/spec_helper.rb CHANGED
@@ -22,4 +22,15 @@ Coveralls.wear!
22
22
  ################################################################################
23
23
  require 'testlab'
24
24
 
25
- LABFILE = File.join(File.dirname(__FILE__), 'support', 'Labfile')
25
+ REPO_DIR = File.join(File.dirname(__FILE__), 'support')
26
+ LABFILE_PATH = File.join(REPO_DIR, 'Labfile')
27
+
28
+ RSpec.configure do |config|
29
+ config.before(:each) do
30
+ TestLab::Node.purge
31
+ TestLab::Container.purge
32
+ TestLab::Network.purge
33
+ TestLab::Interface.purge
34
+ TestLab::User.purge
35
+ end
36
+ end
data/spec/testlab_spec.rb CHANGED
@@ -23,7 +23,7 @@ describe TestLab do
23
23
 
24
24
  subject {
25
25
  @ui = ZTK::UI.new(:stdout => StringIO.new, :stderr => StringIO.new)
26
- @testlab = TestLab.new(:labfile_path => LABFILE, :ui => @ui)
26
+ @testlab = TestLab.new(:repo_dir => REPO_DIR, :labfile_path => LABFILE_PATH, :ui => @ui)
27
27
  @testlab.boot
28
28
  @testlab
29
29
  }
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: 0.8.3
4
+ version: 0.8.4
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-07-03 00:00:00.000000000 Z
12
+ date: 2013-07-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gli
@@ -327,18 +327,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
327
327
  - - ! '>='
328
328
  - !ruby/object:Gem::Version
329
329
  version: '0'
330
- segments:
331
- - 0
332
- hash: 1734275304878040822
333
330
  required_rubygems_version: !ruby/object:Gem::Requirement
334
331
  none: false
335
332
  requirements:
336
333
  - - ! '>='
337
334
  - !ruby/object:Gem::Version
338
335
  version: '0'
339
- segments:
340
- - 0
341
- hash: 1734275304878040822
342
336
  requirements: []
343
337
  rubyforge_project:
344
338
  rubygems_version: 1.8.25