test-kitchen 1.21.2 → 1.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/{.kitchen.ci.yml → .kitchen.appveyor.yml} +0 -0
- data/.kitchen.dokken.yml +2 -2
- data/.travis.yml +5 -4
- data/CHANGELOG.md +8 -3
- data/appveyor.yml +1 -1
- data/lib/kitchen/provisioner/shell.rb +16 -2
- data/lib/kitchen/transport/ssh.rb +11 -4
- data/lib/kitchen/version.rb +1 -1
- data/spec/kitchen/provisioner/chef_solo_spec.rb +2 -2
- data/spec/kitchen/provisioner/chef_zero_spec.rb +4 -4
- data/spec/kitchen/provisioner/shell_spec.rb +63 -4
- data/spec/kitchen/transport/ssh_spec.rb +12 -0
- data/support/chef_base_install_command.ps1 +3 -3
- data/support/chef_base_install_command.sh +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff85b0760e18dd6dc096340fe2f0e25e2afb81a3effe86abffb3bcb693c69691
|
4
|
+
data.tar.gz: 5726b42fa3dd0be71cdaf302a9fbb22eb411d81a2d1ec0112e31efc33b90b32a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b69d8edbe1552f5aa6a1148140073eb05fd263ddb39ef8ef388f36cd57063693c4ab12e9f71ef9dfebd40fcee2a69078beb670300ef9294c65c3303e59b85cc
|
7
|
+
data.tar.gz: 585a3924350b34e45a573bb8c7d11d606bc47f3b4f9a5fcf0e974443686c22d540ce9b06f450890affbb680e91e27f93abecd3cbee52558e63db970ebe3d644b
|
data/.gitignore
CHANGED
File without changes
|
data/.kitchen.dokken.yml
CHANGED
@@ -13,9 +13,9 @@ verifier:
|
|
13
13
|
name: inspec
|
14
14
|
|
15
15
|
platforms:
|
16
|
-
- name: ubuntu-
|
16
|
+
- name: ubuntu-18.04
|
17
17
|
driver:
|
18
|
-
image: dokken/ubuntu-
|
18
|
+
image: dokken/ubuntu-18.04
|
19
19
|
pid_one_command: /bin/systemd
|
20
20
|
intermediate_instructions:
|
21
21
|
- RUN /usr/bin/apt-get update
|
data/.travis.yml
CHANGED
@@ -5,8 +5,9 @@ services: docker
|
|
5
5
|
language: ruby
|
6
6
|
|
7
7
|
rvm:
|
8
|
-
- 2.3.
|
9
|
-
- 2.4.
|
8
|
+
- 2.3.7
|
9
|
+
- 2.4.4
|
10
|
+
- 2.5.1
|
10
11
|
- ruby-head
|
11
12
|
|
12
13
|
|
@@ -26,11 +27,11 @@ branches:
|
|
26
27
|
|
27
28
|
matrix:
|
28
29
|
include:
|
29
|
-
- rvm: 2.5.
|
30
|
+
- rvm: 2.5.1
|
30
31
|
before_install:
|
31
32
|
# https://github.com/travis-ci/travis-ci/issues/8978
|
32
33
|
- gem update --system
|
33
|
-
- rvm: 2.4
|
34
|
+
- rvm: 2.4.4
|
34
35
|
# To run the proxy tests we need additional gems than what Test Kitchen normally uses
|
35
36
|
# for testing
|
36
37
|
gemfile: Gemfile.proxy_tests
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
# Change Log
|
2
|
+
|
3
|
+
## [v1.22.0](https://github.com/test-kitchen/test-kitchen/tree/v1.22.0) (2018-06-28)
|
4
|
+
[Full Changelog](https://github.com/test-kitchen/test-kitchen/compare/v1.21.2...v1.22.0)
|
5
|
+
|
6
|
+
- Add the ssh_gateway_port config in ssh transport [#1421](https://github.com/test-kitchen/test-kitchen/pull/1421) ([sjeandeaux](https://github.com/sjeandeaux))
|
7
|
+
- Shell Provisioner: make script executable [#1381](https://github.com/test-kitchen/test-kitchen/pull/1381) ([thewyzard44](https://github.com/thewyzard44))
|
8
|
+
- Stop calling the Chef packages omnibus packages [#1425](https://github.com/test-kitchen/test-kitchen/pull/1425) ([tas50](https://github.com/tas50))
|
9
|
+
|
2
10
|
## [v1.21.2](https://github.com/test-kitchen/test-kitchen/tree/v1.21.2) (2018-05-07)
|
3
11
|
[Full Changelog](https://github.com/test-kitchen/test-kitchen/compare/v1.21.1...v1.21.2)
|
4
12
|
|
5
|
-
**Merged pull requests:**
|
6
|
-
|
7
13
|
- Removing thor upper bound in step with berks [\#1410](https://github.com/test-kitchen/test-kitchen/pull/1410) ([cheeseplus](https://github.com/cheeseplus)
|
8
14
|
)
|
9
15
|
|
@@ -11,7 +17,6 @@
|
|
11
17
|
## [v1.21.1](https://github.com/test-kitchen/test-kitchen/tree/v1.21.1) (2018-04-18)
|
12
18
|
[Full Changelog](https://github.com/test-kitchen/test-kitchen/compare/v1.21.0...v1.21.1)
|
13
19
|
|
14
|
-
**Merged pull requests:**
|
15
20
|
|
16
21
|
- Revert: honor root\_path for location of chef installer script [\#1369]
|
17
22
|
|
data/appveyor.yml
CHANGED
@@ -77,6 +77,22 @@ module Kitchen
|
|
77
77
|
prefix_command(wrap_shell_code(code))
|
78
78
|
end
|
79
79
|
|
80
|
+
# (see Base#prepare_command)
|
81
|
+
def prepare_command
|
82
|
+
# On a windows host, the supplied script does not get marked as executable
|
83
|
+
# due to windows not having the concept of an executable flag
|
84
|
+
#
|
85
|
+
# When the guest instance is *nix, `chmod +x` the script in the guest, prior to executing
|
86
|
+
return unless unix_os? && config[:script] && !config[:command]
|
87
|
+
|
88
|
+
debug "Marking script as executable"
|
89
|
+
script = remote_path_join(
|
90
|
+
config[:root_path],
|
91
|
+
File.basename(config[:script])
|
92
|
+
)
|
93
|
+
prefix_command(wrap_shell_code(sudo("chmod +x #{script}")))
|
94
|
+
end
|
95
|
+
|
80
96
|
# (see Base#run_command)
|
81
97
|
def run_command
|
82
98
|
return prefix_command(wrap_shell_code(config[:command])) if config[:command]
|
@@ -126,8 +142,6 @@ module Kitchen
|
|
126
142
|
if config[:script]
|
127
143
|
debug("Using script from #{config[:script]}")
|
128
144
|
FileUtils.cp_r(config[:script], sandbox_path)
|
129
|
-
FileUtils.chmod(0755,
|
130
|
-
File.join(sandbox_path, File.basename(config[:script])))
|
131
145
|
else
|
132
146
|
info("No provisioner script file specified, skipping")
|
133
147
|
end
|
@@ -54,6 +54,7 @@ module Kitchen
|
|
54
54
|
default_config :max_wait_until_ready, 600
|
55
55
|
|
56
56
|
default_config :ssh_gateway, nil
|
57
|
+
default_config :ssh_gateway_port, 22
|
57
58
|
default_config :ssh_gateway_username, nil
|
58
59
|
|
59
60
|
default_config :ssh_http_proxy, nil
|
@@ -157,8 +158,7 @@ module Kitchen
|
|
157
158
|
end
|
158
159
|
if ssh_gateway
|
159
160
|
gateway_command = "ssh -q #{ssh_gateway_username}@#{ssh_gateway} nc #{hostname} #{port}"
|
160
|
-
|
161
|
-
args += %W{ -o ProxyCommand=#{gateway_command} -p 22 }
|
161
|
+
args += %W{ -o ProxyCommand=#{gateway_command} -p #{ssh_gateway_port} }
|
162
162
|
end
|
163
163
|
Array(options[:keys]).each { |ssh_key| args += %W{ -i #{ssh_key} } }
|
164
164
|
args += %W{ -p #{port} }
|
@@ -277,6 +277,10 @@ module Kitchen
|
|
277
277
|
# @api private
|
278
278
|
attr_reader :ssh_gateway_username
|
279
279
|
|
280
|
+
# @return [Integer] The port to use when using an ssh gateway
|
281
|
+
# @api private
|
282
|
+
attr_reader :ssh_gateway_port
|
283
|
+
|
280
284
|
# @return [String] The kitchen ssh proxy to use when connecting to the
|
281
285
|
# remote SSH host via http proxy
|
282
286
|
# @api private
|
@@ -310,8 +314,9 @@ module Kitchen
|
|
310
314
|
# @api private
|
311
315
|
def establish_connection_via_gateway(opts)
|
312
316
|
retry_connection(opts) do
|
317
|
+
gateway_options = options.merge(:port => ssh_gateway_port)
|
313
318
|
Net::SSH::Gateway.new(ssh_gateway,
|
314
|
-
ssh_gateway_username,
|
319
|
+
ssh_gateway_username, gateway_options).ssh(hostname, username, options)
|
315
320
|
end
|
316
321
|
end
|
317
322
|
|
@@ -345,7 +350,7 @@ module Kitchen
|
|
345
350
|
# @api private
|
346
351
|
def retry_connection(opts)
|
347
352
|
log_msg = "[SSH] opening connection to #{self}"
|
348
|
-
log_msg += " via #{ssh_gateway_username}@#{ssh_gateway}" if ssh_gateway
|
353
|
+
log_msg += " via #{ssh_gateway_username}@#{ssh_gateway}:#{ssh_gateway_port}" if ssh_gateway
|
349
354
|
logger.debug(log_msg)
|
350
355
|
yield
|
351
356
|
rescue *RESCUE_EXCEPTIONS_ON_ESTABLISH => e
|
@@ -406,6 +411,7 @@ module Kitchen
|
|
406
411
|
@max_wait_until_ready = @options.delete(:max_wait_until_ready)
|
407
412
|
@ssh_gateway = @options.delete(:ssh_gateway)
|
408
413
|
@ssh_gateway_username = @options.delete(:ssh_gateway_username)
|
414
|
+
@ssh_gateway_port = @options.delete(:ssh_gateway_port)
|
409
415
|
@ssh_http_proxy = @options.delete(:ssh_http_proxy)
|
410
416
|
@ssh_http_proxy_user = @options.delete(:ssh_http_proxy_user)
|
411
417
|
@ssh_http_proxy_password = @options.delete(:ssh_http_proxy_password)
|
@@ -468,6 +474,7 @@ module Kitchen
|
|
468
474
|
max_wait_until_ready: data[:max_wait_until_ready],
|
469
475
|
ssh_gateway: data[:ssh_gateway],
|
470
476
|
ssh_gateway_username: data[:ssh_gateway_username],
|
477
|
+
ssh_gateway_port: data[:ssh_gateway_port],
|
471
478
|
}
|
472
479
|
|
473
480
|
if data[:ssh_key] && !data[:password]
|
data/lib/kitchen/version.rb
CHANGED
@@ -367,7 +367,7 @@ describe Kitchen::Provisioner::ChefSolo do
|
|
367
367
|
])
|
368
368
|
end
|
369
369
|
|
370
|
-
it "does no powershell PATH reloading for older chef
|
370
|
+
it "does no powershell PATH reloading for older chef packages" do
|
371
371
|
cmd.wont_match regexify(%{[System.Environment]::})
|
372
372
|
end
|
373
373
|
|
@@ -520,7 +520,7 @@ describe Kitchen::Provisioner::ChefSolo do
|
|
520
520
|
])
|
521
521
|
end
|
522
522
|
|
523
|
-
it "reloads PATH for older chef
|
523
|
+
it "reloads PATH for older chef packages" do
|
524
524
|
cmd.must_match regexify("$env:PATH = try {\n" \
|
525
525
|
"[System.Environment]::GetEnvironmentVariable('PATH','Machine')\n" \
|
526
526
|
"} catch { $env:PATH }")
|
@@ -754,7 +754,7 @@ describe Kitchen::Provisioner::ChefZero do
|
|
754
754
|
])
|
755
755
|
end
|
756
756
|
|
757
|
-
it "does no powershell PATH reloading for older chef
|
757
|
+
it "does no powershell PATH reloading for older chef packages" do
|
758
758
|
cmd.wont_match regexify(%{[System.Environment]::})
|
759
759
|
end
|
760
760
|
|
@@ -829,7 +829,7 @@ describe Kitchen::Provisioner::ChefZero do
|
|
829
829
|
])
|
830
830
|
end
|
831
831
|
|
832
|
-
it "reloads PATH for older chef
|
832
|
+
it "reloads PATH for older chef packages" do
|
833
833
|
cmd.must_match regexify("$env:PATH = try {\n" \
|
834
834
|
"[System.Environment]::GetEnvironmentVariable('PATH','Machine')\n" \
|
835
835
|
"} catch { $env:PATH }")
|
@@ -934,7 +934,7 @@ describe Kitchen::Provisioner::ChefZero do
|
|
934
934
|
%{GEM_CACHE="/r/chef-client-zero-gems/cache"; export GEM_CACHE})
|
935
935
|
end
|
936
936
|
|
937
|
-
it "does no powershell PATH reloading for older chef
|
937
|
+
it "does no powershell PATH reloading for older chef packages" do
|
938
938
|
cmd.wont_match regexify(%{[System.Environment]::})
|
939
939
|
end
|
940
940
|
end
|
@@ -988,7 +988,7 @@ describe Kitchen::Provisioner::ChefZero do
|
|
988
988
|
%{$env:GEM_CACHE = "\\r\\chef-client-zero-gems\\cache"})
|
989
989
|
end
|
990
990
|
|
991
|
-
it "reloads PATH for older chef
|
991
|
+
it "reloads PATH for older chef packages" do
|
992
992
|
cmd.must_match regexify("$env:PATH = try {\n" \
|
993
993
|
"[System.Environment]::GetEnvironmentVariable('PATH','Machine')\n" \
|
994
994
|
"} catch { $env:PATH }")
|
@@ -241,6 +241,69 @@ describe Kitchen::Provisioner::Shell do
|
|
241
241
|
end
|
242
242
|
end
|
243
243
|
|
244
|
+
describe "#prepare_command" do
|
245
|
+
let(:cmd) { provisioner.prepare_command }
|
246
|
+
|
247
|
+
describe "for bourne shells" do
|
248
|
+
before { platform.stubs(:shell_type).returns("bourne") }
|
249
|
+
|
250
|
+
it "uses bourne shell" do
|
251
|
+
cmd.must_match(/\Ash -c '$/)
|
252
|
+
cmd.must_match(/'\Z/)
|
253
|
+
end
|
254
|
+
|
255
|
+
it "ends with a single quote" do
|
256
|
+
cmd.must_match(/'\Z/)
|
257
|
+
end
|
258
|
+
|
259
|
+
it "uses sudo for script when configured" do
|
260
|
+
config[:root_path] = "/r"
|
261
|
+
config[:sudo] = true
|
262
|
+
|
263
|
+
cmd.must_match regexify("sudo -E chmod +x /r/bootstrap.sh", :partial_line)
|
264
|
+
end
|
265
|
+
|
266
|
+
it "does not use sudo for script when configured" do
|
267
|
+
config[:root_path] = "/r"
|
268
|
+
config[:sudo] = false
|
269
|
+
|
270
|
+
cmd.must_match regexify("chmod +x /r/bootstrap.sh", :partial_line)
|
271
|
+
cmd.wont_match regexify("sudo -E chmod +x /r/bootstrap.sh", :partial_line)
|
272
|
+
end
|
273
|
+
|
274
|
+
it "uses command_prefix for script when configured" do
|
275
|
+
config[:command_prefix] = "TEST=yes"
|
276
|
+
config[:root_path] = "/r"
|
277
|
+
config[:sudo] = false
|
278
|
+
|
279
|
+
cmd.must_match(/^TEST=yes/)
|
280
|
+
end
|
281
|
+
|
282
|
+
it "respects command" do
|
283
|
+
config[:command] = "dothingy.rb"
|
284
|
+
|
285
|
+
cmd.must_be_nil
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
describe "for powershell shells on windows os types" do
|
290
|
+
before do
|
291
|
+
platform.stubs(:shell_type).returns("powershell")
|
292
|
+
platform.stubs(:os_type).returns("windows")
|
293
|
+
end
|
294
|
+
|
295
|
+
it "does nothing when given a script" do
|
296
|
+
cmd.must_be_nil
|
297
|
+
end
|
298
|
+
|
299
|
+
it "respects command" do
|
300
|
+
config[:command] = "dothingy.rb"
|
301
|
+
|
302
|
+
cmd.must_be_nil
|
303
|
+
end
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
244
307
|
describe "#run_command" do
|
245
308
|
let(:cmd) { provisioner.run_command }
|
246
309
|
|
@@ -457,10 +520,6 @@ describe Kitchen::Provisioner::Shell do
|
|
457
520
|
provisioner.create_sandbox
|
458
521
|
|
459
522
|
sandbox_path("my_script").file?.must_equal true
|
460
|
-
unless running_tests_on_windows?
|
461
|
-
# Windows doesn't have the concept of executable
|
462
|
-
sandbox_path("my_script").executable?.must_equal true
|
463
|
-
end
|
464
523
|
IO.read(sandbox_path("my_script")).must_equal "gonuts"
|
465
524
|
end
|
466
525
|
|
@@ -136,6 +136,18 @@ describe Kitchen::Transport::Ssh do
|
|
136
136
|
it "sets :ssh_http_proxy_password to nil by default" do
|
137
137
|
transport[:ssh_http_proxy_password].must_be_nil
|
138
138
|
end
|
139
|
+
|
140
|
+
it "sets :ssh_gateway to nil by default" do
|
141
|
+
transport[:ssh_gateway].must_be_nil
|
142
|
+
end
|
143
|
+
|
144
|
+
it "sets :ssh_gateway_username to nil by default" do
|
145
|
+
transport[:ssh_gateway_username].must_be_nil
|
146
|
+
end
|
147
|
+
|
148
|
+
it "sets :ssh_gateway_port to 22 by default" do
|
149
|
+
transport[:ssh_gateway_port].must_equal 22
|
150
|
+
end
|
139
151
|
end
|
140
152
|
|
141
153
|
describe "#connection" do
|
@@ -44,7 +44,7 @@ Function Download-Chef($md_url, $dst) {
|
|
44
44
|
}
|
45
45
|
|
46
46
|
Function Install-Chef($msi) {
|
47
|
-
Log "Installing Chef
|
47
|
+
Log "Installing Chef package $msi"
|
48
48
|
$p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i $msi" -Passthru -Wait
|
49
49
|
|
50
50
|
if ($p.ExitCode -ne 0) { throw "msiexec was not successful. Received exit code $($p.ExitCode)" }
|
@@ -73,11 +73,11 @@ Try {
|
|
73
73
|
$msi = Unresolve-Path $msi
|
74
74
|
|
75
75
|
if (Check-UpdateChef $chef_omnibus_root $version) {
|
76
|
-
Write-Host "-----> Installing Chef
|
76
|
+
Write-Host "-----> Installing Chef package ($pretty_version)`n"
|
77
77
|
Download-Chef "$chef_metadata_url" $msi
|
78
78
|
Install-Chef $msi
|
79
79
|
} else {
|
80
|
-
Write-Host "-----> Chef
|
80
|
+
Write-Host "-----> Chef package installation detected ($pretty_version)`n"
|
81
81
|
}
|
82
82
|
Catch {
|
83
83
|
Write-Error ($_ | ft -Property * | out-string) -ErrorAction Continue
|
@@ -206,7 +206,7 @@ unable_to_download() {
|
|
206
206
|
main() {
|
207
207
|
should_update_chef "$chef_omnibus_root" "$version"
|
208
208
|
if test $? -eq 0; then
|
209
|
-
echo "-----> Installing Chef
|
209
|
+
echo "-----> Installing Chef package (${pretty_version})";
|
210
210
|
|
211
211
|
# solaris 10 lacks recent enough credentials, so http url is used
|
212
212
|
platform="`/usr/bin/uname -s 2>/dev/null`";
|
@@ -218,7 +218,7 @@ main() {
|
|
218
218
|
do_download "$chef_omnibus_url" /tmp/install.sh;
|
219
219
|
$sudo_sh /tmp/install.sh $install_flags;
|
220
220
|
else
|
221
|
-
echo "-----> Chef
|
221
|
+
echo "-----> Chef package installation detected (${pretty_version})";
|
222
222
|
fi
|
223
223
|
}
|
224
224
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-kitchen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fletcher Nichol
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|
@@ -320,7 +320,7 @@ files:
|
|
320
320
|
- ".gitattributes"
|
321
321
|
- ".github/ISSUE_TEMPLATE.md"
|
322
322
|
- ".gitignore"
|
323
|
-
- ".kitchen.
|
323
|
+
- ".kitchen.appveyor.yml"
|
324
324
|
- ".kitchen.dokken.yml"
|
325
325
|
- ".kitchen.proxy.yml"
|
326
326
|
- ".rubocop.yml"
|
@@ -525,7 +525,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
525
525
|
version: '0'
|
526
526
|
requirements: []
|
527
527
|
rubyforge_project:
|
528
|
-
rubygems_version: 2.7.
|
528
|
+
rubygems_version: 2.7.5
|
529
529
|
signing_key:
|
530
530
|
specification_version: 4
|
531
531
|
summary: Test Kitchen is an integration tool for developing and testing infrastructure
|