test-kitchen 1.14.1 → 1.14.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Berksfile +1 -1
- data/CHANGELOG.md +7 -0
- data/Gemfile +1 -1
- data/Guardfile +5 -5
- data/Rakefile +5 -5
- data/bin/kitchen +1 -1
- data/features/step_definitions/gem_steps.rb +6 -6
- data/features/support/env.rb +6 -7
- data/lib/kitchen.rb +5 -7
- data/lib/kitchen/base64_stream.rb +2 -8
- data/lib/kitchen/cli.rb +76 -80
- data/lib/kitchen/collection.rb +0 -2
- data/lib/kitchen/color.rb +7 -9
- data/lib/kitchen/command.rb +0 -4
- data/lib/kitchen/command/action.rb +0 -3
- data/lib/kitchen/command/console.rb +4 -7
- data/lib/kitchen/command/diagnose.rb +7 -14
- data/lib/kitchen/command/driver_discover.rb +1 -4
- data/lib/kitchen/command/exec.rb +0 -3
- data/lib/kitchen/command/list.rb +9 -12
- data/lib/kitchen/command/login.rb +0 -3
- data/lib/kitchen/command/package.rb +0 -3
- data/lib/kitchen/command/sink.rb +6 -9
- data/lib/kitchen/command/test.rb +1 -4
- data/lib/kitchen/config.rb +25 -27
- data/lib/kitchen/configurable.rb +26 -31
- data/lib/kitchen/data_munger.rb +34 -36
- data/lib/kitchen/diagnostic.rb +5 -7
- data/lib/kitchen/driver.rb +3 -5
- data/lib/kitchen/driver/base.rb +0 -3
- data/lib/kitchen/driver/dummy.rb +0 -3
- data/lib/kitchen/driver/proxy.rb +0 -3
- data/lib/kitchen/driver/ssh_base.rb +13 -16
- data/lib/kitchen/errors.rb +11 -16
- data/lib/kitchen/generator/driver_create.rb +18 -21
- data/lib/kitchen/generator/init.rb +21 -26
- data/lib/kitchen/instance.rb +19 -23
- data/lib/kitchen/lazy_hash.rb +1 -2
- data/lib/kitchen/loader/yaml.rb +22 -25
- data/lib/kitchen/logger.rb +9 -14
- data/lib/kitchen/logging.rb +0 -3
- data/lib/kitchen/login_command.rb +0 -2
- data/lib/kitchen/metadata_chopper.rb +0 -2
- data/lib/kitchen/platform.rb +1 -3
- data/lib/kitchen/provisioner.rb +3 -5
- data/lib/kitchen/provisioner/base.rb +2 -5
- data/lib/kitchen/provisioner/chef/berkshelf.rb +1 -5
- data/lib/kitchen/provisioner/chef/common_sandbox.rb +24 -29
- data/lib/kitchen/provisioner/chef/librarian.rb +2 -6
- data/lib/kitchen/provisioner/chef/policyfile.rb +4 -8
- data/lib/kitchen/provisioner/chef_apply.rb +14 -17
- data/lib/kitchen/provisioner/chef_base.rb +43 -46
- data/lib/kitchen/provisioner/chef_solo.rb +10 -13
- data/lib/kitchen/provisioner/chef_zero.rb +22 -29
- data/lib/kitchen/provisioner/dummy.rb +0 -3
- data/lib/kitchen/provisioner/shell.rb +6 -9
- data/lib/kitchen/rake_tasks.rb +4 -6
- data/lib/kitchen/shell_out.rb +3 -5
- data/lib/kitchen/ssh.rb +16 -22
- data/lib/kitchen/state_file.rb +3 -5
- data/lib/kitchen/suite.rb +0 -2
- data/lib/kitchen/thor_tasks.rb +2 -4
- data/lib/kitchen/transport.rb +3 -5
- data/lib/kitchen/transport/base.rb +1 -7
- data/lib/kitchen/transport/dummy.rb +0 -4
- data/lib/kitchen/transport/ssh.rb +41 -47
- data/lib/kitchen/transport/winrm.rb +41 -40
- data/lib/kitchen/util.rb +1 -3
- data/lib/kitchen/verifier.rb +3 -5
- data/lib/kitchen/verifier/base.rb +2 -5
- data/lib/kitchen/verifier/busser.rb +24 -24
- data/lib/kitchen/verifier/dummy.rb +0 -3
- data/lib/kitchen/verifier/shell.rb +1 -3
- data/lib/kitchen/version.rb +1 -1
- data/lib/vendor/hash_recursive_merge.rb +0 -2
- data/spec/kitchen/base64_stream_spec.rb +3 -6
- data/spec/kitchen/cli_spec.rb +0 -2
- data/spec/kitchen/collection_spec.rb +4 -8
- data/spec/kitchen/color_spec.rb +0 -3
- data/spec/kitchen/config_spec.rb +91 -106
- data/spec/kitchen/configurable_spec.rb +44 -76
- data/spec/kitchen/data_munger_spec.rb +1178 -1247
- data/spec/kitchen/diagnostic_spec.rb +37 -38
- data/spec/kitchen/driver/base_spec.rb +7 -14
- data/spec/kitchen/driver/dummy_spec.rb +1 -7
- data/spec/kitchen/driver/proxy_spec.rb +2 -7
- data/spec/kitchen/driver/ssh_base_spec.rb +128 -149
- data/spec/kitchen/driver_spec.rb +7 -13
- data/spec/kitchen/errors_spec.rb +50 -60
- data/spec/kitchen/instance_spec.rb +217 -294
- data/spec/kitchen/lazy_hash_spec.rb +14 -18
- data/spec/kitchen/loader/yaml_spec.rb +201 -227
- data/spec/kitchen/logger_spec.rb +7 -15
- data/spec/kitchen/logging_spec.rb +1 -4
- data/spec/kitchen/login_command_spec.rb +3 -4
- data/spec/kitchen/metadata_chopper_spec.rb +0 -3
- data/spec/kitchen/platform_spec.rb +31 -32
- data/spec/kitchen/provisioner/base_spec.rb +22 -41
- data/spec/kitchen/provisioner/chef/policyfile_spec.rb +15 -15
- data/spec/kitchen/provisioner/chef_apply_spec.rb +8 -13
- data/spec/kitchen/provisioner/chef_base_spec.rb +150 -182
- data/spec/kitchen/provisioner/chef_solo_spec.rb +58 -72
- data/spec/kitchen/provisioner/chef_zero_spec.rb +99 -125
- data/spec/kitchen/provisioner/dummy_spec.rb +8 -11
- data/spec/kitchen/provisioner/shell_spec.rb +86 -103
- data/spec/kitchen/provisioner_spec.rb +5 -11
- data/spec/kitchen/shell_out_spec.rb +15 -19
- data/spec/kitchen/ssh_spec.rb +16 -35
- data/spec/kitchen/state_file_spec.rb +6 -11
- data/spec/kitchen/suite_spec.rb +5 -6
- data/spec/kitchen/transport/base_spec.rb +6 -14
- data/spec/kitchen/transport/ssh_spec.rb +39 -64
- data/spec/kitchen/transport/winrm_spec.rb +99 -127
- data/spec/kitchen/transport_spec.rb +7 -13
- data/spec/kitchen/util_spec.rb +17 -26
- data/spec/kitchen/verifier/base_spec.rb +24 -40
- data/spec/kitchen/verifier/busser_spec.rb +38 -68
- data/spec/kitchen/verifier/dummy_spec.rb +8 -11
- data/spec/kitchen/verifier/shell_spec.rb +14 -17
- data/spec/kitchen/verifier_spec.rb +7 -13
- data/spec/kitchen_spec.rb +4 -6
- data/spec/spec_helper.rb +1 -1
- data/spec/support/powershell_max_size_spec.rb +1 -2
- data/support/chef-client-zero.rb +3 -4
- data/test-kitchen.gemspec +4 -6
- metadata +9 -9
@@ -25,14 +25,11 @@ require "kitchen/transport"
|
|
25
25
|
require "kitchen/transport/base"
|
26
26
|
|
27
27
|
module Kitchen
|
28
|
-
|
29
28
|
module Transport
|
30
|
-
|
31
29
|
class Coolbeans < Kitchen::Transport::Base
|
32
30
|
end
|
33
31
|
|
34
32
|
class ItDepends < Kitchen::Transport::Base
|
35
|
-
|
36
33
|
attr_reader :verify_call_count
|
37
34
|
|
38
35
|
def initialize(config = {})
|
@@ -46,7 +43,6 @@ module Kitchen
|
|
46
43
|
end
|
47
44
|
|
48
45
|
class UnstableDepends < Kitchen::Transport::Base
|
49
|
-
|
50
46
|
def verify_dependencies
|
51
47
|
raise UserError, "Oh noes, you don't have software!"
|
52
48
|
end
|
@@ -55,9 +51,7 @@ module Kitchen
|
|
55
51
|
end
|
56
52
|
|
57
53
|
describe Kitchen::Transport do
|
58
|
-
|
59
54
|
describe ".for_plugin" do
|
60
|
-
|
61
55
|
before do
|
62
56
|
Kitchen::Transport.stubs(:require).returns(true)
|
63
57
|
end
|
@@ -69,7 +63,7 @@ describe Kitchen::Transport do
|
|
69
63
|
end
|
70
64
|
|
71
65
|
it "returns a transport initialized with its config" do
|
72
|
-
transport = Kitchen::Transport.for_plugin("coolbeans", :
|
66
|
+
transport = Kitchen::Transport.for_plugin("coolbeans", foo: "bar")
|
73
67
|
|
74
68
|
transport[:foo].must_equal "bar"
|
75
69
|
end
|
@@ -92,21 +86,21 @@ describe Kitchen::Transport do
|
|
92
86
|
it "raises ClientError if the transport could not be required" do
|
93
87
|
Kitchen::Transport.stubs(:require).raises(LoadError)
|
94
88
|
|
95
|
-
proc { Kitchen::Transport.for_plugin("coolbeans", {}) }
|
96
|
-
must_raise Kitchen::ClientError
|
89
|
+
proc { Kitchen::Transport.for_plugin("coolbeans", {}) }
|
90
|
+
.must_raise Kitchen::ClientError
|
97
91
|
end
|
98
92
|
|
99
93
|
it "raises ClientError if the transport's class constant was not found" do
|
100
94
|
# pretend require worked
|
101
95
|
Kitchen::Transport.stubs(:require).returns(true)
|
102
96
|
|
103
|
-
proc { Kitchen::Transport.for_plugin("nope", {}) }
|
104
|
-
must_raise Kitchen::ClientError
|
97
|
+
proc { Kitchen::Transport.for_plugin("nope", {}) }
|
98
|
+
.must_raise Kitchen::ClientError
|
105
99
|
end
|
106
100
|
|
107
101
|
it "raises UserError if #verify_dependencies failes" do
|
108
|
-
proc { Kitchen::Transport.for_plugin("unstable_depends", {}) }
|
109
|
-
must_raise Kitchen::UserError
|
102
|
+
proc { Kitchen::Transport.for_plugin("unstable_depends", {}) }
|
103
|
+
.must_raise Kitchen::UserError
|
110
104
|
end
|
111
105
|
end
|
112
106
|
end
|
data/spec/kitchen/util_spec.rb
CHANGED
@@ -23,56 +23,51 @@ require "logger"
|
|
23
23
|
require "kitchen/util"
|
24
24
|
|
25
25
|
describe Kitchen::Util do
|
26
|
-
|
27
26
|
describe ".to_logger_level" do
|
28
|
-
|
29
27
|
it "returns nil for invalid symbols" do
|
30
28
|
Kitchen::Util.to_logger_level(:nope).must_be_nil
|
31
29
|
end
|
32
30
|
|
33
|
-
%w
|
31
|
+
%w{debug info warn error fatal}.each do |level|
|
34
32
|
it "returns Logger::#{level.upcase} for :#{level} input" do
|
35
|
-
Kitchen::Util.to_logger_level(level.to_sym)
|
36
|
-
|
33
|
+
Kitchen::Util.to_logger_level(level.to_sym)
|
34
|
+
.must_equal Logger.const_get(level.upcase)
|
37
35
|
end
|
38
36
|
end
|
39
37
|
end
|
40
38
|
|
41
39
|
describe ".from_logger_level" do
|
42
|
-
|
43
40
|
it "returns :fatal for invalid symbols" do
|
44
41
|
Kitchen::Util.from_logger_level("nope").must_equal :fatal
|
45
42
|
end
|
46
43
|
|
47
|
-
%w
|
44
|
+
%w{debug info warn error fatal}.each do |level|
|
48
45
|
it "returns :#{level} for Logger::#{level.upcase} input" do
|
49
|
-
Kitchen::Util.from_logger_level(Logger.const_get(level.upcase))
|
50
|
-
|
46
|
+
Kitchen::Util.from_logger_level(Logger.const_get(level.upcase))
|
47
|
+
.must_equal(level.to_sym)
|
51
48
|
end
|
52
49
|
end
|
53
50
|
end
|
54
51
|
|
55
52
|
describe ".symbolized_hash" do
|
56
|
-
|
57
53
|
it "returns itself if not a hash" do
|
58
54
|
obj = Object.new
|
59
55
|
Kitchen::Util.symbolized_hash(obj).must_equal obj
|
60
56
|
end
|
61
57
|
|
62
58
|
it "preserves a symbolized hash" do
|
63
|
-
hash = { :
|
59
|
+
hash = { one: [{ two: "three" }] }
|
64
60
|
Kitchen::Util.symbolized_hash(hash).must_equal hash
|
65
61
|
end
|
66
62
|
|
67
63
|
it "converts string keys into symbols" do
|
68
|
-
Kitchen::Util
|
69
|
-
symbolized_hash("one" => [{ "two" => :three, :four => "five" }])
|
70
|
-
must_equal(:
|
64
|
+
Kitchen::Util
|
65
|
+
.symbolized_hash("one" => [{ "two" => :three, :four => "five" }])
|
66
|
+
.must_equal(one: [{ two: :three, four: "five" }])
|
71
67
|
end
|
72
68
|
end
|
73
69
|
|
74
70
|
describe ".stringified_hash" do
|
75
|
-
|
76
71
|
it "returns itself if not a hash" do
|
77
72
|
obj = Object.new
|
78
73
|
Kitchen::Util.stringified_hash(obj).must_equal obj
|
@@ -84,14 +79,13 @@ describe Kitchen::Util do
|
|
84
79
|
end
|
85
80
|
|
86
81
|
it "converts symbol keys into strings" do
|
87
|
-
Kitchen::Util
|
88
|
-
stringified_hash(:
|
89
|
-
must_equal("one" => [{ "two" => :three, "four" => "five" }])
|
82
|
+
Kitchen::Util
|
83
|
+
.stringified_hash(one: [{ :two => :three, "four" => "five" }])
|
84
|
+
.must_equal("one" => [{ "two" => :three, "four" => "five" }])
|
90
85
|
end
|
91
86
|
end
|
92
87
|
|
93
88
|
describe ".duration" do
|
94
|
-
|
95
89
|
it "turns nil into a zero" do
|
96
90
|
Kitchen::Util.duration(nil).must_equal "(0m0.00s)"
|
97
91
|
end
|
@@ -101,12 +95,11 @@ describe Kitchen::Util do
|
|
101
95
|
end
|
102
96
|
|
103
97
|
it "formats large values into minutes and seconds" do
|
104
|
-
Kitchen::Util.duration(
|
98
|
+
Kitchen::Util.duration(48_033).must_equal "(800m33.00s)"
|
105
99
|
end
|
106
100
|
end
|
107
101
|
|
108
102
|
describe ".wrap_unix_command" do
|
109
|
-
|
110
103
|
it "returns the wrapped command" do
|
111
104
|
end
|
112
105
|
|
@@ -124,7 +117,6 @@ describe Kitchen::Util do
|
|
124
117
|
end
|
125
118
|
|
126
119
|
describe ".outdent!" do
|
127
|
-
|
128
120
|
it "modifies the argument string in place, destructively" do
|
129
121
|
string = "yep"
|
130
122
|
|
@@ -145,10 +137,9 @@ describe Kitchen::Util do
|
|
145
137
|
end
|
146
138
|
|
147
139
|
describe ".shell_helpers" do
|
148
|
-
|
149
|
-
%w[
|
140
|
+
%w{
|
150
141
|
exists do_wget do_curl do_fetch do_perl do_python do_download
|
151
|
-
|
142
|
+
}.each do |func|
|
152
143
|
it "contains a #{func} shell function" do
|
153
144
|
Kitchen::Util.shell_helpers.must_match "#{func}() {"
|
154
145
|
end
|
@@ -159,7 +150,7 @@ describe Kitchen::Util do
|
|
159
150
|
end
|
160
151
|
|
161
152
|
def regexify(str)
|
162
|
-
Regexp.new("
|
153
|
+
Regexp.new("^ +" + Regexp.escape(str) + "$")
|
163
154
|
end
|
164
155
|
end
|
165
156
|
end
|
@@ -26,11 +26,8 @@ require "kitchen/verifier/base"
|
|
26
26
|
require "kitchen/transport/base"
|
27
27
|
|
28
28
|
module Kitchen
|
29
|
-
|
30
29
|
module Verifier
|
31
|
-
|
32
30
|
class TestingDummy < Kitchen::Verifier::Base
|
33
|
-
|
34
31
|
attr_reader :called_create_sandbox, :called_cleanup_sandbox
|
35
32
|
|
36
33
|
def install_command
|
@@ -65,11 +62,10 @@ module Kitchen
|
|
65
62
|
end
|
66
63
|
|
67
64
|
describe Kitchen::Verifier::Base do
|
68
|
-
|
69
65
|
let(:logged_output) { StringIO.new }
|
70
66
|
let(:logger) { Logger.new(logged_output) }
|
71
|
-
let(:platform) { stub(:
|
72
|
-
let(:suite) { stub(:
|
67
|
+
let(:platform) { stub(os_type: nil, shell_type: nil) }
|
68
|
+
let(:suite) { stub(name: "germany") }
|
73
69
|
let(:config) { Hash.new }
|
74
70
|
|
75
71
|
let(:transport) do
|
@@ -80,12 +76,12 @@ describe Kitchen::Verifier::Base do
|
|
80
76
|
|
81
77
|
let(:instance) do
|
82
78
|
stub(
|
83
|
-
:
|
84
|
-
:
|
85
|
-
:
|
86
|
-
:
|
87
|
-
:
|
88
|
-
:
|
79
|
+
name: "coolbeans",
|
80
|
+
to_str: "instance",
|
81
|
+
logger: logger,
|
82
|
+
platform: platform,
|
83
|
+
suite: suite,
|
84
|
+
transport: transport
|
89
85
|
)
|
90
86
|
end
|
91
87
|
|
@@ -94,9 +90,7 @@ describe Kitchen::Verifier::Base do
|
|
94
90
|
end
|
95
91
|
|
96
92
|
describe "configuration" do
|
97
|
-
|
98
93
|
describe "for unix operating systems" do
|
99
|
-
|
100
94
|
before { platform.stubs(:os_type).returns("unix") }
|
101
95
|
|
102
96
|
it ":sudo defaults to true" do
|
@@ -113,7 +107,6 @@ describe Kitchen::Verifier::Base do
|
|
113
107
|
end
|
114
108
|
|
115
109
|
describe "for windows operating systems" do
|
116
|
-
|
117
110
|
before { platform.stubs(:os_type).returns("windows") }
|
118
111
|
|
119
112
|
it ":sudo defaults to nil" do
|
@@ -124,8 +117,8 @@ describe Kitchen::Verifier::Base do
|
|
124
117
|
verifier[:sudo_command].must_equal nil
|
125
118
|
end
|
126
119
|
|
127
|
-
it
|
128
|
-
verifier[:root_path].must_equal
|
120
|
+
it ':root_path defaults to $env:TEMP\\verifier' do
|
121
|
+
verifier[:root_path].must_equal '$env:TEMP\\verifier'
|
129
122
|
end
|
130
123
|
end
|
131
124
|
|
@@ -147,7 +140,6 @@ describe Kitchen::Verifier::Base do
|
|
147
140
|
end
|
148
141
|
|
149
142
|
describe "#call" do
|
150
|
-
|
151
143
|
let(:state) { Hash.new }
|
152
144
|
let(:cmd) { verifier.call(state) }
|
153
145
|
|
@@ -210,8 +202,8 @@ describe Kitchen::Verifier::Base do
|
|
210
202
|
it "logs to info" do
|
211
203
|
cmd
|
212
204
|
|
213
|
-
logged_output.string
|
214
|
-
|
205
|
+
logged_output.string
|
206
|
+
.must_match(/INFO -- : Transferring files to instance$/)
|
215
207
|
end
|
216
208
|
|
217
209
|
it "uploads sandbox files" do
|
@@ -227,29 +219,27 @@ describe Kitchen::Verifier::Base do
|
|
227
219
|
end
|
228
220
|
|
229
221
|
it "raises an ActionFailed on transfer when TransportFailed is raised" do
|
230
|
-
connection.stubs(:upload)
|
231
|
-
|
222
|
+
connection.stubs(:upload)
|
223
|
+
.raises(Kitchen::Transport::TransportFailed.new("dang"))
|
232
224
|
|
233
225
|
proc { cmd }.must_raise Kitchen::ActionFailed
|
234
226
|
end
|
235
227
|
|
236
228
|
it "raises an ActionFailed on execute when TransportFailed is raised" do
|
237
|
-
connection.stubs(:execute)
|
238
|
-
|
229
|
+
connection.stubs(:execute)
|
230
|
+
.raises(Kitchen::Transport::TransportFailed.new("dang"))
|
239
231
|
|
240
232
|
proc { cmd }.must_raise Kitchen::ActionFailed
|
241
233
|
end
|
242
234
|
end
|
243
235
|
|
244
236
|
[:init_command, :install_command, :prepare_command, :run_command].each do |cmd|
|
245
|
-
|
246
237
|
it "has a #{cmd} method" do
|
247
238
|
verifier.public_send(cmd).must_be_nil
|
248
239
|
end
|
249
240
|
end
|
250
241
|
|
251
242
|
describe "sandbox" do
|
252
|
-
|
253
243
|
after do
|
254
244
|
begin
|
255
245
|
verifier.cleanup_sandbox
|
@@ -265,8 +255,8 @@ describe Kitchen::Verifier::Base do
|
|
265
255
|
verifier.create_sandbox
|
266
256
|
|
267
257
|
File.directory?(verifier.sandbox_path).must_equal true
|
268
|
-
format("%o", File.stat(verifier.sandbox_path).mode)[1, 4]
|
269
|
-
must_equal "0755"
|
258
|
+
format("%o", File.stat(verifier.sandbox_path).mode)[1, 4]
|
259
|
+
.must_equal "0755"
|
270
260
|
end
|
271
261
|
|
272
262
|
it "#create_sandbox logs an info message" do
|
@@ -278,8 +268,8 @@ describe Kitchen::Verifier::Base do
|
|
278
268
|
it "#create_sandbox logs a debug message" do
|
279
269
|
verifier.create_sandbox
|
280
270
|
|
281
|
-
logged_output.string
|
282
|
-
|
271
|
+
logged_output.string
|
272
|
+
.must_match debug_line_starting_with("Creating local sandbox in ")
|
283
273
|
end
|
284
274
|
|
285
275
|
it "#cleanup_sandbox deletes the sandbox directory" do
|
@@ -293,23 +283,21 @@ describe Kitchen::Verifier::Base do
|
|
293
283
|
verifier.create_sandbox
|
294
284
|
verifier.cleanup_sandbox
|
295
285
|
|
296
|
-
logged_output.string
|
297
|
-
|
286
|
+
logged_output.string
|
287
|
+
.must_match debug_line_starting_with("Cleaning up local sandbox in ")
|
298
288
|
end
|
299
289
|
|
300
290
|
def info_line(msg)
|
301
|
-
|
291
|
+
/^I, .* : #{Regexp.escape(msg)}$/
|
302
292
|
end
|
303
293
|
|
304
294
|
def debug_line_starting_with(msg)
|
305
|
-
|
295
|
+
/^D, .* : #{Regexp.escape(msg)}/
|
306
296
|
end
|
307
297
|
end
|
308
298
|
|
309
299
|
describe "#sudo" do
|
310
|
-
|
311
300
|
describe "with :sudo set" do
|
312
|
-
|
313
301
|
before { config[:sudo] = true }
|
314
302
|
|
315
303
|
it "prepends sudo command" do
|
@@ -324,7 +312,6 @@ describe Kitchen::Verifier::Base do
|
|
324
312
|
end
|
325
313
|
|
326
314
|
describe "with :sudo falsey" do
|
327
|
-
|
328
315
|
before { config[:sudo] = false }
|
329
316
|
|
330
317
|
it "does not include sudo command" do
|
@@ -340,9 +327,7 @@ describe Kitchen::Verifier::Base do
|
|
340
327
|
end
|
341
328
|
|
342
329
|
describe "#prefix_command" do
|
343
|
-
|
344
330
|
describe "with :command_prefix set" do
|
345
|
-
|
346
331
|
before { config[:command_prefix] = "my_prefix" }
|
347
332
|
|
348
333
|
it "prepends the command with the prefix" do
|
@@ -351,7 +336,6 @@ describe Kitchen::Verifier::Base do
|
|
351
336
|
end
|
352
337
|
|
353
338
|
describe "with :command_prefix unset" do
|
354
|
-
|
355
339
|
before { config[:command_prefix] = nil }
|
356
340
|
|
357
341
|
it "returns an unaltered command" do
|
@@ -22,20 +22,19 @@ require "kitchen"
|
|
22
22
|
require "kitchen/verifier/busser"
|
23
23
|
|
24
24
|
describe Kitchen::Verifier::Busser do
|
25
|
-
|
26
25
|
let(:logged_output) { StringIO.new }
|
27
26
|
let(:logger) { Logger.new(logged_output) }
|
28
27
|
let(:config) { Hash.new }
|
29
|
-
let(:platform) { stub(:
|
30
|
-
let(:suite) { stub(:
|
28
|
+
let(:platform) { stub(os_type: nil, shell_type: nil) }
|
29
|
+
let(:suite) { stub(name: "germany") }
|
31
30
|
|
32
31
|
let(:instance) do
|
33
32
|
stub(
|
34
|
-
:
|
35
|
-
:
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
33
|
+
name: "coolbeans",
|
34
|
+
logger: logger,
|
35
|
+
platform: platform,
|
36
|
+
suite: suite,
|
37
|
+
to_str: "instance"
|
39
38
|
)
|
40
39
|
end
|
41
40
|
|
@@ -46,30 +45,30 @@ describe Kitchen::Verifier::Busser do
|
|
46
45
|
let(:files) do
|
47
46
|
{
|
48
47
|
"mondospec/charlie" => {
|
49
|
-
:
|
50
|
-
:
|
48
|
+
content: "charlie",
|
49
|
+
perms: (running_tests_on_windows? ? "0644" : "0764"),
|
51
50
|
},
|
52
51
|
"minispec/beta" => {
|
53
|
-
:
|
54
|
-
:
|
52
|
+
content: "beta",
|
53
|
+
perms: "0644",
|
55
54
|
},
|
56
55
|
"abba/alpha" => {
|
57
|
-
:
|
58
|
-
:
|
59
|
-
}
|
56
|
+
content: "alpha",
|
57
|
+
perms: (running_tests_on_windows? ? "0444" : "0440"),
|
58
|
+
},
|
60
59
|
}
|
61
60
|
end
|
62
61
|
|
63
62
|
let(:helper_files) do
|
64
63
|
{
|
65
64
|
"minispec/spec_helper" => {
|
66
|
-
:
|
67
|
-
:
|
65
|
+
content: "helping",
|
66
|
+
perms: "0644",
|
68
67
|
},
|
69
68
|
"abba/common" => {
|
70
|
-
:
|
71
|
-
:
|
72
|
-
}
|
69
|
+
content: "yeppers",
|
70
|
+
perms: (running_tests_on_windows? ? "0644" : "0664"),
|
71
|
+
},
|
73
72
|
}
|
74
73
|
end
|
75
74
|
|
@@ -98,12 +97,10 @@ describe Kitchen::Verifier::Busser do
|
|
98
97
|
end
|
99
98
|
|
100
99
|
describe "configuration" do
|
101
|
-
|
102
100
|
describe "for unix operating systems" do
|
103
|
-
|
104
|
-
before {
|
101
|
+
before do
|
105
102
|
platform.stubs(:os_type).returns("unix")
|
106
|
-
|
103
|
+
end
|
107
104
|
|
108
105
|
it ":ruby_bindir defaults the an Omnibus Chef installation" do
|
109
106
|
verifier[:ruby_bindir].must_equal "/opt/chef/embedded/bin"
|
@@ -117,18 +114,17 @@ describe Kitchen::Verifier::Busser do
|
|
117
114
|
end
|
118
115
|
|
119
116
|
describe "for windows operating systems" do
|
120
|
-
|
121
117
|
before { platform.stubs(:os_type).returns("windows") }
|
122
118
|
|
123
119
|
it ":ruby_bindir defaults the an Omnibus Chef installation" do
|
124
|
-
verifier[:ruby_bindir]
|
125
|
-
must_equal
|
120
|
+
verifier[:ruby_bindir]
|
121
|
+
.must_equal '$env:systemdrive\\opscode\\chef\\embedded\\bin'
|
126
122
|
end
|
127
123
|
|
128
124
|
it ":busser_bin defaults to a binstub under :root_path" do
|
129
|
-
config[:root_path] =
|
125
|
+
config[:root_path] = '\\beep'
|
130
126
|
|
131
|
-
verifier[:busser_bin].must_equal
|
127
|
+
verifier[:busser_bin].must_equal '\\beep\\bin\\busser.bat'
|
132
128
|
end
|
133
129
|
end
|
134
130
|
|
@@ -183,13 +179,10 @@ describe Kitchen::Verifier::Busser do
|
|
183
179
|
end
|
184
180
|
|
185
181
|
describe "#install_command" do
|
186
|
-
|
187
182
|
let(:cmd) { verifier.install_command }
|
188
183
|
|
189
184
|
describe "with no suite test files" do
|
190
|
-
|
191
185
|
describe "for bourne shells" do
|
192
|
-
|
193
186
|
before { platform.stubs(:shell_type).returns("bourne") }
|
194
187
|
|
195
188
|
it "returns nil" do
|
@@ -198,7 +191,6 @@ describe Kitchen::Verifier::Busser do
|
|
198
191
|
end
|
199
192
|
|
200
193
|
describe "for powershell shells on windows os types" do
|
201
|
-
|
202
194
|
before do
|
203
195
|
platform.stubs(:shell_type).returns("powershell")
|
204
196
|
platform.stubs(:os_type).returns("windows")
|
@@ -211,9 +203,7 @@ describe Kitchen::Verifier::Busser do
|
|
211
203
|
end
|
212
204
|
|
213
205
|
describe "with suite test files" do
|
214
|
-
|
215
206
|
describe "common behavior" do
|
216
|
-
|
217
207
|
before do
|
218
208
|
platform.stubs(:shell_type).returns("fake")
|
219
209
|
create_test_files
|
@@ -233,7 +223,6 @@ describe Kitchen::Verifier::Busser do
|
|
233
223
|
end
|
234
224
|
|
235
225
|
describe "for bourne shells" do
|
236
|
-
|
237
226
|
before do
|
238
227
|
platform.stubs(:shell_type).returns("bourne")
|
239
228
|
create_test_files
|
@@ -259,8 +248,8 @@ describe Kitchen::Verifier::Busser do
|
|
259
248
|
|
260
249
|
it "sets gem install arguments" do
|
261
250
|
cmd.must_match regexify(
|
262
|
-
|
263
|
-
|
251
|
+
'gem_install_args="busser --no-rdoc --no-ri --no-format-executable' \
|
252
|
+
' -n /r/bin --no-user-install"'
|
264
253
|
)
|
265
254
|
end
|
266
255
|
|
@@ -281,13 +270,12 @@ describe Kitchen::Verifier::Busser do
|
|
281
270
|
end
|
282
271
|
|
283
272
|
describe "for powershell shells on windows os types" do
|
284
|
-
|
285
273
|
before do
|
286
274
|
platform.stubs(:shell_type).returns("powershell")
|
287
275
|
platform.stubs(:os_type).returns("windows")
|
288
276
|
create_test_files
|
289
|
-
config[:ruby_bindir] =
|
290
|
-
config[:root_path] =
|
277
|
+
config[:ruby_bindir] = '\\rbd'
|
278
|
+
config[:root_path] = '\\r'
|
291
279
|
end
|
292
280
|
|
293
281
|
common_powershell_variable_specs
|
@@ -308,8 +296,8 @@ describe Kitchen::Verifier::Busser do
|
|
308
296
|
|
309
297
|
it "sets gem install arguments" do
|
310
298
|
cmd.must_match regexify(
|
311
|
-
|
312
|
-
|
299
|
+
'$gem_install_args = "busser --no-rdoc --no-ri --no-format-executable' \
|
300
|
+
' -n \\r\\bin --no-user-install"'
|
313
301
|
)
|
314
302
|
end
|
315
303
|
|
@@ -326,13 +314,10 @@ describe Kitchen::Verifier::Busser do
|
|
326
314
|
end
|
327
315
|
|
328
316
|
describe "#init_command" do
|
329
|
-
|
330
317
|
let(:cmd) { verifier.init_command }
|
331
318
|
|
332
319
|
describe "with no suite test files" do
|
333
|
-
|
334
320
|
describe "for bourne shells" do
|
335
|
-
|
336
321
|
before { platform.stubs(:shell_type).returns("bourne") }
|
337
322
|
|
338
323
|
it "returns nil" do
|
@@ -341,7 +326,6 @@ describe Kitchen::Verifier::Busser do
|
|
341
326
|
end
|
342
327
|
|
343
328
|
describe "for powershell shells on windows os types" do
|
344
|
-
|
345
329
|
before do
|
346
330
|
platform.stubs(:shell_type).returns("powershell")
|
347
331
|
platform.stubs(:os_type).returns("windows")
|
@@ -354,9 +338,7 @@ describe Kitchen::Verifier::Busser do
|
|
354
338
|
end
|
355
339
|
|
356
340
|
describe "with suite test files" do
|
357
|
-
|
358
341
|
describe "common behavior" do
|
359
|
-
|
360
342
|
before do
|
361
343
|
platform.stubs(:shell_type).returns("fake")
|
362
344
|
create_test_files
|
@@ -376,7 +358,6 @@ describe Kitchen::Verifier::Busser do
|
|
376
358
|
end
|
377
359
|
|
378
360
|
describe "for bourne shells" do
|
379
|
-
|
380
361
|
before do
|
381
362
|
platform.stubs(:shell_type).returns("bourne")
|
382
363
|
create_test_files
|
@@ -403,19 +384,18 @@ describe Kitchen::Verifier::Busser do
|
|
403
384
|
end
|
404
385
|
|
405
386
|
describe "for powershell shells on windows os types" do
|
406
|
-
|
407
387
|
before do
|
408
388
|
platform.stubs(:shell_type).returns("powershell")
|
409
389
|
platform.stubs(:os_type).returns("windows")
|
410
390
|
create_test_files
|
411
|
-
config[:ruby_bindir] =
|
412
|
-
config[:root_path] =
|
391
|
+
config[:ruby_bindir] = '\\rbd'
|
392
|
+
config[:root_path] = '\\r'
|
413
393
|
end
|
414
394
|
|
415
395
|
common_powershell_variable_specs
|
416
396
|
|
417
397
|
it "runs busser's suite cleanup" do
|
418
|
-
config[:root_path] =
|
398
|
+
config[:root_path] = '\\b'
|
419
399
|
|
420
400
|
cmd.must_match regexify(%{& \\b\\bin\\busser.bat suite cleanup})
|
421
401
|
end
|
@@ -424,13 +404,10 @@ describe Kitchen::Verifier::Busser do
|
|
424
404
|
end
|
425
405
|
|
426
406
|
describe "#run_command" do
|
427
|
-
|
428
407
|
let(:cmd) { verifier.run_command }
|
429
408
|
|
430
409
|
describe "with no suite test files" do
|
431
|
-
|
432
410
|
describe "for bourne shells" do
|
433
|
-
|
434
411
|
before { platform.stubs(:shell_type).returns("bourne") }
|
435
412
|
|
436
413
|
it "returns nil" do
|
@@ -439,7 +416,6 @@ describe Kitchen::Verifier::Busser do
|
|
439
416
|
end
|
440
417
|
|
441
418
|
describe "for powershell shells on windows os types" do
|
442
|
-
|
443
419
|
before do
|
444
420
|
platform.stubs(:shell_type).returns("powershell")
|
445
421
|
platform.stubs(:os_type).returns("windows")
|
@@ -452,9 +428,7 @@ describe Kitchen::Verifier::Busser do
|
|
452
428
|
end
|
453
429
|
|
454
430
|
describe "with suite test files" do
|
455
|
-
|
456
431
|
describe "common behavior" do
|
457
|
-
|
458
432
|
before do
|
459
433
|
platform.stubs(:shell_type).returns("fake")
|
460
434
|
create_test_files
|
@@ -474,7 +448,6 @@ describe Kitchen::Verifier::Busser do
|
|
474
448
|
end
|
475
449
|
|
476
450
|
describe "for bourne shells" do
|
477
|
-
|
478
451
|
before do
|
479
452
|
platform.stubs(:shell_type).returns("bourne")
|
480
453
|
create_test_files
|
@@ -501,19 +474,18 @@ describe Kitchen::Verifier::Busser do
|
|
501
474
|
end
|
502
475
|
|
503
476
|
describe "for powershell shells on windows os types" do
|
504
|
-
|
505
477
|
before do
|
506
478
|
platform.stubs(:shell_type).returns("powershell")
|
507
479
|
platform.stubs(:os_type).returns("windows")
|
508
480
|
create_test_files
|
509
|
-
config[:ruby_bindir] =
|
510
|
-
config[:root_path] =
|
481
|
+
config[:ruby_bindir] = '\\rbd'
|
482
|
+
config[:root_path] = '\\r'
|
511
483
|
end
|
512
484
|
|
513
485
|
common_powershell_variable_specs
|
514
486
|
|
515
487
|
it "runs busser's test" do
|
516
|
-
config[:root_path] =
|
488
|
+
config[:root_path] = '\\b'
|
517
489
|
|
518
490
|
cmd.must_match regexify(%{& \\b\\bin\\busser.bat test})
|
519
491
|
end
|
@@ -522,7 +494,6 @@ describe Kitchen::Verifier::Busser do
|
|
522
494
|
end
|
523
495
|
|
524
496
|
describe "#create_sandbox" do
|
525
|
-
|
526
497
|
before do
|
527
498
|
create_test_files
|
528
499
|
end
|
@@ -557,7 +528,6 @@ describe Kitchen::Verifier::Busser do
|
|
557
528
|
end
|
558
529
|
|
559
530
|
describe "Busser legacy behavior for code calling old method names" do
|
560
|
-
|
561
531
|
let(:busser) { verifier }
|
562
532
|
|
563
533
|
it "responds to #setup_cmd which calls #install_command" do
|
@@ -605,6 +575,6 @@ describe Kitchen::Verifier::Busser do
|
|
605
575
|
end
|
606
576
|
|
607
577
|
def warn_line_with(msg)
|
608
|
-
|
578
|
+
/^W, .* : #{Regexp.escape(msg)}/
|
609
579
|
end
|
610
580
|
end
|