busser 0.6.2 → 0.7.0.rc.1
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 +4 -4
- data/.simplecov +1 -1
- data/.travis.yml +36 -13
- data/CHANGELOG.md +23 -1
- data/README.md +2 -0
- data/Rakefile +1 -4
- data/busser.gemspec +5 -7
- data/features/setup_command.feature +19 -2
- data/features/support/env.rb +4 -3
- data/lib/busser/cli.rb +1 -0
- data/lib/busser/command/setup.rb +69 -19
- data/lib/busser/command/test.rb +1 -1
- data/lib/busser/cucumber.rb +8 -3
- data/lib/busser/ui.rb +34 -14
- data/lib/busser/version.rb +1 -1
- data/spec/busser/ui_spec.rb +42 -2
- data/spec/spec_helper.rb +4 -2
- metadata +18 -33
- data/.tailor +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33a761472959045af71d47f2afe49b62340cc387
|
4
|
+
data.tar.gz: 493af07e1cc9799e76679273ec9fec9721b1a0b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e36c57606558acd0b442c23d8fe8fb93339d537df4d6025dcba9070228aee331ac2eede391ebc55d14fcd21f1ac4801b0378fa76c02e4dde9dc9f6e94ab5ae20
|
7
|
+
data.tar.gz: 81215af653fd82adde3b73c3ae0441d607a8cc5ba970d89ff2474b38a38b256a8941675548e39c11ba8bd54692cd1d2154f67505168805f09086b9d8b432de15
|
data/.simplecov
CHANGED
data/.travis.yml
CHANGED
@@ -1,29 +1,52 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
3
|
rvm:
|
4
|
-
- 2.
|
5
|
-
- 2.
|
6
|
-
-
|
7
|
-
- 1.9.
|
8
|
-
- ruby-head
|
4
|
+
- 2.2
|
5
|
+
- 2.1
|
6
|
+
- 2.0.0
|
7
|
+
- 1.9.3
|
8
|
+
- ruby-head
|
9
9
|
|
10
10
|
env:
|
11
|
+
- RUBYGEMS_VERSION=
|
12
|
+
- RUBYGEMS_VERSION=2.4.5
|
11
13
|
- RUBYGEMS_VERSION=2.2.2
|
12
14
|
- RUBYGEMS_VERSION=2.1.11
|
13
15
|
- RUBYGEMS_VERSION=2.0.14
|
14
|
-
- RUBYGEMS_VERSION=1.8.
|
16
|
+
- RUBYGEMS_VERSION=1.8.29
|
15
17
|
|
16
18
|
before_install:
|
17
|
-
- gem update --system $RUBYGEMS_VERSION
|
19
|
+
- if [ -n "$RUBYGEMS_VERSION" ]; then gem update --system $RUBYGEMS_VERSION; fi
|
18
20
|
- gem --version
|
19
21
|
|
20
22
|
bundler_args: --without guard
|
21
23
|
|
24
|
+
sudo: false
|
25
|
+
|
22
26
|
matrix:
|
23
|
-
exclude:
|
24
|
-
- rvm: 2.1
|
25
|
-
env: RUBYGEMS_VERSION=1.8.28
|
26
|
-
- rvm: 2.0.0
|
27
|
-
env: RUBYGEMS_VERSION=1.8.28
|
28
27
|
allow_failures:
|
29
|
-
|
28
|
+
- rvm: ruby-head
|
29
|
+
exclude:
|
30
|
+
- rvm: 2.2
|
31
|
+
env: RUBYGEMS_VERSION=2.2.2
|
32
|
+
- rvm: 2.2
|
33
|
+
env: RUBYGEMS_VERSION=2.1.11
|
34
|
+
- rvm: 2.2
|
35
|
+
env: RUBYGEMS_VERSION=2.0.14
|
36
|
+
- rvm: 2.2
|
37
|
+
env: RUBYGEMS_VERSION=1.8.29
|
38
|
+
- rvm: 2.1
|
39
|
+
env: RUBYGEMS_VERSION=1.8.29
|
40
|
+
- rvm: 2.0.0
|
41
|
+
env: RUBYGEMS_VERSION=1.8.29
|
42
|
+
- rvm: ruby-head
|
43
|
+
env: RUBYGEMS_VERSION=2.2.2
|
44
|
+
- rvm: ruby-head
|
45
|
+
env: RUBYGEMS_VERSION=2.1.11
|
46
|
+
- rvm: ruby-head
|
47
|
+
env: RUBYGEMS_VERSION=2.0.14
|
48
|
+
- rvm: ruby-head
|
49
|
+
env: RUBYGEMS_VERSION=1.8.29
|
50
|
+
|
51
|
+
notifications:
|
52
|
+
irc: "chat.freenode.net#kitchenci"
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
## 0.7.0 / Unreleased
|
2
|
+
|
3
|
+
### Bug fixes
|
4
|
+
|
5
|
+
* Pull request [#20][], issue [#17][]: Better detection of failed forked subprocess in `#run_ruby_script!` & `#run!`. ([@fnichol][], [@tyler-ball][], [@tknerr][])
|
6
|
+
|
7
|
+
### New features
|
8
|
+
|
9
|
+
* Add optional `--type bat` flag to `busser setup` to support Windows platforms. ([@fnichol][])
|
10
|
+
|
11
|
+
### Improvements
|
12
|
+
|
13
|
+
* Simplify busser binstub for more conservative bourne shell support. ([@fnichol][])
|
14
|
+
* Pull request [#15][]: Fix spelling in `busser test`. ([@obazoud][])
|
15
|
+
|
16
|
+
|
1
17
|
## 0.6.2 / 2014-03-23
|
2
18
|
|
3
19
|
### Bug fixes
|
@@ -107,7 +123,13 @@
|
|
107
123
|
[#6]: https://github.com/test-kitchen/busser/issues/6
|
108
124
|
[#7]: https://github.com/test-kitchen/busser/issues/7
|
109
125
|
[#8]: https://github.com/test-kitchen/busser/issues/8
|
126
|
+
[#15]: https://github.com/test-kitchen/busser/issues/15
|
127
|
+
[#17]: https://github.com/test-kitchen/busser/issues/17
|
128
|
+
[#20]: https://github.com/test-kitchen/busser/issues/20
|
110
129
|
[@fnichol]: https://github.com/fnichol
|
111
130
|
[@jtimberman]: https://github.com/jtimberman
|
112
131
|
[@neuhalje]: https://github.com/neuhalje
|
113
|
-
[@
|
132
|
+
[@obazoud]: https://github.com/obazoud
|
133
|
+
[@sawanoboly]: https://github.com/sawanoboly
|
134
|
+
[@tknerr]: https://github.com/tknerr
|
135
|
+
[@tyler-ball]: https://github.com/tyler-ball
|
data/README.md
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
# Busser
|
2
2
|
|
3
|
+
[](http://badge.fury.io/rb/busser)
|
3
4
|
[](https://travis-ci.org/test-kitchen/busser)
|
4
5
|
[](https://codeclimate.com/github/test-kitchen/busser)
|
6
|
+
[](https://gemnasium.com/test-kitchen/busser)
|
5
7
|
|
6
8
|
Busser is a test setup and execution framework designed to
|
7
9
|
work on remote nodes whose system dependencies cannot be relied upon, except
|
data/Rakefile
CHANGED
@@ -2,7 +2,6 @@ require "bundler/gem_tasks"
|
|
2
2
|
require 'rake/testtask'
|
3
3
|
require 'cucumber/rake/task'
|
4
4
|
require 'cane/rake_task'
|
5
|
-
require 'tailor/rake_task'
|
6
5
|
|
7
6
|
Rake::TestTask.new(:unit) do |t|
|
8
7
|
t.libs.push "lib"
|
@@ -22,8 +21,6 @@ Cane::RakeTask.new do |cane|
|
|
22
21
|
cane.canefile = './.cane'
|
23
22
|
end
|
24
23
|
|
25
|
-
Tailor::RakeTask.new
|
26
|
-
|
27
24
|
desc "Display LOC stats"
|
28
25
|
task :stats do
|
29
26
|
puts "\n## Production Code Stats"
|
@@ -33,6 +30,6 @@ task :stats do
|
|
33
30
|
end
|
34
31
|
|
35
32
|
desc "Run all quality tasks"
|
36
|
-
task :quality => [:cane, :
|
33
|
+
task :quality => [:cane, :stats]
|
37
34
|
|
38
35
|
task :default => [:test, :quality]
|
data/busser.gemspec
CHANGED
@@ -22,15 +22,13 @@ Gem::Specification.new do |spec|
|
|
22
22
|
|
23
23
|
spec.add_dependency 'thor', '<= 0.19.0'
|
24
24
|
|
25
|
+
spec.add_development_dependency 'aruba'
|
25
26
|
spec.add_development_dependency "bundler", "~> 1.3"
|
26
|
-
spec.add_development_dependency
|
27
|
+
spec.add_development_dependency 'cane'
|
28
|
+
spec.add_development_dependency 'countloc'
|
29
|
+
spec.add_development_dependency 'fakefs'
|
27
30
|
spec.add_development_dependency 'minitest'
|
28
31
|
spec.add_development_dependency 'mocha'
|
29
|
-
spec.add_development_dependency
|
30
|
-
spec.add_development_dependency 'aruba'
|
31
|
-
|
32
|
-
spec.add_development_dependency 'cane'
|
33
|
-
spec.add_development_dependency 'tailor'
|
32
|
+
spec.add_development_dependency "rake"
|
34
33
|
spec.add_development_dependency 'simplecov'
|
35
|
-
spec.add_development_dependency 'countloc'
|
36
34
|
end
|
@@ -7,11 +7,28 @@ Feature: Setup command
|
|
7
7
|
Given a test BUSSER_ROOT directory named "busser-setup"
|
8
8
|
And I delete the BUSSER_ROOT directory
|
9
9
|
|
10
|
-
Scenario: Busser home is set up
|
11
|
-
Given I run `busser setup`
|
10
|
+
Scenario: Busser home is set up with bourne binstub
|
11
|
+
Given I run `busser setup --type bourne`
|
12
12
|
Then the BUSSER_ROOT directory should exist
|
13
13
|
And a busser binstub file should contain:
|
14
14
|
"""
|
15
15
|
This file was generated by Busser.
|
16
16
|
"""
|
17
|
+
And a busser binstub file should contain:
|
18
|
+
"""
|
19
|
+
export BUSSER_ROOT
|
20
|
+
"""
|
21
|
+
And the exit status should be 0
|
22
|
+
|
23
|
+
Scenario: Busser home is set up with bat binstub
|
24
|
+
Given I run `busser setup --type bat`
|
25
|
+
Then the BUSSER_ROOT directory should exist
|
26
|
+
And a bat busser binstub file should contain:
|
27
|
+
"""
|
28
|
+
REM This file was generated by Busser.
|
29
|
+
"""
|
30
|
+
And a bat busser binstub file should contain:
|
31
|
+
"""
|
32
|
+
SET "BUSSER_EXIT_STATUS=%ERRORLEVEL%"
|
33
|
+
"""
|
17
34
|
And the exit status should be 0
|
data/features/support/env.rb
CHANGED
data/lib/busser/cli.rb
CHANGED
data/lib/busser/command/setup.rb
CHANGED
@@ -29,6 +29,10 @@ module Busser
|
|
29
29
|
#
|
30
30
|
class Setup < Busser::Thor::BaseGroup
|
31
31
|
|
32
|
+
class_option :type,
|
33
|
+
:desc => "Type of binstub file to create (bourne or bat)",
|
34
|
+
:default => "bourne"
|
35
|
+
|
32
36
|
def perform
|
33
37
|
banner "Setting up Busser"
|
34
38
|
create_busser_root
|
@@ -43,9 +47,58 @@ module Busser
|
|
43
47
|
end
|
44
48
|
|
45
49
|
def generate_busser_binstub
|
50
|
+
info "Creating busser binstub"
|
51
|
+
|
52
|
+
if options[:type] == "bat"
|
53
|
+
generate_busser_binstub_for_bat
|
54
|
+
else
|
55
|
+
generate_busser_binstub_for_bourne
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def generate_busser_binstub_for_bat
|
60
|
+
binstub = root_path + "bin/busser.bat"
|
61
|
+
busser_root = root_path.to_s.gsub("/", "\\")
|
62
|
+
|
63
|
+
File.unlink(binstub) if File.exists?(binstub)
|
64
|
+
create_file(binstub, :verbose => false) do
|
65
|
+
<<-BUSSER_BINSTUB.gsub(/^ {12}/, '')
|
66
|
+
@ECHO OFF
|
67
|
+
REM This file was generated by Busser.
|
68
|
+
REM
|
69
|
+
REM The application 'busser' is installed as part of a gem, and
|
70
|
+
REM this file is here to facilitate running it.
|
71
|
+
|
72
|
+
REM Make sure any variables we set exist only for this batch file
|
73
|
+
SETLOCAL
|
74
|
+
|
75
|
+
REM Set Busser Root Path
|
76
|
+
SET "BUSSER_ROOT=#{busser_root}"
|
77
|
+
|
78
|
+
REM Export gem paths so that we use the isolated gems.
|
79
|
+
SET "GEM_HOME=#{gem_home}"
|
80
|
+
SET "GEM_PATH=#{gem_path}"
|
81
|
+
SET "GEM_CACHE=#{gem_home}\\cache"
|
82
|
+
|
83
|
+
REM Unset RUBYOPT, we don't want this bleeding into our runtime.
|
84
|
+
SET RUBYOPT=
|
85
|
+
SET GEMRC=
|
86
|
+
|
87
|
+
REM Call the actual Busser bin with our arguments
|
88
|
+
"#{ruby_bin}" "#{gem_bindir}\\busser" %*
|
89
|
+
|
90
|
+
REM Store the exit status so we can re-use it later
|
91
|
+
SET "BUSSER_EXIT_STATUS=%ERRORLEVEL%"
|
92
|
+
|
93
|
+
REM Exit with the proper exit status from Busser
|
94
|
+
exit /b %BUSSER_EXIT_STATUS%
|
95
|
+
BUSSER_BINSTUB
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def generate_busser_binstub_for_bourne
|
46
100
|
binstub = root_path + "bin/busser"
|
47
101
|
|
48
|
-
info "Creating busser binstub"
|
49
102
|
File.unlink(binstub) if File.exists?(binstub)
|
50
103
|
create_file(binstub, :verbose => false) do
|
51
104
|
<<-BUSSER_BINSTUB.gsub(/^ {12}/, '')
|
@@ -56,14 +109,7 @@ module Busser
|
|
56
109
|
# The application 'busser' is installed as part of a gem, and
|
57
110
|
# this file is here to facilitate running it.
|
58
111
|
#
|
59
|
-
if
|
60
|
-
|
61
|
-
# Get the directory where this ruby is. This will also resolve
|
62
|
-
# any symlinks in the directory/script, so it will be the fully
|
63
|
-
# resolved path.
|
64
|
-
SOURCE="#{ruby_bin}"
|
65
|
-
while [ -h "$SOURCE" ] ; do SOURCE="`readlink "$SOURCE"`"; done
|
66
|
-
DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
|
112
|
+
if test -n "$DEBUG"; then set -x; fi
|
67
113
|
|
68
114
|
# Set Busser Root path
|
69
115
|
BUSSER_ROOT="#{root_path}"
|
@@ -71,40 +117,44 @@ module Busser
|
|
71
117
|
export BUSSER_ROOT
|
72
118
|
|
73
119
|
# Export gem paths so that we use the isolated gems.
|
74
|
-
GEM_HOME="#{gem_home}"
|
75
|
-
GEM_PATH="#{gem_path}"
|
76
|
-
GEM_CACHE="#{gem_home}/cache"
|
77
|
-
|
78
|
-
export GEM_HOME GEM_PATH GEM_CACHE
|
120
|
+
GEM_HOME="#{gem_home}"; export GEM_HOME
|
121
|
+
GEM_PATH="#{gem_path}"; export GEM_PATH
|
122
|
+
GEM_CACHE="#{gem_home}/cache"; export GEM_CACHE
|
79
123
|
|
80
124
|
# Unset RUBYOPT, we don't want this bleeding into our runtime.
|
81
125
|
unset RUBYOPT GEMRC
|
82
126
|
|
83
127
|
# Call the actual Busser bin with our arguments
|
84
|
-
exec "
|
128
|
+
exec "#{ruby_bin}" "#{gem_bindir}/busser" "$@"
|
85
129
|
BUSSER_BINSTUB
|
86
130
|
end
|
87
131
|
chmod(binstub, 0755, :verbose => false)
|
88
132
|
end
|
89
133
|
|
90
134
|
def ruby_bin
|
91
|
-
if bindir = RbConfig::CONFIG["bindir"]
|
135
|
+
result = if bindir = RbConfig::CONFIG["bindir"]
|
92
136
|
File.join(bindir, "ruby")
|
93
137
|
else
|
94
138
|
"ruby"
|
95
139
|
end
|
140
|
+
result = result.gsub("/", "\\").concat(".exe") if bat?
|
141
|
+
result
|
96
142
|
end
|
97
143
|
|
98
144
|
def gem_home
|
99
|
-
Gem.paths.home
|
145
|
+
Gem.paths.home.dup.tap { |p| p.gsub!("/", "\\") if bat? }
|
100
146
|
end
|
101
147
|
|
102
148
|
def gem_path
|
103
|
-
Gem.paths.path.join(":")
|
149
|
+
Gem.paths.path.join(":").dup.tap { |p| p.gsub!("/", "\\") if bat? }
|
104
150
|
end
|
105
151
|
|
106
152
|
def gem_bindir
|
107
|
-
Gem.bindir
|
153
|
+
Gem.bindir.dup.tap { |p| p.gsub!("/", "\\") if bat? }
|
154
|
+
end
|
155
|
+
|
156
|
+
def bat?
|
157
|
+
options[:type] == "bat"
|
108
158
|
end
|
109
159
|
end
|
110
160
|
end
|
data/lib/busser/command/test.rb
CHANGED
@@ -70,7 +70,7 @@ module Busser
|
|
70
70
|
if prepare_recipe.exist?
|
71
71
|
warn "Apologies, but Busser no longer supports the" +
|
72
72
|
" prepare_recipe.rb file. Please use prepare.sh and optionally" +
|
73
|
-
" shell out to chef-apply in an Omnibus
|
73
|
+
" shell out to chef-apply in an Omnibus installation."
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
data/lib/busser/cucumber.rb
CHANGED
@@ -66,7 +66,7 @@ end
|
|
66
66
|
|
67
67
|
Then(/^the suite file "(.*?)" should contain exactly:$/) do |file, content|
|
68
68
|
file_name = File.join(ENV['BUSSER_ROOT'], "suites", file)
|
69
|
-
|
69
|
+
check_file_content(file_name, content)
|
70
70
|
end
|
71
71
|
|
72
72
|
Then(/^the vendor directory named "(.*?)" should exist$/) do |name|
|
@@ -102,14 +102,19 @@ end
|
|
102
102
|
|
103
103
|
Then(/^a busser binstub file should contain:$/) do |partial_content|
|
104
104
|
file = File.join(ENV['BUSSER_ROOT'], %w{bin busser})
|
105
|
-
check_file_content(file, partial_content, true)
|
105
|
+
check_file_content(file, Regexp.new(Regexp.escape(partial_content)), true)
|
106
|
+
end
|
107
|
+
|
108
|
+
Then(/^a bat busser binstub file should contain:$/) do |partial_content|
|
109
|
+
file = File.join(ENV['BUSSER_ROOT'], %w{bin busser.bat})
|
110
|
+
check_file_content(file, Regexp.new(Regexp.escape(partial_content)), true)
|
106
111
|
end
|
107
112
|
|
108
113
|
Then(/^the file "(.*?)" should have permissions "(.*?)"$/) do |file, perms|
|
109
114
|
in_current_dir do
|
110
115
|
file_perms = sprintf("%o", File.stat(file).mode)
|
111
116
|
file_perms = file_perms[2, 4]
|
112
|
-
file_perms.
|
117
|
+
expect(file_perms).to eq(perms)
|
113
118
|
end
|
114
119
|
end
|
115
120
|
|
data/lib/busser/ui.rb
CHANGED
@@ -40,36 +40,56 @@ module Busser
|
|
40
40
|
say(">>>>>> #{msg}")
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
44
|
-
|
43
|
+
def fatal(msg)
|
44
|
+
error("!!!!!! #{msg}")
|
45
|
+
end
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
def run!(cmd, config = {})
|
48
|
+
config = { :capture => false, :verbose => false }.merge(config)
|
49
|
+
|
50
|
+
handle_command("Command", cmd) do
|
51
|
+
run(cmd, config)
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
54
55
|
def run_ruby_script!(cmd, config = {})
|
55
56
|
config = { :capture => false, :verbose => false }.merge(config)
|
56
|
-
run_ruby_script(cmd, config)
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
else
|
61
|
-
code = status.exitstatus
|
62
|
-
die "Ruby Script [#{cmd}] exit code was #{code}", code
|
58
|
+
handle_command("Ruby Script", cmd) do
|
59
|
+
run_ruby_script(cmd, config)
|
63
60
|
end
|
64
61
|
end
|
65
62
|
|
66
63
|
def die(msg, exitstatus = 1)
|
67
|
-
|
64
|
+
fatal(msg)
|
68
65
|
exit(exitstatus)
|
69
66
|
end
|
70
67
|
|
71
68
|
def status
|
72
69
|
$?
|
73
70
|
end
|
71
|
+
|
72
|
+
def handle_command(type, cmd)
|
73
|
+
begin
|
74
|
+
yield
|
75
|
+
rescue => e
|
76
|
+
fatal(
|
77
|
+
"#{type} [#{cmd}] raised an exception: #{e.message}\n" +
|
78
|
+
e.backtrace.join("\n"))
|
79
|
+
raise
|
80
|
+
end
|
81
|
+
|
82
|
+
if status.nil?
|
83
|
+
die(
|
84
|
+
"#{type} [#{cmd}] did not return a valid status. " \
|
85
|
+
"This instance could be starved for RAM or may have swap disabled."
|
86
|
+
)
|
87
|
+
elsif status.success?
|
88
|
+
true
|
89
|
+
else
|
90
|
+
code = status.exitstatus
|
91
|
+
die("#{type} [#{cmd}] exit code was #{code}", code)
|
92
|
+
end
|
93
|
+
end
|
74
94
|
end
|
75
95
|
end
|
data/lib/busser/version.rb
CHANGED
data/spec/busser/ui_spec.rb
CHANGED
@@ -14,6 +14,10 @@ class SneakyUI
|
|
14
14
|
msg
|
15
15
|
end
|
16
16
|
|
17
|
+
def error(msg)
|
18
|
+
$stderr.puts msg
|
19
|
+
end
|
20
|
+
|
17
21
|
def run(cmd, opts)
|
18
22
|
@run_args = [cmd, opts]
|
19
23
|
end
|
@@ -33,7 +37,7 @@ class SneakyUI
|
|
33
37
|
|
34
38
|
# these methods are technically private, so we'll avoid straight send
|
35
39
|
# calls in the specs
|
36
|
-
%w{banner info warn die run! run_ruby_script!}.each do |meth|
|
40
|
+
%w{banner info warn fatal die run! run_ruby_script!}.each do |meth|
|
37
41
|
define_method("invoke_#{meth}") { |*args| send(meth, *args) }
|
38
42
|
end
|
39
43
|
end
|
@@ -72,9 +76,13 @@ describe Busser::UI do
|
|
72
76
|
ui.invoke_warn("grinder").must_equal ">>>>>> grinder"
|
73
77
|
end
|
74
78
|
|
79
|
+
it "#fatal should display a formatted message on stderr" do
|
80
|
+
capture_stderr { ui.invoke_fatal("grinder") }.must_equal "!!!!!! grinder\n"
|
81
|
+
end
|
82
|
+
|
75
83
|
describe "#die" do
|
76
84
|
it "prints a message to stderr" do
|
77
|
-
capture_stderr { ui.invoke_die("noes") }.must_equal "noes\n"
|
85
|
+
capture_stderr { ui.invoke_die("noes") }.must_equal "!!!!!! noes\n"
|
78
86
|
end
|
79
87
|
|
80
88
|
it "calls exit with 1 by default" do
|
@@ -105,6 +113,14 @@ describe Busser::UI do
|
|
105
113
|
ui.invoke_run!("great-stuff").must_equal true
|
106
114
|
end
|
107
115
|
|
116
|
+
it "re-raises any exceptions from the underlying fork/exec" do
|
117
|
+
ui.stubs(:run).raises(Errno::ENOMEM)
|
118
|
+
|
119
|
+
capture_stderr {
|
120
|
+
proc { ui.invoke_run!("failwhale") }.must_raise Errno::ENOMEM
|
121
|
+
}.must_match /raised an exception/
|
122
|
+
end
|
123
|
+
|
108
124
|
it "terminates the program if the command failed" do
|
109
125
|
ui.status = FakeStatus.new(false)
|
110
126
|
capture_stderr { ui.invoke_run!("failwhale") }
|
@@ -119,6 +135,14 @@ describe Busser::UI do
|
|
119
135
|
ui.invoke_run!("failwhale").must_equal 24
|
120
136
|
end
|
121
137
|
end
|
138
|
+
|
139
|
+
it "terminates the program if status is nil" do
|
140
|
+
ui.status = nil
|
141
|
+
capture_stderr { ui.invoke_run!("failwhale") }.
|
142
|
+
must_match /did not return a valid status/
|
143
|
+
|
144
|
+
ui.died?.must_equal true
|
145
|
+
end
|
122
146
|
end
|
123
147
|
|
124
148
|
describe "#run_ruby_script!" do
|
@@ -145,6 +169,14 @@ describe Busser::UI do
|
|
145
169
|
ui.invoke_run_ruby_script!("thewin.rb").must_equal true
|
146
170
|
end
|
147
171
|
|
172
|
+
it "re-raises any exceptions from the underlying fork/exec" do
|
173
|
+
ui.stubs(:run_ruby_script).raises(Errno::ENOMEM)
|
174
|
+
|
175
|
+
capture_stderr {
|
176
|
+
proc { ui.invoke_run_ruby_script!("nope.rb") }.must_raise Errno::ENOMEM
|
177
|
+
}.must_match /raised an exception/
|
178
|
+
end
|
179
|
+
|
148
180
|
it "terminates the program if the script failed" do
|
149
181
|
ui.status = FakeStatus.new(false)
|
150
182
|
capture_stderr { ui.invoke_run_ruby_script!("nope.rb") }
|
@@ -159,6 +191,14 @@ describe Busser::UI do
|
|
159
191
|
ui.invoke_run_ruby_script!("nadda.rb").must_equal 97
|
160
192
|
end
|
161
193
|
end
|
194
|
+
|
195
|
+
it "terminates the program if status is nil" do
|
196
|
+
ui.status = nil
|
197
|
+
capture_stderr { ui.invoke_run_ruby_script!("nope.rb") }.
|
198
|
+
must_match /did not return a valid status/
|
199
|
+
|
200
|
+
ui.died?.must_equal true
|
201
|
+
end
|
162
202
|
end
|
163
203
|
|
164
204
|
def capture_stderr
|
data/spec/spec_helper.rb
CHANGED
@@ -16,9 +16,11 @@
|
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
18
18
|
|
19
|
-
require 'simplecov'
|
20
19
|
require 'fakefs/safe'
|
21
20
|
require 'minitest/autorun'
|
22
21
|
require 'mocha/setup'
|
23
22
|
|
24
|
-
|
23
|
+
if ENV["COVERAGE"]
|
24
|
+
require 'simplecov'
|
25
|
+
SimpleCov.command_name "unit"
|
26
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: busser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0.rc.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fletcher Nichol
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -25,21 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.19.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.3'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.3'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
28
|
+
name: aruba
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
31
|
- - ">="
|
@@ -53,21 +39,21 @@ dependencies:
|
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
42
|
+
name: bundler
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
|
-
- - "
|
45
|
+
- - "~>"
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
47
|
+
version: '1.3'
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
|
-
- - "
|
52
|
+
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
54
|
+
version: '1.3'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
56
|
+
name: cane
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
59
|
- - ">="
|
@@ -81,7 +67,7 @@ dependencies:
|
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
70
|
+
name: countloc
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
73
|
- - ">="
|
@@ -95,7 +81,7 @@ dependencies:
|
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: '0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
84
|
+
name: fakefs
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
87
|
- - ">="
|
@@ -109,7 +95,7 @@ dependencies:
|
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: '0'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
98
|
+
name: minitest
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
101
|
- - ">="
|
@@ -123,7 +109,7 @@ dependencies:
|
|
123
109
|
- !ruby/object:Gem::Version
|
124
110
|
version: '0'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
112
|
+
name: mocha
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
128
114
|
requirements:
|
129
115
|
- - ">="
|
@@ -137,7 +123,7 @@ dependencies:
|
|
137
123
|
- !ruby/object:Gem::Version
|
138
124
|
version: '0'
|
139
125
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
126
|
+
name: rake
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
142
128
|
requirements:
|
143
129
|
- - ">="
|
@@ -151,7 +137,7 @@ dependencies:
|
|
151
137
|
- !ruby/object:Gem::Version
|
152
138
|
version: '0'
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
140
|
+
name: simplecov
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
156
142
|
requirements:
|
157
143
|
- - ">="
|
@@ -175,7 +161,6 @@ files:
|
|
175
161
|
- ".cane"
|
176
162
|
- ".gitignore"
|
177
163
|
- ".simplecov"
|
178
|
-
- ".tailor"
|
179
164
|
- ".travis.yml"
|
180
165
|
- CHANGELOG.md
|
181
166
|
- Gemfile
|
@@ -251,12 +236,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
251
236
|
version: 1.9.1
|
252
237
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
253
238
|
requirements:
|
254
|
-
- - "
|
239
|
+
- - ">"
|
255
240
|
- !ruby/object:Gem::Version
|
256
|
-
version:
|
241
|
+
version: 1.3.1
|
257
242
|
requirements: []
|
258
243
|
rubyforge_project:
|
259
|
-
rubygems_version: 2.
|
244
|
+
rubygems_version: 2.4.5
|
260
245
|
signing_key:
|
261
246
|
specification_version: 4
|
262
247
|
summary: Busser - Runs tests for projects in Test Kitchen
|
data/.tailor
DELETED