test-kitchen 1.14.1 → 1.14.2
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/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
|
@@ -24,24 +24,23 @@ require "stringio"
|
|
|
24
24
|
require "kitchen/provisioner/dummy"
|
|
25
25
|
|
|
26
26
|
describe Kitchen::Provisioner::Dummy do
|
|
27
|
-
|
|
28
27
|
let(:logged_output) { StringIO.new }
|
|
29
28
|
let(:logger) { Logger.new(logged_output) }
|
|
30
|
-
let(:platform) { stub(:
|
|
31
|
-
let(:suite) { stub(:
|
|
29
|
+
let(:platform) { stub(os_type: nil, shell_type: nil) }
|
|
30
|
+
let(:suite) { stub(name: "fries") }
|
|
32
31
|
let(:state) { Hash.new }
|
|
33
32
|
|
|
34
33
|
let(:config) do
|
|
35
|
-
{ :
|
|
34
|
+
{ test_base_path: "/basist", kitchen_root: "/rooty" }
|
|
36
35
|
end
|
|
37
36
|
|
|
38
37
|
let(:instance) do
|
|
39
38
|
stub(
|
|
40
|
-
:
|
|
41
|
-
:
|
|
42
|
-
:
|
|
43
|
-
:
|
|
44
|
-
:
|
|
39
|
+
name: "coolbeans",
|
|
40
|
+
to_str: "instance",
|
|
41
|
+
logger: logger,
|
|
42
|
+
suite: suite,
|
|
43
|
+
platform: platform
|
|
45
44
|
)
|
|
46
45
|
end
|
|
47
46
|
|
|
@@ -58,7 +57,6 @@ describe Kitchen::Provisioner::Dummy do
|
|
|
58
57
|
end
|
|
59
58
|
|
|
60
59
|
describe "configuration" do
|
|
61
|
-
|
|
62
60
|
it "sets :sleep to 0 by default" do
|
|
63
61
|
provisioner[:sleep].must_equal 0
|
|
64
62
|
end
|
|
@@ -69,7 +67,6 @@ describe Kitchen::Provisioner::Dummy do
|
|
|
69
67
|
end
|
|
70
68
|
|
|
71
69
|
describe "#call" do
|
|
72
|
-
|
|
73
70
|
it "calls sleep if :sleep value is greater than 0" do
|
|
74
71
|
config[:sleep] = 12.5
|
|
75
72
|
provisioner.expects(:sleep).with(12.5).returns(true)
|
|
@@ -22,31 +22,30 @@ require "kitchen"
|
|
|
22
22
|
require "kitchen/provisioner/shell"
|
|
23
23
|
|
|
24
24
|
describe Kitchen::Provisioner::Shell do
|
|
25
|
-
|
|
26
25
|
let(:logged_output) { StringIO.new }
|
|
27
26
|
let(:logger) { Logger.new(logged_output) }
|
|
28
|
-
let(:platform) { stub(:
|
|
29
|
-
let(:suite) { stub(:
|
|
27
|
+
let(:platform) { stub(os_type: nil, shell_type: nil) }
|
|
28
|
+
let(:suite) { stub(name: "fries") }
|
|
30
29
|
|
|
31
30
|
let(:config) do
|
|
32
|
-
{ :
|
|
31
|
+
{ test_base_path: "/basist", kitchen_root: "/rooty" }
|
|
33
32
|
end
|
|
34
33
|
|
|
35
34
|
let(:instance) do
|
|
36
35
|
stub(
|
|
37
|
-
:
|
|
38
|
-
:
|
|
39
|
-
:
|
|
40
|
-
:
|
|
36
|
+
name: "coolbeans",
|
|
37
|
+
logger: logger,
|
|
38
|
+
suite: suite,
|
|
39
|
+
platform: platform
|
|
41
40
|
)
|
|
42
41
|
end
|
|
43
42
|
|
|
44
43
|
let(:provisioner) do
|
|
45
|
-
Class.new(Kitchen::Provisioner::Shell)
|
|
44
|
+
Class.new(Kitchen::Provisioner::Shell) do
|
|
46
45
|
def calculate_path(path, _opts = {})
|
|
47
46
|
"<calculated>/#{path}"
|
|
48
47
|
end
|
|
49
|
-
|
|
48
|
+
end.new(config).finalize_config!(instance)
|
|
50
49
|
end
|
|
51
50
|
|
|
52
51
|
it "provisioner api_version is 2" do
|
|
@@ -60,9 +59,7 @@ describe Kitchen::Provisioner::Shell do
|
|
|
60
59
|
end
|
|
61
60
|
|
|
62
61
|
describe "configuration" do
|
|
63
|
-
|
|
64
62
|
describe "for bourne shells" do
|
|
65
|
-
|
|
66
63
|
before { platform.stubs(:shell_type).returns("bourne") }
|
|
67
64
|
|
|
68
65
|
it ":script uses calculate_path and is expanded" do
|
|
@@ -71,7 +68,6 @@ describe Kitchen::Provisioner::Shell do
|
|
|
71
68
|
end
|
|
72
69
|
|
|
73
70
|
describe "for powershell shells" do
|
|
74
|
-
|
|
75
71
|
before { platform.stubs(:shell_type).returns("powershell") }
|
|
76
72
|
|
|
77
73
|
it ":script uses calculate_path and is expanded" do
|
|
@@ -85,11 +81,9 @@ describe Kitchen::Provisioner::Shell do
|
|
|
85
81
|
end
|
|
86
82
|
|
|
87
83
|
describe "#init_command" do
|
|
88
|
-
|
|
89
84
|
let(:cmd) { provisioner.init_command }
|
|
90
85
|
|
|
91
86
|
describe "for bourne shells" do
|
|
92
|
-
|
|
93
87
|
before { platform.stubs(:shell_type).returns("bourne") }
|
|
94
88
|
|
|
95
89
|
it "uses bourne shell" do
|
|
@@ -105,27 +99,27 @@ describe Kitchen::Provisioner::Shell do
|
|
|
105
99
|
config[:http_proxy] = "http://proxy"
|
|
106
100
|
|
|
107
101
|
cmd.lines.to_a[1..2].must_equal([
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
102
|
+
%{http_proxy="http://proxy"; export http_proxy\n},
|
|
103
|
+
%{HTTP_PROXY="http://proxy"; export HTTP_PROXY\n},
|
|
104
|
+
])
|
|
111
105
|
end
|
|
112
106
|
|
|
113
107
|
it "exports https_proxy & HTTPS_PROXY when :https_proxy is set" do
|
|
114
108
|
config[:https_proxy] = "https://proxy"
|
|
115
109
|
|
|
116
110
|
cmd.lines.to_a[1..2].must_equal([
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
%{https_proxy="https://proxy"; export https_proxy\n},
|
|
112
|
+
%{HTTPS_PROXY="https://proxy"; export HTTPS_PROXY\n},
|
|
113
|
+
])
|
|
120
114
|
end
|
|
121
115
|
|
|
122
116
|
it "exports ftp_proxy & FTP_PROXY when :ftp_proxy is set" do
|
|
123
117
|
config[:ftp_proxy] = "ftp://proxy"
|
|
124
118
|
|
|
125
119
|
cmd.lines.to_a[1..2].must_equal([
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
120
|
+
%{ftp_proxy="ftp://proxy"; export ftp_proxy\n},
|
|
121
|
+
%{FTP_PROXY="ftp://proxy"; export FTP_PROXY\n},
|
|
122
|
+
])
|
|
129
123
|
end
|
|
130
124
|
|
|
131
125
|
it "exports all proxy variables when all are set" do
|
|
@@ -134,13 +128,13 @@ describe Kitchen::Provisioner::Shell do
|
|
|
134
128
|
config[:ftp_proxy] = "ftp://proxy"
|
|
135
129
|
|
|
136
130
|
cmd.lines.to_a[1..6].must_equal([
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
131
|
+
%{http_proxy="http://proxy"; export http_proxy\n},
|
|
132
|
+
%{HTTP_PROXY="http://proxy"; export HTTP_PROXY\n},
|
|
133
|
+
%{https_proxy="https://proxy"; export https_proxy\n},
|
|
134
|
+
%{HTTPS_PROXY="https://proxy"; export HTTPS_PROXY\n},
|
|
135
|
+
%{ftp_proxy="ftp://proxy"; export ftp_proxy\n},
|
|
136
|
+
%{FTP_PROXY="ftp://proxy"; export FTP_PROXY\n},
|
|
137
|
+
])
|
|
144
138
|
end
|
|
145
139
|
|
|
146
140
|
it "uses sudo for rm when configured" do
|
|
@@ -152,10 +146,10 @@ describe Kitchen::Provisioner::Shell do
|
|
|
152
146
|
it "does not use sudo for rm when configured" do
|
|
153
147
|
config[:sudo] = false
|
|
154
148
|
|
|
155
|
-
provisioner.init_command
|
|
156
|
-
|
|
157
|
-
provisioner.init_command
|
|
158
|
-
|
|
149
|
+
provisioner.init_command
|
|
150
|
+
.must_match regexify("rm -rf ", :partial_line)
|
|
151
|
+
provisioner.init_command
|
|
152
|
+
.wont_match regexify("sudo -E rm -rf ", :partial_line)
|
|
159
153
|
end
|
|
160
154
|
|
|
161
155
|
it "removes the data directory" do
|
|
@@ -172,7 +166,6 @@ describe Kitchen::Provisioner::Shell do
|
|
|
172
166
|
end
|
|
173
167
|
|
|
174
168
|
describe "for powershell shells on windows os types" do
|
|
175
|
-
|
|
176
169
|
before do
|
|
177
170
|
platform.stubs(:os_type).returns("windows")
|
|
178
171
|
platform.stubs(:shell_type).returns("powershell")
|
|
@@ -182,27 +175,27 @@ describe Kitchen::Provisioner::Shell do
|
|
|
182
175
|
config[:http_proxy] = "http://proxy"
|
|
183
176
|
|
|
184
177
|
cmd.lines.to_a[0..1].must_equal([
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
178
|
+
%{$env:http_proxy = "http://proxy"\n},
|
|
179
|
+
%{$env:HTTP_PROXY = "http://proxy"\n},
|
|
180
|
+
])
|
|
188
181
|
end
|
|
189
182
|
|
|
190
183
|
it "exports https_proxy & HTTPS_PROXY when :https_proxy is set" do
|
|
191
184
|
config[:https_proxy] = "https://proxy"
|
|
192
185
|
|
|
193
186
|
cmd.lines.to_a[0..1].must_equal([
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
187
|
+
%{$env:https_proxy = "https://proxy"\n},
|
|
188
|
+
%{$env:HTTPS_PROXY = "https://proxy"\n},
|
|
189
|
+
])
|
|
197
190
|
end
|
|
198
191
|
|
|
199
192
|
it "exports ftp_proxy & FTP_PROXY when :ftp_proxy is set" do
|
|
200
193
|
config[:ftp_proxy] = "ftp://proxy"
|
|
201
194
|
|
|
202
195
|
cmd.lines.to_a[0..1].must_equal([
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
196
|
+
%{$env:ftp_proxy = "ftp://proxy"\n},
|
|
197
|
+
%{$env:FTP_PROXY = "ftp://proxy"\n},
|
|
198
|
+
])
|
|
206
199
|
end
|
|
207
200
|
|
|
208
201
|
it "exports all proxy variables when all are set" do
|
|
@@ -211,17 +204,17 @@ describe Kitchen::Provisioner::Shell do
|
|
|
211
204
|
config[:ftp_proxy] = "ftp://proxy"
|
|
212
205
|
|
|
213
206
|
cmd.lines.to_a[0..5].must_equal([
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
207
|
+
%{$env:http_proxy = "http://proxy"\n},
|
|
208
|
+
%{$env:HTTP_PROXY = "http://proxy"\n},
|
|
209
|
+
%{$env:https_proxy = "https://proxy"\n},
|
|
210
|
+
%{$env:HTTPS_PROXY = "https://proxy"\n},
|
|
211
|
+
%{$env:ftp_proxy = "ftp://proxy"\n},
|
|
212
|
+
%{$env:FTP_PROXY = "ftp://proxy"\n},
|
|
213
|
+
])
|
|
221
214
|
end
|
|
222
215
|
|
|
223
216
|
it "removes the data directory" do
|
|
224
|
-
config[:root_path] =
|
|
217
|
+
config[:root_path] = '\\route'
|
|
225
218
|
|
|
226
219
|
cmd.must_match regexify(Kitchen::Util.outdent!(<<-POWERSHELL).chomp)
|
|
227
220
|
if (Test-Path "\\route\\data") {
|
|
@@ -231,7 +224,7 @@ describe Kitchen::Provisioner::Shell do
|
|
|
231
224
|
end
|
|
232
225
|
|
|
233
226
|
it "creates the :root_path directory" do
|
|
234
|
-
config[:root_path] =
|
|
227
|
+
config[:root_path] = '\\route'
|
|
235
228
|
|
|
236
229
|
cmd.must_match regexify(Kitchen::Util.outdent!(<<-POWERSHELL).chomp)
|
|
237
230
|
if (-Not (Test-Path "\\route")) {
|
|
@@ -243,11 +236,9 @@ describe Kitchen::Provisioner::Shell do
|
|
|
243
236
|
end
|
|
244
237
|
|
|
245
238
|
describe "#run_command" do
|
|
246
|
-
|
|
247
239
|
let(:cmd) { provisioner.run_command }
|
|
248
240
|
|
|
249
241
|
describe "for bourne shells" do
|
|
250
|
-
|
|
251
242
|
before { platform.stubs(:shell_type).returns("bourne") }
|
|
252
243
|
|
|
253
244
|
it "uses bourne shell" do
|
|
@@ -263,27 +254,27 @@ describe Kitchen::Provisioner::Shell do
|
|
|
263
254
|
config[:http_proxy] = "http://proxy"
|
|
264
255
|
|
|
265
256
|
cmd.lines.to_a[1..2].must_equal([
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
257
|
+
%{http_proxy="http://proxy"; export http_proxy\n},
|
|
258
|
+
%{HTTP_PROXY="http://proxy"; export HTTP_PROXY\n},
|
|
259
|
+
])
|
|
269
260
|
end
|
|
270
261
|
|
|
271
262
|
it "exports https_proxy & HTTPS_PROXY when :https_proxy is set" do
|
|
272
263
|
config[:https_proxy] = "https://proxy"
|
|
273
264
|
|
|
274
265
|
cmd.lines.to_a[1..2].must_equal([
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
266
|
+
%{https_proxy="https://proxy"; export https_proxy\n},
|
|
267
|
+
%{HTTPS_PROXY="https://proxy"; export HTTPS_PROXY\n},
|
|
268
|
+
])
|
|
278
269
|
end
|
|
279
270
|
|
|
280
271
|
it "exports ftp_proxy & FTP_PROXY when :ftp_proxy is set" do
|
|
281
272
|
config[:ftp_proxy] = "ftp://proxy"
|
|
282
273
|
|
|
283
274
|
cmd.lines.to_a[1..2].must_equal([
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
275
|
+
%{ftp_proxy="ftp://proxy"; export ftp_proxy\n},
|
|
276
|
+
%{FTP_PROXY="ftp://proxy"; export FTP_PROXY\n},
|
|
277
|
+
])
|
|
287
278
|
end
|
|
288
279
|
|
|
289
280
|
it "exports all proxy variables when all are set" do
|
|
@@ -292,13 +283,13 @@ describe Kitchen::Provisioner::Shell do
|
|
|
292
283
|
config[:ftp_proxy] = "ftp://proxy"
|
|
293
284
|
|
|
294
285
|
cmd.lines.to_a[1..6].must_equal([
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
286
|
+
%{http_proxy="http://proxy"; export http_proxy\n},
|
|
287
|
+
%{HTTP_PROXY="http://proxy"; export HTTP_PROXY\n},
|
|
288
|
+
%{https_proxy="https://proxy"; export https_proxy\n},
|
|
289
|
+
%{HTTPS_PROXY="https://proxy"; export HTTPS_PROXY\n},
|
|
290
|
+
%{ftp_proxy="ftp://proxy"; export ftp_proxy\n},
|
|
291
|
+
%{FTP_PROXY="ftp://proxy"; export FTP_PROXY\n},
|
|
292
|
+
])
|
|
302
293
|
end
|
|
303
294
|
|
|
304
295
|
it "uses sudo for script when configured" do
|
|
@@ -326,7 +317,6 @@ describe Kitchen::Provisioner::Shell do
|
|
|
326
317
|
end
|
|
327
318
|
|
|
328
319
|
describe "for powershell shells on windows os types" do
|
|
329
|
-
|
|
330
320
|
before do
|
|
331
321
|
platform.stubs(:shell_type).returns("powershell")
|
|
332
322
|
platform.stubs(:os_type).returns("windows")
|
|
@@ -336,27 +326,27 @@ describe Kitchen::Provisioner::Shell do
|
|
|
336
326
|
config[:http_proxy] = "http://proxy"
|
|
337
327
|
|
|
338
328
|
cmd.lines.to_a[0..1].must_equal([
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
329
|
+
%{$env:http_proxy = "http://proxy"\n},
|
|
330
|
+
%{$env:HTTP_PROXY = "http://proxy"\n},
|
|
331
|
+
])
|
|
342
332
|
end
|
|
343
333
|
|
|
344
334
|
it "exports https_proxy & HTTPS_PROXY when :https_proxy is set" do
|
|
345
335
|
config[:https_proxy] = "https://proxy"
|
|
346
336
|
|
|
347
337
|
cmd.lines.to_a[0..1].must_equal([
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
338
|
+
%{$env:https_proxy = "https://proxy"\n},
|
|
339
|
+
%{$env:HTTPS_PROXY = "https://proxy"\n},
|
|
340
|
+
])
|
|
351
341
|
end
|
|
352
342
|
|
|
353
343
|
it "exports ftp_proxy & FTP_PROXY when :ftp_proxy is set" do
|
|
354
344
|
config[:ftp_proxy] = "ftp://proxy"
|
|
355
345
|
|
|
356
346
|
cmd.lines.to_a[0..1].must_equal([
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
347
|
+
%{$env:ftp_proxy = "ftp://proxy"\n},
|
|
348
|
+
%{$env:FTP_PROXY = "ftp://proxy"\n},
|
|
349
|
+
])
|
|
360
350
|
end
|
|
361
351
|
|
|
362
352
|
it "exports all proxy variables when all are set" do
|
|
@@ -365,17 +355,17 @@ describe Kitchen::Provisioner::Shell do
|
|
|
365
355
|
config[:ftp_proxy] = "ftp://proxy"
|
|
366
356
|
|
|
367
357
|
cmd.lines.to_a[0..5].must_equal([
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
358
|
+
%{$env:http_proxy = "http://proxy"\n},
|
|
359
|
+
%{$env:HTTP_PROXY = "http://proxy"\n},
|
|
360
|
+
%{$env:https_proxy = "https://proxy"\n},
|
|
361
|
+
%{$env:HTTPS_PROXY = "https://proxy"\n},
|
|
362
|
+
%{$env:ftp_proxy = "ftp://proxy"\n},
|
|
363
|
+
%{$env:FTP_PROXY = "ftp://proxy"\n},
|
|
364
|
+
])
|
|
375
365
|
end
|
|
376
366
|
|
|
377
367
|
it "invokes the bootstrap.ps1 script" do
|
|
378
|
-
config[:root_path] =
|
|
368
|
+
config[:root_path] = '\\r'
|
|
379
369
|
|
|
380
370
|
cmd.must_match regexify(%{& "\\r\\bootstrap.ps1"})
|
|
381
371
|
end
|
|
@@ -383,7 +373,6 @@ describe Kitchen::Provisioner::Shell do
|
|
|
383
373
|
end
|
|
384
374
|
|
|
385
375
|
describe "#create_sandbox" do
|
|
386
|
-
|
|
387
376
|
before do
|
|
388
377
|
@root = Dir.mktmpdir
|
|
389
378
|
config[:kitchen_root] = @root
|
|
@@ -402,7 +391,6 @@ describe Kitchen::Provisioner::Shell do
|
|
|
402
391
|
end
|
|
403
392
|
|
|
404
393
|
describe "data files" do
|
|
405
|
-
|
|
406
394
|
before do
|
|
407
395
|
create_files_under("#{config[:kitchen_root]}/my_data")
|
|
408
396
|
config[:data_path] = "#{config[:kitchen_root]}/my_data"
|
|
@@ -440,9 +428,7 @@ describe Kitchen::Provisioner::Shell do
|
|
|
440
428
|
end
|
|
441
429
|
|
|
442
430
|
describe "script file" do
|
|
443
|
-
|
|
444
431
|
describe "with a valid :script file" do
|
|
445
|
-
|
|
446
432
|
before do
|
|
447
433
|
File.open("#{config[:kitchen_root]}/my_script", "wb") do |file|
|
|
448
434
|
file.write("gonuts")
|
|
@@ -476,11 +462,9 @@ describe Kitchen::Provisioner::Shell do
|
|
|
476
462
|
end
|
|
477
463
|
|
|
478
464
|
describe "with no :script file" do
|
|
479
|
-
|
|
480
465
|
before { config[:script] = nil }
|
|
481
466
|
|
|
482
467
|
describe "for bourne shells" do
|
|
483
|
-
|
|
484
468
|
before { platform.stubs(:shell_type).returns("bourne") }
|
|
485
469
|
|
|
486
470
|
it "logs a message on info" do
|
|
@@ -505,13 +489,12 @@ describe Kitchen::Provisioner::Shell do
|
|
|
505
489
|
# Windows doesn't have the concept of executable
|
|
506
490
|
sandbox_path("bootstrap.sh").executable?.must_equal true
|
|
507
491
|
end
|
|
508
|
-
IO.read(sandbox_path("bootstrap.sh"))
|
|
509
|
-
must_match(/NO BOOTSTRAP SCRIPT PRESENT/)
|
|
492
|
+
IO.read(sandbox_path("bootstrap.sh"))
|
|
493
|
+
.must_match(/NO BOOTSTRAP SCRIPT PRESENT/)
|
|
510
494
|
end
|
|
511
495
|
end
|
|
512
496
|
|
|
513
497
|
describe "for powershell shells" do
|
|
514
|
-
|
|
515
498
|
before { platform.stubs(:shell_type).returns("powershell") }
|
|
516
499
|
|
|
517
500
|
it "logs a message on info" do
|
|
@@ -536,8 +519,8 @@ describe Kitchen::Provisioner::Shell do
|
|
|
536
519
|
# Windows doesn't have the concept of executable
|
|
537
520
|
sandbox_path("bootstrap.ps1").executable?.must_equal true
|
|
538
521
|
end
|
|
539
|
-
IO.read(sandbox_path("bootstrap.ps1"))
|
|
540
|
-
must_match(/Write-Host "NO BOOTSTRAP SCRIPT PRESENT`n"/)
|
|
522
|
+
IO.read(sandbox_path("bootstrap.ps1"))
|
|
523
|
+
.must_match(/Write-Host "NO BOOTSTRAP SCRIPT PRESENT`n"/)
|
|
541
524
|
end
|
|
542
525
|
end
|
|
543
526
|
end
|
|
@@ -558,11 +541,11 @@ describe Kitchen::Provisioner::Shell do
|
|
|
558
541
|
end
|
|
559
542
|
|
|
560
543
|
def info_line(msg)
|
|
561
|
-
|
|
544
|
+
/^I, .* : #{Regexp.escape(msg)}$/
|
|
562
545
|
end
|
|
563
546
|
|
|
564
547
|
def debug_line(msg)
|
|
565
|
-
|
|
548
|
+
/^D, .* : #{Regexp.escape(msg)}$/
|
|
566
549
|
end
|
|
567
550
|
end
|
|
568
551
|
|