beaker 1.15.0 → 1.16.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.
- checksums.yaml +8 -8
- data/HISTORY.md +188 -2
- data/Rakefile +23 -2
- data/beaker.gemspec +1 -0
- data/history.rb +57 -0
- data/lib/beaker/cli.rb +3 -3
- data/lib/beaker/dsl/ezbake_utils.rb +3 -2
- data/lib/beaker/host.rb +2 -2
- data/lib/beaker/junit.xsl +6 -2
- data/lib/beaker/logger.rb +3 -3
- data/lib/beaker/platform.rb +1 -0
- data/lib/beaker/result.rb +3 -3
- data/lib/beaker/test_suite.rb +7 -4
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/logger_spec.rb +18 -0
- data/spec/beaker/platform_spec.rb +14 -1
- data/spec/beaker/test_case_spec.rb +10 -0
- data/spec/beaker/test_suite_spec.rb +75 -4
- metadata +17 -2
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
YzBmNDU3OTYwNGM3YTEwYjk2MjZlNmNjNzg5MDg1YTExMGRlOTMwMQ==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
NWMzMzg3NDRlMTUyMDliN2E4NDBiODQ5ODY2MGNmNWZiYTNhMWRjOQ==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
MTQ3NWM0MmVhZjRkZjU4NTE4NTMwMWM5YTAwMGU1ZmI1YTI4ZDgxMjQ0NzEy
|
|
10
|
+
MjVmOWM3YjIwYzY4YjNiNGU3MmNhZDg2MDBiZGU1MjZhZDk5NzdlY2UwNTE1
|
|
11
|
+
NDZlMDFmZjZiYWY4NzRmN2RjNWZjZjM5NGI4M2U2ZTIyYjA1N2E=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
OWFlYTRiOTYxYzQ1ODYxYmI2NGYwNDQyMDQ2NjFiOWI1MzY3MDZiYjYxZjhl
|
|
14
|
+
YzM3OGQyMzYyMTBjNmExZDlkZWZmOTk4NzZkZDBhODc0NzE3NmY1YmExMmNh
|
|
15
|
+
NDZiNmJjMzc1MTYwMjRhNzkyYzM3M2U4OWEwMjkxMjIwOWE0NzE=
|
data/HISTORY.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# beaker - History
|
|
2
2
|
## Tags
|
|
3
|
-
* [LATEST -
|
|
3
|
+
* [LATEST - 17 Jul, 2014 (b0558827)](#LATEST)
|
|
4
|
+
* [beaker1.15.0 - 8 Jul, 2014 (82bb4ef9)](#beaker1.15.0)
|
|
4
5
|
* [beaker1.14.1 - 3 Jul, 2014 (d2e750d5)](#beaker1.14.1)
|
|
5
6
|
* [beaker1.14.0 - 3 Jul, 2014 (cf8ea838)](#beaker1.14.0)
|
|
6
7
|
* [beaker1.13.1 - 23 Jun, 2014 (aa09552d)](#beaker1.13.1)
|
|
@@ -50,7 +51,192 @@
|
|
|
50
51
|
* [pe1.2 - 6 Sep, 2011 (ba3dadd2)](#pe1.2)
|
|
51
52
|
|
|
52
53
|
## Details
|
|
53
|
-
### <a name = "LATEST">LATEST -
|
|
54
|
+
### <a name = "LATEST">LATEST - 17 Jul, 2014 (b0558827)
|
|
55
|
+
|
|
56
|
+
* Merge pull request #364 from anodelman/make-gem (b0558827)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
Merge pull request #364 from anodelman/make-gem
|
|
61
|
+
|
|
62
|
+
(GEM) version bump for beaker 1.16.0
|
|
63
|
+
```
|
|
64
|
+
* (GEM) version bump for beaker 1.16.0 (6664c6ab)
|
|
65
|
+
|
|
66
|
+
* Merge pull request #363 from puppetlabs/revert-359-issue/master/qeng-188-foss-service-restarts (56cfac77)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
Merge pull request #363 from puppetlabs/revert-359-issue/master/qeng-188-foss-service-restarts
|
|
71
|
+
|
|
72
|
+
Revert "(QENG-188) Allow foss runs to use service scripts"
|
|
73
|
+
```
|
|
74
|
+
* Revert "(QENG-188) Allow foss runs to use service scripts" (dbfa7b23)
|
|
75
|
+
|
|
76
|
+
* Merge pull request #359 from jpartlow/issue/master/qeng-188-foss-service-restarts (d2464451)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
Merge pull request #359 from jpartlow/issue/master/qeng-188-foss-service-restarts
|
|
81
|
+
|
|
82
|
+
(QENG-188) Allow foss runs to use service scripts
|
|
83
|
+
```
|
|
84
|
+
* Merge pull request #360 from anodelman/fail-slow (0d0c9239)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
Merge pull request #360 from anodelman/fail-slow
|
|
89
|
+
|
|
90
|
+
(QENG-927) Beaker does not honor --fail-mode always fails fast
|
|
91
|
+
```
|
|
92
|
+
* (QENG-927) Beaker does not honor --fail-mode always fails fast (755f13eb)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
(QENG-927) Beaker does not honor --fail-mode always fails fast
|
|
97
|
+
|
|
98
|
+
- bug comes from regex comparison with a symbol not being coerced to a
|
|
99
|
+
string in ruby 1.8, simple adding a 'to_s' resolves this
|
|
100
|
+
```
|
|
101
|
+
* Merge pull request #358 from waynr/bugfix/ezbake-utils (b83f5299)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
Merge pull request #358 from waynr/bugfix/ezbake-utils
|
|
106
|
+
|
|
107
|
+
(QENG-924) Fix Beaker::DSL::EZBakeUtils.conditionally_clone
|
|
108
|
+
```
|
|
109
|
+
* Merge pull request #357 from jpartlow/issue/master/qeng-923-ensure-platform-codename (06aa5b81)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
Merge pull request #357 from jpartlow/issue/master/qeng-923-ensure-platform-codename
|
|
114
|
+
|
|
115
|
+
(QENG-923) Ensure @codename is set if platform string has codename
|
|
116
|
+
```
|
|
117
|
+
* (QENG-924) Fix Beaker::DSL::EZBakeUtils.conditionally_clone (b6cd1ac6)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
(QENG-924) Fix Beaker::DSL::EZBakeUtils.conditionally_clone
|
|
122
|
+
|
|
123
|
+
Fetch from origin then checkout the origin HEAD.
|
|
124
|
+
|
|
125
|
+
Signed-off-by: Wayne <wayne@puppetlabs.com>
|
|
126
|
+
```
|
|
127
|
+
* (QENG-923) Ensure @codename is set if platform string has codename (26724829)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
(QENG-923) Ensure @codename is set if platform string has codename
|
|
132
|
+
|
|
133
|
+
Beaker 1.14.0 and up has a change to Beaker::Platform which ensures that
|
|
134
|
+
@version and @codename is set if the platform string contains the
|
|
135
|
+
version number, and that @version is set if platform string contains the
|
|
136
|
+
codename, but it fails to set the @codename in this later case.
|
|
137
|
+
|
|
138
|
+
Puppet currently has debian/ubuntu configs checked (used in ci) which
|
|
139
|
+
use platform strings of the form debian-wheezy-x86_64. We could change
|
|
140
|
+
these, but it looks like the intention of the Beaker::Platform object is
|
|
141
|
+
to provide @version and @codename (where codenames are used).
|
|
142
|
+
|
|
143
|
+
This patch ensures that @codename is set along with @version in these
|
|
144
|
+
cases.
|
|
145
|
+
```
|
|
146
|
+
* Merge pull request #356 from anodelman/utf-8-encoding (842a0d99)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
Merge pull request #356 from anodelman/utf-8-encoding
|
|
151
|
+
|
|
152
|
+
(QENG-912) Beaker 1.14 breaks PE Puppet Acceptance
|
|
153
|
+
```
|
|
154
|
+
* Merge pull request #354 from anodelman/scp-repair (6e0261f2)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
Merge pull request #354 from anodelman/scp-repair
|
|
159
|
+
|
|
160
|
+
(QENG-6) Beaker DSL `scp_*` commands print the options hash as if...
|
|
161
|
+
```
|
|
162
|
+
* (QENG-912) Beaker 1.14 breaks PE Puppet Acceptance (928fad7f)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
(QENG-912) Beaker 1.14 breaks PE Puppet Acceptance
|
|
167
|
+
|
|
168
|
+
- was too conservative in removing non utf-8 compliant characters -
|
|
169
|
+
ended up removing compliant characters along with undef/invalid
|
|
170
|
+
character codes
|
|
171
|
+
- tested locally and it preserved messages like:
|
|
172
|
+
/etc/puppet/modules
|
|
173
|
+
├── jimmy-appleseed (v1.1.0)
|
|
174
|
+
├── jimmy-crakorn (v0.4.0)
|
|
175
|
+
└── jimmy-thelock (v1.0.0)
|
|
176
|
+
- correctly removed actual undef/invalid characters so that string
|
|
177
|
+
methods can be run (ie, split, gsub)
|
|
178
|
+
```
|
|
179
|
+
* Merge pull request #338 from anodelman/add-history (9e6acd2e)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
Merge pull request #338 from anodelman/add-history
|
|
184
|
+
|
|
185
|
+
(QENG-849) beaker should maintain a history file that provides...
|
|
186
|
+
```
|
|
187
|
+
* (QENG-6) Beaker DSL `scp_*` commands print the options hash as if... (9aca3a1d)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
(QENG-6) Beaker DSL `scp_*` commands print the options hash as if...
|
|
192
|
+
|
|
193
|
+
... it were executed on the command line
|
|
194
|
+
- simply remove the option hash from the debug line, it isn't
|
|
195
|
+
appropriate there.
|
|
196
|
+
```
|
|
197
|
+
* (QENG-849) beaker should maintain a history file that provides... (04bf6d4f)
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
(QENG-849) beaker should maintain a history file that provides...
|
|
202
|
+
|
|
203
|
+
...information per gem release
|
|
204
|
+
|
|
205
|
+
- generate a markdown history file from beaker git log
|
|
206
|
+
```
|
|
207
|
+
* (QENG-188) Allow foss runs to use service scripts (881311ab)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
(QENG-188) Allow foss runs to use service scripts
|
|
212
|
+
|
|
213
|
+
Prior to this commit, any run of beaker with a non-pe master that
|
|
214
|
+
attempted to stand up a master with a particular configuration in order
|
|
215
|
+
to test against it using the with_puppet_running_on() helper would
|
|
216
|
+
always stand up a webrick master by executing `puppet master <args>` and
|
|
217
|
+
then later stop it with `kill`.
|
|
218
|
+
|
|
219
|
+
The platform team needs to be able to run acceptance suites in which the
|
|
220
|
+
puppetmaster is started/stopped using package provided init scripts, or
|
|
221
|
+
by restarting apache if a passenger puppetmaster package is installed.
|
|
222
|
+
|
|
223
|
+
This PR makes a few additions to OptionsHash, Host and the DSL::Helpers
|
|
224
|
+
to allow us to distinguish foss hosts which were spun up from source
|
|
225
|
+
from those which were installed from packages. And if we are working
|
|
226
|
+
with packages, whether we will be attempting to restart a running
|
|
227
|
+
service or stop/start using service scripts.
|
|
228
|
+
```
|
|
229
|
+
### <a name = "beaker1.15.0">beaker1.15.0 - 8 Jul, 2014 (82bb4ef9)
|
|
230
|
+
|
|
231
|
+
* Merge pull request #353 from anodelman/make-gem (82bb4ef9)
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
```
|
|
235
|
+
Merge pull request #353 from anodelman/make-gem
|
|
236
|
+
|
|
237
|
+
(HISTORY) generate history file for beaker 1.15.0
|
|
238
|
+
```
|
|
239
|
+
* (HISTORY) generate history file for beaker 1.15.0 (bd77ab99)
|
|
54
240
|
|
|
55
241
|
* Merge pull request #351 from anodelman/make-gem (cc636ca0)
|
|
56
242
|
|
data/Rakefile
CHANGED
|
@@ -9,6 +9,10 @@ task :yard do
|
|
|
9
9
|
Rake::Task['docs:gen'].invoke
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
task :history do
|
|
13
|
+
Rake::Task['history:gen'].invoke
|
|
14
|
+
end
|
|
15
|
+
|
|
12
16
|
task :travis do
|
|
13
17
|
Rake::Task['yard'].invoke unless RUBY_VERSION < '1.9'
|
|
14
18
|
Rake::Task['spec'].invoke
|
|
@@ -24,14 +28,31 @@ namespace :test do
|
|
|
24
28
|
end
|
|
25
29
|
end
|
|
26
30
|
|
|
27
|
-
|
|
28
31
|
###########################################################
|
|
29
32
|
#
|
|
30
|
-
#
|
|
33
|
+
# History Tasks
|
|
31
34
|
#
|
|
32
35
|
###########################################################
|
|
36
|
+
namespace :history do
|
|
37
|
+
desc 'Generate HISTORY.md'
|
|
38
|
+
task :gen do
|
|
39
|
+
original_dir = Dir.pwd
|
|
40
|
+
Dir.chdir( File.expand_path(File.dirname(__FILE__)) )
|
|
41
|
+
output = `bundle exec ruby history.rb .`
|
|
42
|
+
puts output
|
|
43
|
+
if output !~ /success/
|
|
44
|
+
raise "History generation failed"
|
|
45
|
+
end
|
|
46
|
+
Dir.chdir( original_dir )
|
|
47
|
+
end
|
|
33
48
|
|
|
49
|
+
end
|
|
34
50
|
|
|
51
|
+
###########################################################
|
|
52
|
+
#
|
|
53
|
+
# Documentation Tasks
|
|
54
|
+
#
|
|
55
|
+
###########################################################
|
|
35
56
|
DOCS_DAEMON = "yard server --reload --daemon --server thin"
|
|
36
57
|
FOREGROUND_SERVER = 'bundle exec yard server --reload --verbose --server thin lib/beaker'
|
|
37
58
|
|
data/beaker.gemspec
CHANGED
|
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
|
|
|
29
29
|
s.add_development_dependency 'yard'
|
|
30
30
|
s.add_development_dependency 'markdown' unless RUBY_VERSION < '1.9'
|
|
31
31
|
s.add_development_dependency 'thin'
|
|
32
|
+
s.add_development_dependency 'gitlab-grit'
|
|
32
33
|
|
|
33
34
|
# Run time dependencies
|
|
34
35
|
s.add_runtime_dependency 'json', '~> 1.8'
|
data/history.rb
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Generates a HISTORY.md file for your repo based on tags and commits
|
|
2
|
+
# Requires: gem install gitlab-grit
|
|
3
|
+
# Usage: ruby history.rb /your/repo/directory
|
|
4
|
+
#
|
|
5
|
+
# Based on https://coderwall.com/p/99mjcg
|
|
6
|
+
|
|
7
|
+
require 'grit'
|
|
8
|
+
|
|
9
|
+
if ARGV.size < 1
|
|
10
|
+
p "Usage: ruby history.rb /your/repo/directory"
|
|
11
|
+
exit
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
output_file = 'HISTORY.md'
|
|
15
|
+
repo_dir = ARGV[0]
|
|
16
|
+
output = "# #{File.basename(File.absolute_path(repo_dir))} - History\n"
|
|
17
|
+
|
|
18
|
+
repo = Grit::Repo.new(repo_dir)
|
|
19
|
+
head = Grit::Tag.new(repo.commits.first.sha, repo, repo.commits.first.id)
|
|
20
|
+
tags = repo.tags + [head]
|
|
21
|
+
tags.sort! {|x,y| y.commit.authored_date <=> x.commit.authored_date}
|
|
22
|
+
|
|
23
|
+
output << "## Tags\n"
|
|
24
|
+
tags.each do |tag|
|
|
25
|
+
tag_name = tag.name
|
|
26
|
+
if tag == tags.first
|
|
27
|
+
tag_name = 'LATEST'
|
|
28
|
+
end
|
|
29
|
+
output << "* [#{tag_name} - #{tag.commit.authored_date.strftime("%-d %b, %Y")} (#{tag.commit.sha[0,8]})](##{tag_name})\n"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
output << "\n## Details\n"
|
|
33
|
+
tagcount = 0
|
|
34
|
+
tags.each do |tag|
|
|
35
|
+
tag_name = tag.name
|
|
36
|
+
if tag == tags.first
|
|
37
|
+
tag_name = 'LATEST'
|
|
38
|
+
end
|
|
39
|
+
output << "### <a name = \"#{tag_name}\">#{tag_name} - #{tag.commit.authored_date.strftime("%-d %b, %Y")} (#{tag.commit.sha[0,8]})\n\n"
|
|
40
|
+
if (tagcount != tags.size - 1)
|
|
41
|
+
commit_set = repo.commits_between(tags[tagcount + 1].name, tag.name)
|
|
42
|
+
commit_set.sort! {|x,y| y.authored_date <=> x.authored_date }
|
|
43
|
+
commit_set.each do |c|
|
|
44
|
+
output << "* #{c.short_message} (#{c.sha[0,8]})\n\n"
|
|
45
|
+
if c.short_message != c.message
|
|
46
|
+
output << "\n```\n#{c.message.gsub(/```/, "\n")}\n```\n"
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
else
|
|
50
|
+
output << "* Initial release.\n"
|
|
51
|
+
end
|
|
52
|
+
tagcount += 1
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
File.open(output_file, 'w') { |f| f.write(output) }
|
|
56
|
+
|
|
57
|
+
puts "success, output sent to #{output_file}"
|
data/lib/beaker/cli.rb
CHANGED
|
@@ -90,7 +90,7 @@ module Beaker
|
|
|
90
90
|
rescue => e
|
|
91
91
|
#post acceptance on failure
|
|
92
92
|
#run post-suite if we are in fail-slow mode
|
|
93
|
-
if @options[:fail_mode] =~ /slow/
|
|
93
|
+
if @options[:fail_mode].to_s =~ /slow/
|
|
94
94
|
run_suite(:post_suite)
|
|
95
95
|
end
|
|
96
96
|
raise e
|
|
@@ -101,7 +101,7 @@ module Beaker
|
|
|
101
101
|
#cleanup phase
|
|
102
102
|
rescue => e
|
|
103
103
|
#cleanup on error
|
|
104
|
-
if @options[:preserve_hosts] =~ /(never)/
|
|
104
|
+
if @options[:preserve_hosts].to_s =~ /(never)/
|
|
105
105
|
@logger.notify "Cleanup: cleaning up after failed run"
|
|
106
106
|
if @network_manager
|
|
107
107
|
@network_manager.cleanup
|
|
@@ -114,7 +114,7 @@ module Beaker
|
|
|
114
114
|
exit 1
|
|
115
115
|
else
|
|
116
116
|
#cleanup on success
|
|
117
|
-
if @options[:preserve_hosts] =~ /(never)|(onfail)/
|
|
117
|
+
if @options[:preserve_hosts].to_s =~ /(never)|(onfail)/
|
|
118
118
|
@logger.notify "Cleanup: cleaning up after successful run"
|
|
119
119
|
if @network_manager
|
|
120
120
|
@network_manager.cleanup
|
|
@@ -65,7 +65,7 @@ module Beaker
|
|
|
65
65
|
#
|
|
66
66
|
def ezbake_stage project_name, project_version, ezbake_dir="tmp/ezbake"
|
|
67
67
|
ezbake_tools_available?
|
|
68
|
-
conditionally_clone "
|
|
68
|
+
conditionally_clone "gitmirror@github.delivery.puppetlabs.net:puppetlabs-ezbake.git", ezbake_dir
|
|
69
69
|
|
|
70
70
|
package_version = ''
|
|
71
71
|
Dir.chdir(ezbake_dir) do
|
|
@@ -207,7 +207,8 @@ module Beaker
|
|
|
207
207
|
def conditionally_clone(upstream_uri, local_path)
|
|
208
208
|
ezbake_tools_available?
|
|
209
209
|
if system "git --work-tree=#{local_path} --git-dir=#{local_path}/.git status"
|
|
210
|
-
system "git --work-tree=#{local_path} --git-dir=#{local_path}/.git
|
|
210
|
+
system "git --work-tree=#{local_path} --git-dir=#{local_path}/.git fetch origin"
|
|
211
|
+
system "git --work-tree=#{local_path} --git-dir=#{local_path}/.git checkout origin/HEAD"
|
|
211
212
|
else
|
|
212
213
|
parent_dir = File.dirname(local_path)
|
|
213
214
|
FileUtils.mkdir_p(parent_dir)
|
data/lib/beaker/host.rb
CHANGED
|
@@ -207,14 +207,14 @@ module Beaker
|
|
|
207
207
|
end
|
|
208
208
|
|
|
209
209
|
def do_scp_to source, target, options
|
|
210
|
-
@logger.debug "localhost $ scp #{source} #{@name}:#{target}
|
|
210
|
+
@logger.debug "localhost $ scp #{source} #{@name}:#{target}"
|
|
211
211
|
result = connection.scp_to(source, target, options, $dry_run)
|
|
212
212
|
return result
|
|
213
213
|
end
|
|
214
214
|
|
|
215
215
|
def do_scp_from source, target, options
|
|
216
216
|
|
|
217
|
-
@logger.debug "localhost $ scp #{@name}:#{source} #{target}
|
|
217
|
+
@logger.debug "localhost $ scp #{@name}:#{source} #{target}"
|
|
218
218
|
result = connection.scp_from(source, target, options, $dry_run)
|
|
219
219
|
return result
|
|
220
220
|
end
|
data/lib/beaker/junit.xsl
CHANGED
|
@@ -75,12 +75,13 @@
|
|
|
75
75
|
<xsl:variable name="testsuite_name"><xsl:value-of select="@name"/></xsl:variable>
|
|
76
76
|
|
|
77
77
|
<xsl:variable name="testsuite_name_safe" select="translate($testsuite_name,'.','_')" />
|
|
78
|
-
<xsl:variable name="
|
|
78
|
+
<xsl:variable name="testsuite_attempted"><xsl:value-of select="@tests"/></xsl:variable>
|
|
79
79
|
<xsl:variable name="testsuite_errors"><xsl:value-of select="@errors"/></xsl:variable>
|
|
80
80
|
<xsl:variable name="testsuite_failures"><xsl:value-of select="@failures"/></xsl:variable>
|
|
81
81
|
<xsl:variable name="testsuite_time"><xsl:value-of select="@time"/></xsl:variable>
|
|
82
82
|
<xsl:variable name="testsuite_skip"><xsl:value-of select="@skip"/></xsl:variable>
|
|
83
83
|
<xsl:variable name="testsuite_pending"><xsl:value-of select="@pending"/></xsl:variable>
|
|
84
|
+
<xsl:variable name="testsuite_total"><xsl:value-of select="@total"/></xsl:variable>
|
|
84
85
|
<xsl:variable name="testsuite_panel_type">
|
|
85
86
|
<xsl:choose>
|
|
86
87
|
<xsl:when test="$testsuite_errors > 0 or $testsuite_failures > 0">danger</xsl:when>
|
|
@@ -103,7 +104,7 @@
|
|
|
103
104
|
<div class="col-md-2">
|
|
104
105
|
</div>
|
|
105
106
|
<div class="col-md-2">
|
|
106
|
-
<h4>
|
|
107
|
+
<h4>Attempted: <xsl:value-of select="$testsuite_attempted" /></h4>
|
|
107
108
|
</div>
|
|
108
109
|
<div class="col-md-2">
|
|
109
110
|
<h4>Failed: <xsl:value-of select="$testsuite_errors + $testsuite_failures" /></h4>
|
|
@@ -114,6 +115,9 @@
|
|
|
114
115
|
<div class="col-md-2">
|
|
115
116
|
<h4>Pending: <xsl:value-of select="$testsuite_pending" /></h4>
|
|
116
117
|
</div>
|
|
118
|
+
<div class="col-md-2">
|
|
119
|
+
<h4>Total: <xsl:value-of select="$testsuite_total" /></h4>
|
|
120
|
+
</div>
|
|
117
121
|
</div> <!-- row -->
|
|
118
122
|
</a>
|
|
119
123
|
</div> <!-- panel-title -->
|
data/lib/beaker/logger.rb
CHANGED
|
@@ -141,11 +141,11 @@ module Beaker
|
|
|
141
141
|
convert s
|
|
142
142
|
end
|
|
143
143
|
else
|
|
144
|
-
if string.respond_to?( :
|
|
144
|
+
if string.respond_to?( :force_encoding )
|
|
145
145
|
# We're running in >= 1.9 and we'll need to convert
|
|
146
146
|
# Remove invalid and undefined UTF-8 character encodings
|
|
147
|
-
|
|
148
|
-
return string.
|
|
147
|
+
string.force_encoding('UTF-8')
|
|
148
|
+
return string.chars.select{|i| i.valid_encoding?}.join
|
|
149
149
|
else
|
|
150
150
|
# We're running 1.8, do nothing
|
|
151
151
|
string
|
data/lib/beaker/platform.rb
CHANGED
data/lib/beaker/result.rb
CHANGED
|
@@ -31,11 +31,11 @@ module Beaker
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def convert string
|
|
34
|
-
if string.respond_to?( :
|
|
34
|
+
if string.respond_to?( :force_encoding )
|
|
35
35
|
# We're running in >= 1.9 and we'll need to convert
|
|
36
36
|
# Remove invalid and undefined UTF-8 character encodings
|
|
37
|
-
|
|
38
|
-
return string.
|
|
37
|
+
string.force_encoding('UTF-8')
|
|
38
|
+
return string.chars.select{|i| i.valid_encoding?}.join
|
|
39
39
|
else
|
|
40
40
|
# We're running in < 1.9 and Ruby doesn't care
|
|
41
41
|
return string
|
data/lib/beaker/test_suite.rb
CHANGED
|
@@ -12,7 +12,7 @@ module Beaker
|
|
|
12
12
|
|
|
13
13
|
#Holds the output of a test suite, formats in plain text or xml
|
|
14
14
|
class TestSuiteResult
|
|
15
|
-
attr_accessor :start_time, :stop_time
|
|
15
|
+
attr_accessor :start_time, :stop_time, :total_tests
|
|
16
16
|
|
|
17
17
|
#Create a {TestSuiteResult} instance.
|
|
18
18
|
#@param [Hash{Symbol=>String}] options Options for this object
|
|
@@ -107,6 +107,7 @@ module Beaker
|
|
|
107
107
|
Errored: #{errored_tests}
|
|
108
108
|
Skipped: #{skipped_tests}
|
|
109
109
|
Pending: #{pending_tests}
|
|
110
|
+
Total: #{@total_tests}
|
|
110
111
|
|
|
111
112
|
- Specific Test Case Status -
|
|
112
113
|
] % [elapsed_time, average_test_time]
|
|
@@ -191,6 +192,7 @@ module Beaker
|
|
|
191
192
|
suite['failures'] = failed_tests
|
|
192
193
|
suite['skip'] = skipped_tests
|
|
193
194
|
suite['pending'] = pending_tests
|
|
195
|
+
suite['total'] = @total_tests
|
|
194
196
|
suite['time'] = "%f" % (stop_time - start_time)
|
|
195
197
|
properties = Nokogiri::XML::Node.new('properties', doc)
|
|
196
198
|
@options.each_pair do | name, value |
|
|
@@ -281,7 +283,7 @@ module Beaker
|
|
|
281
283
|
@hosts = hosts
|
|
282
284
|
@run = false
|
|
283
285
|
@options = options
|
|
284
|
-
@fail_mode = fail_mode
|
|
286
|
+
@fail_mode = fail_mode || @options[:fail_mode]
|
|
285
287
|
@test_suite_results = TestSuiteResult.new(@options, name)
|
|
286
288
|
@timestamp = timestamp
|
|
287
289
|
|
|
@@ -308,6 +310,7 @@ module Beaker
|
|
|
308
310
|
Beaker.const_set(:Log, @logger) unless defined?( Log )
|
|
309
311
|
|
|
310
312
|
@test_suite_results.start_time = start_time
|
|
313
|
+
@test_suite_results.total_tests = @test_files.length
|
|
311
314
|
|
|
312
315
|
@test_files.each do |test_file|
|
|
313
316
|
@logger.notify "Begin #{test_file}"
|
|
@@ -326,10 +329,10 @@ module Beaker
|
|
|
326
329
|
@logger.debug msg
|
|
327
330
|
when :fail
|
|
328
331
|
@logger.error msg
|
|
329
|
-
break if @fail_mode !~ /slow/ #all failure modes except slow cause us to kick out early on failure
|
|
332
|
+
break if @fail_mode.to_s !~ /slow/ #all failure modes except slow cause us to kick out early on failure
|
|
330
333
|
when :error
|
|
331
334
|
@logger.warn msg
|
|
332
|
-
break if @fail_mode !~ /slow/ #all failure modes except slow cause us to kick out early on failure
|
|
335
|
+
break if @fail_mode.to_s !~ /slow/ #all failure modes except slow cause us to kick out early on failure
|
|
333
336
|
end
|
|
334
337
|
end
|
|
335
338
|
@test_suite_results.stop_time = Time.now
|
data/lib/beaker/version.rb
CHANGED
data/spec/beaker/logger_spec.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
1
2
|
require 'spec_helper'
|
|
2
3
|
|
|
3
4
|
module Beaker
|
|
@@ -6,6 +7,23 @@ module Beaker
|
|
|
6
7
|
let(:logger) { Logger.new(my_io, :quiet => true) }
|
|
7
8
|
|
|
8
9
|
|
|
10
|
+
context '#convert' do
|
|
11
|
+
let(:valid_utf8) { "/etc/puppet/modules\n├── jimmy-appleseed (\e[0;36mv1.1.0\e[0m)\n├── jimmy-crakorn (\e[0;36mv0.4.0\e[0m)\n└── jimmy-thelock (\e[0;36mv1.0.0\e[0m)\n" }
|
|
12
|
+
let(:invalid_utf8) {"/etc/puppet/modules\n├── jimmy-appleseed (\e[0;36mv1.1.0\e[0m)\n├── jimmy-crakorn (\e[0;36mv0.4.0\e[0m)\n└── jimmy-thelock (\e[0;36mv1.0.0\e[0m)\xAD\n"}
|
|
13
|
+
|
|
14
|
+
it 'preserves valid utf-8 strings' do
|
|
15
|
+
expect( logger.convert(valid_utf8) ).to be === valid_utf8
|
|
16
|
+
end
|
|
17
|
+
it 'strips out invalid utf-8 characters' do
|
|
18
|
+
#this is 1.9 behavior only
|
|
19
|
+
if RUBY_VERSION.to_f >= 1.9
|
|
20
|
+
expect( logger.convert(invalid_utf8) ).to be === valid_utf8
|
|
21
|
+
else
|
|
22
|
+
pending "not supported in ruby 1.8 (using #{RUBY_VERSION})"
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
9
27
|
context 'new' do
|
|
10
28
|
it 'does not duplicate STDOUT when directly passed to it' do
|
|
11
29
|
stdout_logger = Logger.new STDOUT
|
|
@@ -36,11 +36,24 @@ module Beaker
|
|
|
36
36
|
|
|
37
37
|
it "sets codename to nil" do
|
|
38
38
|
@name = "centos-6.5-x86_64"
|
|
39
|
-
expect
|
|
39
|
+
expect(platform.codename).to be_nil
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
+
describe "platforms with version and codename" do
|
|
45
|
+
it "intializes both version and codename if given version" do
|
|
46
|
+
@name = "debian-7-x86_64"
|
|
47
|
+
expect(platform.version).to eq('7')
|
|
48
|
+
expect(platform.codename).to eq('wheezy')
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it "intializes both version and codename if given codename" do
|
|
52
|
+
@name = "debian-wheezy-x86_64"
|
|
53
|
+
expect(platform.version).to eq('7')
|
|
54
|
+
expect(platform.codename).to eq('wheezy')
|
|
55
|
+
end
|
|
56
|
+
end
|
|
44
57
|
end
|
|
45
58
|
|
|
46
59
|
context 'to_array' do
|
|
@@ -84,6 +84,16 @@ module Beaker
|
|
|
84
84
|
testcase.should_receive( :log_and_fail_test ).once.with(kind_of(Timeout::Error))
|
|
85
85
|
testcase.run_test
|
|
86
86
|
end
|
|
87
|
+
|
|
88
|
+
it 'correctly handles CommandFailure' do
|
|
89
|
+
path = 'test.rb'
|
|
90
|
+
File.open(path, 'w') do |f|
|
|
91
|
+
f.write "raise Host::CommandFailure"
|
|
92
|
+
end
|
|
93
|
+
@path = path
|
|
94
|
+
testcase.should_receive( :log_and_fail_test ).once.with(kind_of(Host::CommandFailure))
|
|
95
|
+
testcase.run_test
|
|
96
|
+
end
|
|
87
97
|
end
|
|
88
98
|
|
|
89
99
|
end
|
|
@@ -13,14 +13,12 @@ module Beaker
|
|
|
13
13
|
let(:sh_test) { File.expand_path(test_dir + '/my_shell_file.sh') }
|
|
14
14
|
|
|
15
15
|
it 'fails without test files' do
|
|
16
|
-
expect { Beaker::TestSuite.new
|
|
17
|
-
Hash.new, :stop_on_error }.to raise_error
|
|
16
|
+
expect { Beaker::TestSuite.new('name', 'hosts', Hash.new, Time.now, :stop_on_error) }.to raise_error
|
|
18
17
|
end
|
|
19
18
|
|
|
20
19
|
it 'includes specific files as test file when explicitly passed' do
|
|
21
20
|
@files = [ rb_test ]
|
|
22
|
-
ts = Beaker::TestSuite.new
|
|
23
|
-
:stop_on_error
|
|
21
|
+
ts = Beaker::TestSuite.new('name', 'hosts', options, Time.now, :stop_on_error)
|
|
24
22
|
|
|
25
23
|
expect { ts.instance_variable_get(:@test_files).
|
|
26
24
|
include? rb_test }.to be_true
|
|
@@ -28,6 +26,79 @@ module Beaker
|
|
|
28
26
|
|
|
29
27
|
end
|
|
30
28
|
|
|
29
|
+
context 'run', :use_fakefs => true do
|
|
30
|
+
|
|
31
|
+
let( :options ) { make_opts.merge({ :logger => double().as_null_object, 'name' => create_files(@files), :log_dir => '.' }) }
|
|
32
|
+
let(:broken_script) { "raise RuntimeError" }
|
|
33
|
+
let(:fail_script) { "raise Beaker::DSL::Outcomes::FailTest" }
|
|
34
|
+
let(:okay_script) { "true" }
|
|
35
|
+
let(:rb_test) { 'my_ruby_file.rb' }
|
|
36
|
+
let(:pl_test) { '/my_perl_file.pl' }
|
|
37
|
+
let(:sh_test) { '/my_shell_file.sh' }
|
|
38
|
+
|
|
39
|
+
it 'fails fast if fail_mode != :slow and runtime error is raised' do
|
|
40
|
+
Logger.stub('new')
|
|
41
|
+
@files = [ rb_test, pl_test, sh_test]
|
|
42
|
+
File.open(rb_test, 'w') { |file| file.write(broken_script) }
|
|
43
|
+
File.open(pl_test, 'w') { |file| file.write(okay_script) }
|
|
44
|
+
File.open(sh_test, 'w') { |file| file.write(okay_script) }
|
|
45
|
+
|
|
46
|
+
ts = Beaker::TestSuite.new( 'name', 'hosts', options, Time.now, :stop )
|
|
47
|
+
tsr = ts.instance_variable_get( :@test_suite_results )
|
|
48
|
+
tsr.stub(:write_junit_xml).and_return( true )
|
|
49
|
+
tsr.stub(:summarize).and_return( true )
|
|
50
|
+
|
|
51
|
+
ts.run
|
|
52
|
+
expect( tsr.errored_tests ).to be === 1
|
|
53
|
+
expect( tsr.failed_tests ).to be === 0
|
|
54
|
+
expect( tsr.test_count ).to be === 1
|
|
55
|
+
expect( tsr.passed_tests).to be === 0
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it 'fails fast if fail_mode != :slow and fail test is raised' do
|
|
60
|
+
Logger.stub('new')
|
|
61
|
+
@files = [ rb_test, pl_test, sh_test]
|
|
62
|
+
File.open(rb_test, 'w') { |file| file.write(fail_script) }
|
|
63
|
+
File.open(pl_test, 'w') { |file| file.write(okay_script) }
|
|
64
|
+
File.open(sh_test, 'w') { |file| file.write(okay_script) }
|
|
65
|
+
|
|
66
|
+
ts = Beaker::TestSuite.new( 'name', 'hosts', options, Time.now, :stop )
|
|
67
|
+
tsr = ts.instance_variable_get( :@test_suite_results )
|
|
68
|
+
tsr.stub(:write_junit_xml).and_return( true )
|
|
69
|
+
tsr.stub(:summarize).and_return( true )
|
|
70
|
+
|
|
71
|
+
ts.run
|
|
72
|
+
expect( tsr.errored_tests ).to be === 0
|
|
73
|
+
expect( tsr.failed_tests ).to be === 1
|
|
74
|
+
expect( tsr.test_count ).to be === 1
|
|
75
|
+
expect( tsr.passed_tests).to be === 0
|
|
76
|
+
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
it 'fails slow if fail_mode = :slow, even if a test fails and there is a runtime error' do
|
|
80
|
+
Logger.stub('new')
|
|
81
|
+
@files = [ rb_test, pl_test, sh_test]
|
|
82
|
+
File.open(rb_test, 'w') { |file| file.write(broken_script) }
|
|
83
|
+
File.open(pl_test, 'w') { |file| file.write(fail_script) }
|
|
84
|
+
File.open(sh_test, 'w') { |file| file.write(okay_script) }
|
|
85
|
+
|
|
86
|
+
ts = Beaker::TestSuite.new( 'name', 'hosts', options, Time.now, :slow )
|
|
87
|
+
tsr = ts.instance_variable_get( :@test_suite_results )
|
|
88
|
+
tsr.stub(:write_junit_xml).and_return( true )
|
|
89
|
+
tsr.stub(:summarize).and_return( true )
|
|
90
|
+
|
|
91
|
+
ts.run
|
|
92
|
+
expect( tsr.errored_tests ).to be === 1
|
|
93
|
+
expect( tsr.failed_tests ).to be === 1
|
|
94
|
+
expect( tsr.test_count ).to be === 3
|
|
95
|
+
expect( tsr.passed_tests).to be === 1
|
|
96
|
+
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
end
|
|
101
|
+
|
|
31
102
|
describe TestSuite::TestSuiteResult do
|
|
32
103
|
|
|
33
104
|
let( :options ) { make_opts.merge({ :logger => double().as_null_object }) }
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: beaker
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.16.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Puppetlabs
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-07-
|
|
11
|
+
date: 2014-07-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: minitest
|
|
@@ -136,6 +136,20 @@ dependencies:
|
|
|
136
136
|
- - ! '>='
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
138
|
version: '0'
|
|
139
|
+
- !ruby/object:Gem::Dependency
|
|
140
|
+
name: gitlab-grit
|
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - ! '>='
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '0'
|
|
146
|
+
type: :development
|
|
147
|
+
prerelease: false
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - ! '>='
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '0'
|
|
139
153
|
- !ruby/object:Gem::Dependency
|
|
140
154
|
name: json
|
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -338,6 +352,7 @@ files:
|
|
|
338
352
|
- Rakefile
|
|
339
353
|
- beaker.gemspec
|
|
340
354
|
- bin/beaker
|
|
355
|
+
- history.rb
|
|
341
356
|
- lib/beaker.rb
|
|
342
357
|
- lib/beaker/answers.rb
|
|
343
358
|
- lib/beaker/answers/version20.rb
|