beaker 1.12.2 → 1.13.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.
@@ -11,8 +11,8 @@ module Beaker
11
11
  expect( host ).to be_a_kind_of Windows::Host
12
12
  end
13
13
 
14
- it 'defaults to a unix host' do
15
- expect( host ).to be_a_kind_of Unix::Host
14
+ it 'defaults to a unix host' do
15
+ expect( host ).to be_a_kind_of Unix::Host
16
16
  end
17
17
 
18
18
  it 'can be read like a hash' do
@@ -189,5 +189,6 @@ module Beaker
189
189
  end
190
190
 
191
191
  end
192
+
192
193
  end
193
194
  end
@@ -128,7 +128,7 @@ module Beaker
128
128
  end
129
129
 
130
130
  it 'should start the container' do
131
- container.should_receive(:start).with({'PublishAllPorts' => true})
131
+ container.should_receive(:start).with({'PublishAllPorts' => true, 'Privileged' => true})
132
132
 
133
133
  docker.provision
134
134
  end
@@ -6,14 +6,14 @@ module Beaker
6
6
 
7
7
  let(:parser) {Beaker::Options::CommandLineParser.new}
8
8
  let(:test_opts) {["-h", "vcloud.cfg", "--debug", "--tests", "test.rb", "--help"]}
9
- let(:full_opts) {["--hosts", "host.cfg", "--options", "opts_file", "--type", "pe", "--helper", "path_to_helper", "--load-path", "load_path", "--tests", "test1.rb,test2.rb,test3.rb", "--pre-suite", "pre_suite.rb", "--post-suite", "post_suite.rb", "--no-provision", "--preserve-hosts", "always", "--root-keys", "--keyfile", "../.ssh/id_rsa", "--install", "gitrepopath", "-m", "module", "-q", "--no-xml", "--dry-run", "--no-ntp", "--repo-proxy", "--add-el-extras", "--config", "anotherfile.cfg", "--fail-mode", "fast", "--no-color", "--version", "--log-level", "info", "--package-proxy", "http://192.168.100.1:3128"]}
9
+ let(:full_opts) {["--hosts", "host.cfg", "--options", "opts_file", "--type", "pe", "--helper", "path_to_helper", "--load-path", "load_path", "--tests", "test1.rb,test2.rb,test3.rb", "--pre-suite", "pre_suite.rb", "--post-suite", "post_suite.rb", "--no-provision", "--preserve-hosts", "always", "--root-keys", "--keyfile", "../.ssh/id_rsa", "--install", "gitrepopath", "-m", "module", "-q", "--dry-run", "--no-ntp", "--repo-proxy", "--add-el-extras", "--config", "anotherfile.cfg", "--fail-mode", "fast", "--no-color", "--version", "--log-level", "info", "--package-proxy", "http://192.168.100.1:3128"]}
10
10
 
11
11
  it "can correctly read command line input" do
12
12
  expect(parser.parse(test_opts)).to be === {:hosts_file=>"vcloud.cfg", :log_level=>"debug", :tests=>"test.rb", :help=>true}
13
13
  end
14
14
 
15
15
  it "supports all our command line options" do
16
- expect(parser.parse(full_opts)).to be === {:hosts_file=>"anotherfile.cfg", :options_file=>"opts_file", :type=>"pe", :helper=>"path_to_helper", :load_path=>"load_path", :tests=>"test1.rb,test2.rb,test3.rb", :pre_suite=>"pre_suite.rb", :post_suite=>"post_suite.rb", :provision=>false, :preserve_hosts=>"always", :root_keys=>true, :keyfile=>"../.ssh/id_rsa", :install=>"gitrepopath", :modules=>"module", :quiet=>true, :xml=>false, :dry_run=>true, :timesync=>false, :repo_proxy=>true, :add_el_extras=>true, :fail_mode=>"fast", :color=>false, :version=>true, :log_level=>"info", :package_proxy => "http://192.168.100.1:3128"}
16
+ expect(parser.parse(full_opts)).to be === {:hosts_file=>"anotherfile.cfg", :options_file=>"opts_file", :type=>"pe", :helper=>"path_to_helper", :load_path=>"load_path", :tests=>"test1.rb,test2.rb,test3.rb", :pre_suite=>"pre_suite.rb", :post_suite=>"post_suite.rb", :provision=>false, :preserve_hosts=>"always", :root_keys=>true, :keyfile=>"../.ssh/id_rsa", :install=>"gitrepopath", :modules=>"module", :quiet=>true, :dry_run=>true, :timesync=>false, :repo_proxy=>true, :add_el_extras=>true, :fail_mode=>"fast", :color=>false, :version=>true, :log_level=>"info", :package_proxy => "http://192.168.100.1:3128"}
17
17
  end
18
18
 
19
19
  it "can produce a usage description" do
@@ -26,8 +26,8 @@ module Beaker
26
26
  expect( cmd.args_string ).to be == 'to the baz'
27
27
  expect( cmd.options_string ).to be == '--foo=bar'
28
28
 
29
- win_path = %q[PATH="/opt/puppet-git-repos/hiera/bin:${PATH}"]
30
- win_lib = %q[RUBYLIB="`cygpath -w /opt/puppet-git-repos/hiera/lib`;`cygpath -w /opt/puppet-git-repos/hiera-puppet/lib`;${RUBYLIB}"]
29
+ win_path = %q[/opt/puppet-git-repos/hiera/bin:${PATH}]
30
+ win_lib = %q[`cygpath -w /opt/puppet-git-repos/hiera/lib`;`cygpath -w /opt/puppet-git-repos/hiera-puppet/lib`;${RUBYLIB}]
31
31
  cmd_exe = %q[cmd.exe /c]
32
32
 
33
33
  command_line = cmd.environment_string_for( host, cmd.environment )
@@ -3,25 +3,26 @@ require 'net/ssh'
3
3
 
4
4
  module Beaker
5
5
  describe SshConnection do
6
- let( :host ) { 'my_host' }
7
- let( :user ) { 'root' }
8
- let( :options ) { Hash.new }
9
- subject(:connection) { SshConnection.new host, user, options }
6
+ let( :host ) { 'my_host' }
7
+ let( :user ) { 'root' }
8
+ let( :ssh_opts ) { {} }
9
+ let( :options ) { { :logger => double('logger').as_null_object } }
10
+ subject(:connection) { SshConnection.new host, user, ssh_opts, options }
10
11
 
11
12
  it 'self.connect creates connects and returns a proxy for that connection' do
12
13
  # grrr
13
- Net::SSH.should_receive(:start).with( host, user, options )
14
- connection_constructor = SshConnection.connect host, user, options
14
+ Net::SSH.should_receive(:start).with( host, user, ssh_opts )
15
+ connection_constructor = SshConnection.connect host, user, ssh_opts, options
15
16
  expect( connection_constructor ).to be_a_kind_of SshConnection
16
17
  end
17
18
 
18
19
  it 'connect creates a new connection' do
19
- Net::SSH.should_receive( :start ).with( host, user, options )
20
+ Net::SSH.should_receive( :start ).with( host, user, ssh_opts)
20
21
  connection.connect
21
22
  end
22
23
 
23
24
  it 'connect caches its connection' do
24
- Net::SSH.should_receive( :start ).with( host, user, options ).once.and_return true
25
+ Net::SSH.should_receive( :start ).with( host, user, ssh_opts ).once.and_return true
25
26
  connection.connect
26
27
  connection.connect
27
28
  end
@@ -27,5 +27,113 @@ module Beaker
27
27
  end
28
28
 
29
29
  end
30
+
31
+ describe TestSuite::TestSuiteResult do
32
+
33
+ let( :options ) { make_opts.merge({ :logger => double().as_null_object }) }
34
+ let( :hosts ) { make_hosts() }
35
+ let( :testcase1 ) { Beaker::TestCase.new( hosts, options[:logger], options) }
36
+ let( :testcase2 ) { Beaker::TestCase.new( hosts, options[:logger], options) }
37
+ let( :testcase3 ) { Beaker::TestCase.new( hosts, options[:logger], options) }
38
+ let( :test_suite_result ) { TestSuite::TestSuiteResult.new( options, "my_suite") }
39
+
40
+ it 'supports adding test cases' do
41
+ expect( test_suite_result.test_count ).to be === 0
42
+ test_suite_result.add_test_case( testcase1 )
43
+ expect( test_suite_result.test_count ).to be === 1
44
+ end
45
+
46
+ it 'calculates passed tests' do
47
+ testcase1.instance_variable_set(:@test_status, :pass)
48
+ testcase2.instance_variable_set(:@test_status, :pass)
49
+ testcase3.instance_variable_set(:@test_status, :fail)
50
+ test_suite_result.add_test_case( testcase1 )
51
+ test_suite_result.add_test_case( testcase2 )
52
+ test_suite_result.add_test_case( testcase3 )
53
+ expect( test_suite_result.passed_tests ).to be == 2
54
+ end
55
+
56
+ it 'calculates failed tests' do
57
+ testcase1.instance_variable_set(:@test_status, :pass)
58
+ testcase2.instance_variable_set(:@test_status, :pass)
59
+ testcase3.instance_variable_set(:@test_status, :fail)
60
+ test_suite_result.add_test_case( testcase1 )
61
+ test_suite_result.add_test_case( testcase2 )
62
+ test_suite_result.add_test_case( testcase3 )
63
+ expect( test_suite_result.failed_tests ).to be == 1
64
+ end
65
+
66
+ it 'calculates errored tests' do
67
+ testcase1.instance_variable_set(:@test_status, :error)
68
+ testcase2.instance_variable_set(:@test_status, :pass)
69
+ testcase3.instance_variable_set(:@test_status, :fail)
70
+ test_suite_result.add_test_case( testcase1 )
71
+ test_suite_result.add_test_case( testcase2 )
72
+ test_suite_result.add_test_case( testcase3 )
73
+ expect( test_suite_result.errored_tests ).to be == 1
74
+ end
75
+
76
+ it 'calculates skipped tests' do
77
+ testcase1.instance_variable_set(:@test_status, :error)
78
+ testcase2.instance_variable_set(:@test_status, :skip)
79
+ testcase3.instance_variable_set(:@test_status, :fail)
80
+ test_suite_result.add_test_case( testcase1 )
81
+ test_suite_result.add_test_case( testcase2 )
82
+ test_suite_result.add_test_case( testcase3 )
83
+ expect( test_suite_result.skipped_tests ).to be == 1
84
+ end
85
+
86
+ it 'calculates pending tests' do
87
+ testcase1.instance_variable_set(:@test_status, :error)
88
+ testcase2.instance_variable_set(:@test_status, :pending)
89
+ testcase3.instance_variable_set(:@test_status, :fail)
90
+ test_suite_result.add_test_case( testcase1 )
91
+ test_suite_result.add_test_case( testcase2 )
92
+ test_suite_result.add_test_case( testcase3 )
93
+ expect( test_suite_result.pending_tests ).to be == 1
94
+ end
95
+
96
+ it 'calculates sum_failed as a sum of errored and failed TestCases' do
97
+ testcase1.instance_variable_set(:@test_status, :error)
98
+ testcase2.instance_variable_set(:@test_status, :pending)
99
+ testcase3.instance_variable_set(:@test_status, :fail)
100
+ test_suite_result.add_test_case( testcase1 )
101
+ test_suite_result.add_test_case( testcase2 )
102
+ test_suite_result.add_test_case( testcase3 )
103
+ expect( test_suite_result.sum_failed ).to be == 2
104
+ end
105
+
106
+ it 'reports success with no errors/failures' do
107
+ testcase1.instance_variable_set(:@test_status, :pass)
108
+ testcase2.instance_variable_set(:@test_status, :pending)
109
+ testcase3.instance_variable_set(:@test_status, :fail)
110
+ test_suite_result.add_test_case( testcase1 )
111
+ test_suite_result.add_test_case( testcase2 )
112
+ test_suite_result.add_test_case( testcase3 )
113
+ expect( test_suite_result.success? ).to be == false
114
+ end
115
+
116
+ it 'reports failed if any tests error/fail' do
117
+ testcase1.instance_variable_set(:@test_status, :pass)
118
+ testcase2.instance_variable_set(:@test_status, :pending)
119
+ testcase3.instance_variable_set(:@test_status, :fail)
120
+ test_suite_result.add_test_case( testcase1 )
121
+ test_suite_result.add_test_case( testcase2 )
122
+ test_suite_result.add_test_case( testcase3 )
123
+ expect( test_suite_result.failed? ).to be == true
124
+ end
125
+
126
+ it 'can calculate the sum of all TestCase runtimes' do
127
+ testcase1.instance_variable_set(:@runtime, 1)
128
+ testcase2.instance_variable_set(:@runtime, 10)
129
+ testcase3.instance_variable_set(:@runtime, 100)
130
+ test_suite_result.add_test_case( testcase1 )
131
+ test_suite_result.add_test_case( testcase2 )
132
+ test_suite_result.add_test_case( testcase3 )
133
+ expect( test_suite_result.elapsed_time ).to be == 111
134
+ end
135
+
136
+
137
+ end
30
138
  end
31
139
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.2
4
+ version: 1.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2014-06-12 00:00:00 Z
12
+ date: 2014-06-20 00:00:00 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -165,9 +165,9 @@ dependencies:
165
165
  prerelease: false
166
166
  requirement: &id017 !ruby/object:Gem::Requirement
167
167
  requirements:
168
- - - ~>
168
+ - - "="
169
169
  - !ruby/object:Gem::Version
170
- version: "1.38"
170
+ version: 1.42.0
171
171
  type: :runtime
172
172
  version_requirements: *id017
173
173
  - !ruby/object:Gem::Dependency
@@ -272,6 +272,7 @@ files:
272
272
  - lib/beaker/hypervisor/vcloud_pooled.rb
273
273
  - lib/beaker/hypervisor/vsphere.rb
274
274
  - lib/beaker/hypervisor/vsphere_helper.rb
275
+ - lib/beaker/junit.xsl
275
276
  - lib/beaker/logger.rb
276
277
  - lib/beaker/network_manager.rb
277
278
  - lib/beaker/options.rb
@@ -290,6 +291,8 @@ files:
290
291
  - lib/beaker/shared/repetition.rb
291
292
  - lib/beaker/shared/timed.rb
292
293
  - lib/beaker/ssh_connection.rb
294
+ - lib/beaker/tasks/rake_task.rb
295
+ - lib/beaker/tasks/test.rb
293
296
  - lib/beaker/test_case.rb
294
297
  - lib/beaker/test_suite.rb
295
298
  - lib/beaker/version.rb
@@ -303,6 +306,7 @@ files:
303
306
  - spec/beaker/dsl/roles_spec.rb
304
307
  - spec/beaker/dsl/structure_spec.rb
305
308
  - spec/beaker/dsl/wrappers_spec.rb
309
+ - spec/beaker/host/unix/pkg_spec.rb
306
310
  - spec/beaker/host/windows/group_spec.rb
307
311
  - spec/beaker/host_prebuilt_steps_spec.rb
308
312
  - spec/beaker/host_spec.rb
@@ -381,6 +385,7 @@ test_files:
381
385
  - spec/beaker/dsl/roles_spec.rb
382
386
  - spec/beaker/dsl/structure_spec.rb
383
387
  - spec/beaker/dsl/wrappers_spec.rb
388
+ - spec/beaker/host/unix/pkg_spec.rb
384
389
  - spec/beaker/host/windows/group_spec.rb
385
390
  - spec/beaker/host_prebuilt_steps_spec.rb
386
391
  - spec/beaker/host_spec.rb