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
data/spec/kitchen/logger_spec.rb
CHANGED
@@ -21,7 +21,6 @@ require_relative "../spec_helper"
|
|
21
21
|
require "kitchen"
|
22
22
|
|
23
23
|
describe Kitchen::Logger do
|
24
|
-
|
25
24
|
before do
|
26
25
|
@orig_stdout = $stdout
|
27
26
|
$stdout = StringIO.new
|
@@ -36,7 +35,7 @@ describe Kitchen::Logger do
|
|
36
35
|
end
|
37
36
|
|
38
37
|
let(:opts) do
|
39
|
-
{ :
|
38
|
+
{ color: :red, colorize: true }
|
40
39
|
end
|
41
40
|
|
42
41
|
let(:logger) do
|
@@ -96,7 +95,6 @@ describe Kitchen::Logger do
|
|
96
95
|
end
|
97
96
|
|
98
97
|
describe "stdout-based logger" do
|
99
|
-
|
100
98
|
let(:stdout) { StringIO.new }
|
101
99
|
|
102
100
|
before { opts[:stdout] = stdout }
|
@@ -130,7 +128,6 @@ describe Kitchen::Logger do
|
|
130
128
|
end
|
131
129
|
|
132
130
|
describe "for severity" do
|
133
|
-
|
134
131
|
before { opts[:level] = Kitchen::Util.to_logger_level(:debug) }
|
135
132
|
|
136
133
|
it "logs to banner" do
|
@@ -226,7 +223,6 @@ describe Kitchen::Logger do
|
|
226
223
|
end
|
227
224
|
|
228
225
|
describe "#<<" do
|
229
|
-
|
230
226
|
it "message with a newline are logged on info" do
|
231
227
|
logger << "yo\n"
|
232
228
|
|
@@ -247,7 +243,7 @@ describe Kitchen::Logger do
|
|
247
243
|
"-----> banner",
|
248
244
|
" info",
|
249
245
|
">>>>>> error",
|
250
|
-
"vanilla"
|
246
|
+
"vanilla",
|
251
247
|
].join("\n").concat("\n")
|
252
248
|
|
253
249
|
stdout.string.must_equal(
|
@@ -262,7 +258,7 @@ describe Kitchen::Logger do
|
|
262
258
|
logger << [
|
263
259
|
"-----> banner",
|
264
260
|
" info",
|
265
|
-
"partial"
|
261
|
+
"partial",
|
266
262
|
].join("\n")
|
267
263
|
|
268
264
|
stdout.string.must_equal(
|
@@ -294,7 +290,7 @@ describe Kitchen::Logger do
|
|
294
290
|
it "logger chomps carriage return characters" do
|
295
291
|
logger << [
|
296
292
|
"-----> banner\r",
|
297
|
-
"vanilla\r"
|
293
|
+
"vanilla\r",
|
298
294
|
].join("\n").concat("\n")
|
299
295
|
|
300
296
|
stdout.string.must_equal(
|
@@ -306,16 +302,14 @@ describe Kitchen::Logger do
|
|
306
302
|
end
|
307
303
|
|
308
304
|
describe "opened IO logdev-based logger" do
|
309
|
-
|
310
305
|
let(:logdev) { StringIO.new }
|
311
306
|
|
312
307
|
before { opts[:logdev] = logdev }
|
313
308
|
|
314
309
|
describe "for severity" do
|
315
|
-
|
316
310
|
before { opts[:level] = Kitchen::Util.to_logger_level(:debug) }
|
317
311
|
|
318
|
-
let(:ts) {
|
312
|
+
let(:ts) { '\\[[^\\]]+\\]' }
|
319
313
|
|
320
314
|
it "logs to banner" do
|
321
315
|
logger.banner("yo")
|
@@ -362,8 +356,7 @@ describe Kitchen::Logger do
|
|
362
356
|
end
|
363
357
|
|
364
358
|
describe "file IO logdev-based logger" do
|
365
|
-
|
366
|
-
let(:logfile) { Dir::Tmpname.make_tmpname(%w[kitchen .log], nil) }
|
359
|
+
let(:logfile) { Dir::Tmpname.make_tmpname(%w{kitchen .log}, nil) }
|
367
360
|
|
368
361
|
before do
|
369
362
|
opts[:logdev] = logfile
|
@@ -377,10 +370,9 @@ describe Kitchen::Logger do
|
|
377
370
|
end
|
378
371
|
|
379
372
|
describe "for severity" do
|
380
|
-
|
381
373
|
before { opts[:level] = Kitchen::Util.to_logger_level(:debug) }
|
382
374
|
|
383
|
-
let(:ts) {
|
375
|
+
let(:ts) { '\\[[^\\]]+\\]' }
|
384
376
|
|
385
377
|
it "logs to banner" do
|
386
378
|
logger.banner("yo")
|
@@ -21,7 +21,6 @@ require_relative "../spec_helper"
|
|
21
21
|
require "kitchen/logging"
|
22
22
|
|
23
23
|
class LoggingDummy
|
24
|
-
|
25
24
|
include Kitchen::Logging
|
26
25
|
|
27
26
|
attr_reader :logger
|
@@ -31,8 +30,7 @@ class LoggingDummy
|
|
31
30
|
end
|
32
31
|
|
33
32
|
class Logger
|
34
|
-
|
35
|
-
METHODS = [:banner, :debug, :info, :warn, :error, :fatal]
|
33
|
+
METHODS = [:banner, :debug, :info, :warn, :error, :fatal].freeze
|
36
34
|
|
37
35
|
attr_reader(*(METHODS.map { |m| "#{m}_msg".to_sym }))
|
38
36
|
|
@@ -45,7 +43,6 @@ class LoggingDummy
|
|
45
43
|
end
|
46
44
|
|
47
45
|
describe Kitchen::Logging do
|
48
|
-
|
49
46
|
let(:logger) { LoggingDummy::Logger.new }
|
50
47
|
let(:subject) { LoggingDummy.new(logger) }
|
51
48
|
|
@@ -21,9 +21,8 @@ require_relative "../spec_helper"
|
|
21
21
|
require "kitchen/login_command"
|
22
22
|
|
23
23
|
describe Kitchen::LoginCommand do
|
24
|
-
|
25
24
|
let(:cmd) { "" }
|
26
|
-
let(:argv) {
|
25
|
+
let(:argv) { [] }
|
27
26
|
let(:opts) { Hash.new }
|
28
27
|
|
29
28
|
let(:login_command) { Kitchen::LoginCommand.new(cmd, argv, opts) }
|
@@ -51,7 +50,7 @@ describe Kitchen::LoginCommand do
|
|
51
50
|
it "#options returns the options hash from the constructor" do
|
52
51
|
opts[:cake] = "yummy"
|
53
52
|
|
54
|
-
login_command.options.must_equal(:
|
53
|
+
login_command.options.must_equal(cake: "yummy")
|
55
54
|
end
|
56
55
|
|
57
56
|
it "#exec_args returns an array of arguments for Kernel.exec" do
|
@@ -63,6 +62,6 @@ describe Kitchen::LoginCommand do
|
|
63
62
|
|
64
63
|
opts[:charlie] = "delta"
|
65
64
|
login_command.exec_args.must_equal [
|
66
|
-
"alpha", "-o", "beta", { :
|
65
|
+
"alpha", "-o", "beta", { charlie: "delta" }]
|
67
66
|
end
|
68
67
|
end
|
@@ -21,7 +21,6 @@ require_relative "../spec_helper"
|
|
21
21
|
require "kitchen/metadata_chopper"
|
22
22
|
|
23
23
|
describe Kitchen::MetadataChopper do
|
24
|
-
|
25
24
|
before do
|
26
25
|
FakeFS.activate!
|
27
26
|
FileUtils.mkdir_p("/tmp")
|
@@ -35,7 +34,6 @@ describe Kitchen::MetadataChopper do
|
|
35
34
|
let(:described_class) { Kitchen::MetadataChopper }
|
36
35
|
|
37
36
|
describe ".new" do
|
38
|
-
|
39
37
|
it "contains a :name attribute" do
|
40
38
|
stub_metadata!("banzai")
|
41
39
|
|
@@ -50,7 +48,6 @@ describe Kitchen::MetadataChopper do
|
|
50
48
|
end
|
51
49
|
|
52
50
|
describe ".extract" do
|
53
|
-
|
54
51
|
it "returns a tuple" do
|
55
52
|
stub_metadata!("foo", "1.2.3")
|
56
53
|
|
@@ -22,8 +22,7 @@ require "kitchen/errors"
|
|
22
22
|
require "kitchen/platform"
|
23
23
|
|
24
24
|
describe Kitchen::Platform do
|
25
|
-
|
26
|
-
let(:opts) do; { :name => "plata" }; end
|
25
|
+
let(:opts) { ; { name: "plata" }; }
|
27
26
|
let(:klass) { Kitchen::Platform }
|
28
27
|
|
29
28
|
it "raises an ArgumentError if name is missing" do
|
@@ -32,49 +31,49 @@ describe Kitchen::Platform do
|
|
32
31
|
end
|
33
32
|
|
34
33
|
it "#os_type returns value passed into constructor with :os_type" do
|
35
|
-
klass.new(:
|
36
|
-
klass.new(:
|
37
|
-
klass.new(:
|
38
|
-
klass.new(:
|
34
|
+
klass.new(name: "p", os_type: "unix").os_type.must_equal "unix"
|
35
|
+
klass.new(name: "p", os_type: "windows").os_type.must_equal "windows"
|
36
|
+
klass.new(name: "p", os_type: "unicorn").os_type.must_equal "unicorn"
|
37
|
+
klass.new(name: "p", os_type: nil).os_type.must_equal nil
|
39
38
|
end
|
40
39
|
|
41
40
|
it "#os_type defaults to `unix` when not provided" do
|
42
|
-
klass.new(:
|
41
|
+
klass.new(name: "p").os_type.must_equal "unix"
|
43
42
|
end
|
44
43
|
|
45
44
|
it "#os_type defaults to `windows` if the name starts with 'win'" do
|
46
|
-
klass.new(:
|
47
|
-
klass.new(:
|
48
|
-
klass.new(:
|
49
|
-
klass.new(:
|
50
|
-
klass.new(:
|
51
|
-
klass.new(:
|
52
|
-
klass.new(:
|
45
|
+
klass.new(name: "win").os_type.must_equal "windows"
|
46
|
+
klass.new(name: "Win").os_type.must_equal "windows"
|
47
|
+
klass.new(name: "win7").os_type.must_equal "windows"
|
48
|
+
klass.new(name: "windows").os_type.must_equal "windows"
|
49
|
+
klass.new(name: "Windows").os_type.must_equal "windows"
|
50
|
+
klass.new(name: "windows81").os_type.must_equal "windows"
|
51
|
+
klass.new(name: "windows-2012").os_type.must_equal "windows"
|
53
52
|
end
|
54
53
|
|
55
54
|
it "#shell_type returns value passed into constructor with :shell_type" do
|
56
|
-
klass.new(:
|
57
|
-
|
58
|
-
klass.new(:
|
59
|
-
|
60
|
-
klass.new(:
|
61
|
-
|
62
|
-
klass.new(:
|
63
|
-
|
55
|
+
klass.new(name: "p", shell_type: "bourne")
|
56
|
+
.shell_type.must_equal "bourne"
|
57
|
+
klass.new(name: "p", shell_type: "powershell")
|
58
|
+
.shell_type.must_equal "powershell"
|
59
|
+
klass.new(name: "p", shell_type: "unicorn")
|
60
|
+
.shell_type.must_equal "unicorn"
|
61
|
+
klass.new(name: "p", shell_type: nil)
|
62
|
+
.shell_type.must_equal nil
|
64
63
|
end
|
65
64
|
|
66
65
|
it "#shell_type defaults to `bourne` when not provided" do
|
67
|
-
klass.new(:
|
66
|
+
klass.new(name: "p").shell_type.must_equal "bourne"
|
68
67
|
end
|
69
68
|
|
70
69
|
it "#shell_type defaults to `powershell` if the name starts with 'windows'" do
|
71
|
-
klass.new(:
|
72
|
-
klass.new(:
|
73
|
-
klass.new(:
|
74
|
-
klass.new(:
|
75
|
-
klass.new(:
|
76
|
-
klass.new(:
|
77
|
-
klass.new(:
|
70
|
+
klass.new(name: "win").shell_type.must_equal "powershell"
|
71
|
+
klass.new(name: "Win").shell_type.must_equal "powershell"
|
72
|
+
klass.new(name: "win7").shell_type.must_equal "powershell"
|
73
|
+
klass.new(name: "windows").shell_type.must_equal "powershell"
|
74
|
+
klass.new(name: "Windows").shell_type.must_equal "powershell"
|
75
|
+
klass.new(name: "windows81").shell_type.must_equal "powershell"
|
76
|
+
klass.new(name: "windows-2012").shell_type.must_equal "powershell"
|
78
77
|
end
|
79
78
|
|
80
79
|
it "#diagnose returns a hash with sorted keys" do
|
@@ -82,8 +81,8 @@ describe Kitchen::Platform do
|
|
82
81
|
opts[:shell_type] = "wundershell"
|
83
82
|
|
84
83
|
klass.new(opts).diagnose.must_equal(
|
85
|
-
:
|
86
|
-
:
|
84
|
+
os_type: "unikitty",
|
85
|
+
shell_type: "wundershell"
|
87
86
|
)
|
88
87
|
end
|
89
88
|
end
|
@@ -23,11 +23,8 @@ require "stringio"
|
|
23
23
|
require "kitchen"
|
24
24
|
|
25
25
|
module Kitchen
|
26
|
-
|
27
26
|
module Provisioner
|
28
|
-
|
29
27
|
class TestingDummy < Kitchen::Provisioner::Base
|
30
|
-
|
31
28
|
attr_reader :called_create_sandbox, :called_cleanup_sandbox
|
32
29
|
|
33
30
|
def install_command
|
@@ -62,10 +59,9 @@ module Kitchen
|
|
62
59
|
end
|
63
60
|
|
64
61
|
describe Kitchen::Provisioner::Base do
|
65
|
-
|
66
62
|
let(:logged_output) { StringIO.new }
|
67
63
|
let(:logger) { Logger.new(logged_output) }
|
68
|
-
let(:platform) { stub(:
|
64
|
+
let(:platform) { stub(os_type: nil, shell_type: nil) }
|
69
65
|
let(:config) { Hash.new }
|
70
66
|
|
71
67
|
let(:transport) do
|
@@ -76,11 +72,11 @@ describe Kitchen::Provisioner::Base do
|
|
76
72
|
|
77
73
|
let(:instance) do
|
78
74
|
stub(
|
79
|
-
:
|
80
|
-
:
|
81
|
-
:
|
82
|
-
:
|
83
|
-
:
|
75
|
+
name: "coolbeans",
|
76
|
+
to_str: "instance",
|
77
|
+
logger: logger,
|
78
|
+
platform: platform,
|
79
|
+
transport: transport
|
84
80
|
)
|
85
81
|
end
|
86
82
|
|
@@ -89,9 +85,7 @@ describe Kitchen::Provisioner::Base do
|
|
89
85
|
end
|
90
86
|
|
91
87
|
describe "configuration" do
|
92
|
-
|
93
88
|
describe "for unix operating systems" do
|
94
|
-
|
95
89
|
before { platform.stubs(:os_type).returns("unix") }
|
96
90
|
|
97
91
|
it ":root_path defaults to /tmp/kitchen" do
|
@@ -108,11 +102,10 @@ describe Kitchen::Provisioner::Base do
|
|
108
102
|
end
|
109
103
|
|
110
104
|
describe "for windows operating systems" do
|
111
|
-
|
112
105
|
before { platform.stubs(:os_type).returns("windows") }
|
113
106
|
|
114
|
-
it
|
115
|
-
provisioner[:root_path].must_equal
|
107
|
+
it ':root_path defaults to $env:TEMP\\kitchen' do
|
108
|
+
provisioner[:root_path].must_equal '$env:TEMP\\kitchen'
|
116
109
|
end
|
117
110
|
|
118
111
|
it ":sudo defaults to nil" do
|
@@ -138,7 +131,6 @@ describe Kitchen::Provisioner::Base do
|
|
138
131
|
end
|
139
132
|
|
140
133
|
describe "#call" do
|
141
|
-
|
142
134
|
let(:state) { Hash.new }
|
143
135
|
let(:cmd) { provisioner.call(state) }
|
144
136
|
|
@@ -202,8 +194,8 @@ describe Kitchen::Provisioner::Base do
|
|
202
194
|
it "logs to info" do
|
203
195
|
cmd
|
204
196
|
|
205
|
-
logged_output.string
|
206
|
-
|
197
|
+
logged_output.string
|
198
|
+
.must_match(/INFO -- : Transferring files to instance$/)
|
207
199
|
end
|
208
200
|
|
209
201
|
it "uploads sandbox files" do
|
@@ -219,29 +211,27 @@ describe Kitchen::Provisioner::Base do
|
|
219
211
|
end
|
220
212
|
|
221
213
|
it "raises an ActionFailed on transfer when TransportFailed is raised" do
|
222
|
-
connection.stubs(:upload)
|
223
|
-
|
214
|
+
connection.stubs(:upload)
|
215
|
+
.raises(Kitchen::Transport::TransportFailed.new("dang"))
|
224
216
|
|
225
217
|
proc { cmd }.must_raise Kitchen::ActionFailed
|
226
218
|
end
|
227
219
|
|
228
220
|
it "raises an ActionFailed on execute when TransportFailed is raised" do
|
229
|
-
connection.stubs(:execute)
|
230
|
-
|
221
|
+
connection.stubs(:execute)
|
222
|
+
.raises(Kitchen::Transport::TransportFailed.new("dang"))
|
231
223
|
|
232
224
|
proc { cmd }.must_raise Kitchen::ActionFailed
|
233
225
|
end
|
234
226
|
end
|
235
227
|
|
236
228
|
[:init_command, :install_command, :prepare_command, :run_command].each do |cmd|
|
237
|
-
|
238
229
|
it "has a #{cmd} method" do
|
239
230
|
provisioner.public_send(cmd).must_be_nil
|
240
231
|
end
|
241
232
|
end
|
242
233
|
|
243
234
|
describe "sandbox" do
|
244
|
-
|
245
235
|
after do
|
246
236
|
begin
|
247
237
|
provisioner.cleanup_sandbox
|
@@ -257,8 +247,8 @@ describe Kitchen::Provisioner::Base do
|
|
257
247
|
provisioner.create_sandbox
|
258
248
|
|
259
249
|
File.directory?(provisioner.sandbox_path).must_equal true
|
260
|
-
format("%o", File.stat(provisioner.sandbox_path).mode)[1, 4]
|
261
|
-
must_equal "0755"
|
250
|
+
format("%o", File.stat(provisioner.sandbox_path).mode)[1, 4]
|
251
|
+
.must_equal "0755"
|
262
252
|
end
|
263
253
|
|
264
254
|
it "#create_sandbox logs an info message" do
|
@@ -270,8 +260,8 @@ describe Kitchen::Provisioner::Base do
|
|
270
260
|
it "#create_sandbox logs a debug message" do
|
271
261
|
provisioner.create_sandbox
|
272
262
|
|
273
|
-
logged_output.string
|
274
|
-
|
263
|
+
logged_output.string
|
264
|
+
.must_match debug_line_starting_with("Creating local sandbox in ")
|
275
265
|
end
|
276
266
|
|
277
267
|
it "#cleanup_sandbox deletes the sandbox directory" do
|
@@ -285,23 +275,21 @@ describe Kitchen::Provisioner::Base do
|
|
285
275
|
provisioner.create_sandbox
|
286
276
|
provisioner.cleanup_sandbox
|
287
277
|
|
288
|
-
logged_output.string
|
289
|
-
|
278
|
+
logged_output.string
|
279
|
+
.must_match debug_line_starting_with("Cleaning up local sandbox in ")
|
290
280
|
end
|
291
281
|
|
292
282
|
def info_line(msg)
|
293
|
-
|
283
|
+
/^I, .* : #{Regexp.escape(msg)}$/
|
294
284
|
end
|
295
285
|
|
296
286
|
def debug_line_starting_with(msg)
|
297
|
-
|
287
|
+
/^D, .* : #{Regexp.escape(msg)}/
|
298
288
|
end
|
299
289
|
end
|
300
290
|
|
301
291
|
describe "#sudo" do
|
302
|
-
|
303
292
|
describe "with :sudo set" do
|
304
|
-
|
305
293
|
before { config[:sudo] = true }
|
306
294
|
|
307
295
|
it "prepends sudo command" do
|
@@ -316,7 +304,6 @@ describe Kitchen::Provisioner::Base do
|
|
316
304
|
end
|
317
305
|
|
318
306
|
describe "with :sudo falsey" do
|
319
|
-
|
320
307
|
before { config[:sudo] = false }
|
321
308
|
|
322
309
|
it "does not include sudo command" do
|
@@ -332,9 +319,7 @@ describe Kitchen::Provisioner::Base do
|
|
332
319
|
end
|
333
320
|
|
334
321
|
describe "#sudo_command" do
|
335
|
-
|
336
322
|
describe "with :sudo set" do
|
337
|
-
|
338
323
|
before { config[:sudo] = true }
|
339
324
|
|
340
325
|
it "returns the default sudo_command" do
|
@@ -349,7 +334,6 @@ describe Kitchen::Provisioner::Base do
|
|
349
334
|
end
|
350
335
|
|
351
336
|
describe "with :sudo falsey" do
|
352
|
-
|
353
337
|
before { config[:sudo] = false }
|
354
338
|
|
355
339
|
it "returns empty string for default sudo_command" do
|
@@ -365,9 +349,7 @@ describe Kitchen::Provisioner::Base do
|
|
365
349
|
end
|
366
350
|
|
367
351
|
describe "#prefix_command" do
|
368
|
-
|
369
352
|
describe "with :command_prefix set" do
|
370
|
-
|
371
353
|
before { config[:command_prefix] = "my_prefix" }
|
372
354
|
|
373
355
|
it "prepends the command with the prefix" do
|
@@ -376,7 +358,6 @@ describe Kitchen::Provisioner::Base do
|
|
376
358
|
end
|
377
359
|
|
378
360
|
describe "with :command_prefix unset" do
|
379
|
-
|
380
361
|
before { config[:command_prefix] = nil }
|
381
362
|
|
382
363
|
it "returns an unaltered command" do
|