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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cf4b7df39c3ddbc02aabf0e3456a08f1ea38f48b516499f60460e5a412f0bda
4
- data.tar.gz: d5e26f7ca219d4a029066ebb83903ef57da5c40941645dd7261fed39ff395fa2
3
+ metadata.gz: ff85b0760e18dd6dc096340fe2f0e25e2afb81a3effe86abffb3bcb693c69691
4
+ data.tar.gz: 5726b42fa3dd0be71cdaf302a9fbb22eb411d81a2d1ec0112e31efc33b90b32a
5
5
  SHA512:
6
- metadata.gz: 2f411954ed9d5731087a7d9266cf2f4b840509c9044732febd6728bf47d8f0d8c8c14a5fc6db64c9d567a8a5a647211869a9401e5a76b1431cfabd0a404dfdd5
7
- data.tar.gz: 6b4e13ba9d11104ddff4c39ad749f773afcd4dfa7d25056a00fd29dd9a7944e1a1926dc4346920afaaf3a150bd96610bf78516dbbc7aaaafe976cb42194c573f
6
+ metadata.gz: 1b69d8edbe1552f5aa6a1148140073eb05fd263ddb39ef8ef388f36cd57063693c4ab12e9f71ef9dfebd40fcee2a69078beb670300ef9294c65c3303e59b85cc
7
+ data.tar.gz: 585a3924350b34e45a573bb8c7d11d606bc47f3b4f9a5fcf0e974443686c22d540ce9b06f450890affbb680e91e27f93abecd3cbee52558e63db970ebe3d644b
data/.gitignore CHANGED
@@ -25,5 +25,7 @@ tmp
25
25
  .kitchen/
26
26
  .kitchen.yml
27
27
  .kitchen.local.yml
28
+ kitchen.yml
29
+ kitchen.local.yml
28
30
  Berksfile.lock
29
31
  *.swp
@@ -13,9 +13,9 @@ verifier:
13
13
  name: inspec
14
14
 
15
15
  platforms:
16
- - name: ubuntu-16.04
16
+ - name: ubuntu-18.04
17
17
  driver:
18
- image: dokken/ubuntu-16.04
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
@@ -5,8 +5,9 @@ services: docker
5
5
  language: ruby
6
6
 
7
7
  rvm:
8
- - 2.3.6
9
- - 2.4.3
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.0
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
@@ -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
 
@@ -8,7 +8,7 @@ environment:
8
8
  machine_user: test_user
9
9
  machine_pass: Pass@word1
10
10
  machine_port: 5985
11
- KITCHEN_YAML: .kitchen.ci.yml
11
+ KITCHEN_YAML: .kitchen.appveyor.yml
12
12
  SSL_CERT_FILE: c:\projects\test_kitchen\certs.pem
13
13
 
14
14
  matrix:
@@ -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
- # Should support other ports than 22 for ssh gateways
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, options).ssh(hostname, username, options)
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]
@@ -17,5 +17,5 @@
17
17
  # limitations under the License.
18
18
 
19
19
  module Kitchen
20
- VERSION = "1.21.2".freeze
20
+ VERSION = "1.22.0".freeze
21
21
  end
@@ -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 omnibus packages" do
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 omnibus packages" do
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 omnibus packages" do
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 omnibus packages" do
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 omnibus packages" do
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 omnibus packages" do
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 Omnibus package $msi"
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 Omnibus ($pretty_version)`n"
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 Omnibus installation detected ($pretty_version)`n"
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 Omnibus (${pretty_version})";
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 Omnibus installation detected (${pretty_version})";
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.21.2
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-05-07 00:00:00.000000000 Z
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.ci.yml"
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.6
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