test-kitchen 1.4.1 → 1.4.2

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
  SHA1:
3
- metadata.gz: ac352970d9bb62f576ca7a3c8a1390382fa2fb5d
4
- data.tar.gz: cd340da33b93b212a7c21de7ccaa212f05be52e8
3
+ metadata.gz: ed6240c00a8d6ca35986ab16735134c1fe4368b1
4
+ data.tar.gz: 3b4324d554794093cc15ebd2f82e9bca3c426074
5
5
  SHA512:
6
- metadata.gz: dd350ae343edb32bac0914df75405d166546274cc7056104859926641fa930c080084686847b5699d01a250e690c4d40aba8444033094aa7fe06f69ea7175daa
7
- data.tar.gz: c801ac18f1c2019301e6ab80f2b99a73e381064e8df489aa205bd68f3c94d40eb8bf3265f11fc5868eac720b047cdbfa345e8f4e6c2cf0720621c9ba8211ba99
6
+ metadata.gz: d1949f7688de24d288aa21d15f4d1bc80dc049937b60ab56e3ac445211e7c68c57fcb7c2b1f3fc93fa25e341f2dd9907494ecdcfcda4518dd2939cbed22fec3f
7
+ data.tar.gz: a8713a783d3ff9b2dff382e790a1496ec75b1f305bab75b02d0a5a36f505995c4b998f2a0a057d6d7443371757b50d69aa732b1d16a467211378500b021836d3
@@ -1,3 +1,19 @@
1
+ ## 1.4.2
2
+
3
+ ### Potentially breaking changes
4
+
5
+ ### Bug fixes
6
+
7
+ * PR [#801][]: Use compression `true` instead of `'zlib'` by default, supports net-ssh 2.10. Old values of `'zlib'` and `'none'` are cast to `'zlib[@openssh][].com'` and `false` respectively but are deprecated. In 2.0 this casting will be removed. ([@coderanger][])
8
+ * PR [#802][]: net-ssh 2.10 throws a different error than 2.9 when connection times out, so we need to retry that. We now retry both the 2.9 and 2.10 errors. ([@Annih][])
9
+ * Pinning to net-ssh < 2.10 because 2.10 no longer works with Ruby 1.9 and TK still does ([@tyler-ball][])
10
+
11
+ ### New features
12
+
13
+ ### Improvements
14
+
15
+ * PR [#689][]: Fixing tests to run on Windows and adding AppVeyor builds. ([@tyler-ball][] and [@smurawski][])
16
+
1
17
  ## 1.4.1 / 2015-06-18
2
18
 
3
19
  ### Potentially breaking changes
@@ -745,6 +761,7 @@ The initial release.
745
761
  [#674]: https://github.com/test-kitchen/test-kitchen/issues/674
746
762
  [#675]: https://github.com/test-kitchen/test-kitchen/issues/675
747
763
  [#688]: https://github.com/test-kitchen/test-kitchen/issues/688
764
+ [#689]: https://github.com/test-kitchen/test-kitchen/issues/689
748
765
  [#704]: https://github.com/test-kitchen/test-kitchen/issues/704
749
766
  [#711]: https://github.com/test-kitchen/test-kitchen/issues/711
750
767
  [#728]: https://github.com/test-kitchen/test-kitchen/issues/728
@@ -752,6 +769,9 @@ The initial release.
752
769
  [#734]: https://github.com/test-kitchen/test-kitchen/issues/734
753
770
  [#736]: https://github.com/test-kitchen/test-kitchen/issues/736
754
771
  [#737]: https://github.com/test-kitchen/test-kitchen/issues/737
772
+ [#801]: https://github.com/test-kitchen/test-kitchen/issues/801
773
+ [#802]: https://github.com/test-kitchen/test-kitchen/issues/802
774
+ [@Annih]: https://github.com/Annih
755
775
  [@ChrisLundquist]: https://github.com/ChrisLundquist
756
776
  [@MarkGibbons]: https://github.com/MarkGibbons
757
777
  [@adamhjk]: https://github.com/adamhjk
@@ -804,6 +824,7 @@ The initial release.
804
824
  [@mthssdrbrg]: https://github.com/mthssdrbrg
805
825
  [@mwrock]: https://github.com/mwrock
806
826
  [@oferrigni]: https://github.com/oferrigni
827
+ [@openssh]: https://github.com/openssh
807
828
  [@patcon]: https://github.com/patcon
808
829
  [@portertech]: https://github.com/portertech
809
830
  [@rarenerd]: https://github.com/rarenerd
@@ -821,6 +842,7 @@ The initial release.
821
842
  [@scotthain]: https://github.com/scotthain
822
843
  [@sethvargo]: https://github.com/sethvargo
823
844
  [@smith]: https://github.com/smith
845
+ [@smurawski]: https://github.com/smurawski
824
846
  [@someara]: https://github.com/someara
825
847
  [@srenatus]: https://github.com/srenatus
826
848
  [@stevendanna]: https://github.com/stevendanna
@@ -829,4 +851,4 @@ The initial release.
829
851
  [@tyler-ball]: https://github.com/tyler-ball
830
852
  [@whiteley]: https://github.com/whiteley
831
853
  [@zl4bv]: https://github.com/zl4bv
832
- [@zts]: https://github.com/zts
854
+ [@zts]: https://github.com/zts
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ end
12
12
  require "cucumber"
13
13
  require "cucumber/rake/task"
14
14
  Cucumber::Rake::Task.new(:features) do |t|
15
- t.cucumber_opts = ["features", "-x", "--format progress"]
15
+ t.cucumber_opts = ["features", "-x", "--format progress", "--no-color"]
16
16
  end
17
17
 
18
18
  desc "Run all test suites"
@@ -29,7 +29,7 @@ end
29
29
  require "finstyle"
30
30
  require "rubocop/rake_task"
31
31
  RuboCop::RakeTask.new(:style) do |task|
32
- task.options << "--display-cop-names"
32
+ task.options += ["--display-cop-names", "--no-color"]
33
33
  end
34
34
 
35
35
  if RUBY_ENGINE != "jruby"
@@ -0,0 +1,34 @@
1
+ version: "master-{build}"
2
+
3
+ os: Windows Server 2012
4
+ platform:
5
+ - x64
6
+
7
+ environment:
8
+ matrix:
9
+ - ruby_version: "200"
10
+
11
+ clone_folder: c:\projects\test_kitchen
12
+ clone_depth: 1
13
+ skip_tags: true
14
+
15
+ branches:
16
+ only:
17
+ - master
18
+
19
+ install:
20
+ - winrm quickconfig -q
21
+ - SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
22
+ - echo %PATH%
23
+ - ruby --version
24
+ - gem --version
25
+ - gem install bundler --quiet --no-ri --no-rdoc
26
+ - bundler --version
27
+
28
+ build_script:
29
+ - bundle install || bundle install || bundle install
30
+
31
+ test_script:
32
+ - SET SPEC_OPTS=--format progress
33
+ - bundle exec rake unit
34
+ - bundle exec rake quality
@@ -10,7 +10,11 @@ require "kitchen/cli"
10
10
  class ArubaHelper
11
11
 
12
12
  def initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel)
13
- @argv, @stdin, @stdout, @stderr, @kernel = argv, stdin, stdout, stderr, kernel
13
+ @argv = argv
14
+ @stdin = stdin
15
+ @stdout = stdout
16
+ @stderr = stderr
17
+ @kernel = kernel
14
18
  end
15
19
 
16
20
  def execute!
@@ -27,12 +31,12 @@ Before do
27
31
  @aruba_timeout_seconds = 15
28
32
  @cleanup_dirs = []
29
33
 
30
- Aruba::InProcess.main_class = ArubaHelper
31
- Aruba.process = Aruba::InProcess
34
+ Aruba::Processes::InProcess.main_class = ArubaHelper
35
+ Aruba.process = Aruba::Processes::InProcess
32
36
  end
33
37
 
34
38
  Before("@spawn") do
35
- Aruba.process = Aruba::SpawnProcess
39
+ Aruba.process = Aruba::Processes::SpawnProcess
36
40
  end
37
41
 
38
42
  After do |s|
@@ -89,10 +89,10 @@ module Kitchen
89
89
  log_location = log_location.to_s
90
90
 
91
91
  Logger.new(
92
- :stdout => $stdout,
93
- :logdev => log_location,
94
- :level => Util.to_logger_level(level),
95
- :log_overwrite => log_overwrite
92
+ :stdout => $stdout,
93
+ :logdev => log_location,
94
+ :level => Util.to_logger_level(level),
95
+ :log_overwrite => log_overwrite
96
96
  )
97
97
  end
98
98
 
@@ -31,7 +31,7 @@ module Kitchen
31
31
  # @param io_in [#read] input stream
32
32
  # @param io_out [#write] output stream
33
33
  def self.strict_encode(io_in, io_out)
34
- buffer = "" # rubocop:disable Lint/UselessAssignment
34
+ buffer = ""
35
35
  while io_in.read(3 * 1000, buffer)
36
36
  io_out.write([buffer].pack("m0"))
37
37
  end
@@ -45,7 +45,7 @@ module Kitchen
45
45
  # @param io_in [#read] input stream
46
46
  # @param io_out [#write] output stream
47
47
  def self.strict_decode(io_in, io_out)
48
- buffer = "" # rubocop:disable Lint/UselessAssignment
48
+ buffer = ""
49
49
  while io_in.read(3 * 1000, buffer)
50
50
  io_out.write(buffer.unpack("m0").first)
51
51
  end
@@ -108,11 +108,9 @@ module Kitchen
108
108
  #
109
109
  # @param version [Integer,String] a version number
110
110
  #
111
- # rubocop:disable Style/TrivialAccessors
112
111
  def self.kitchen_driver_api_version(version)
113
112
  @api_version = version
114
113
  end
115
- # rubocop:enable Style/TrivialAccessors
116
114
 
117
115
  private
118
116
 
@@ -129,7 +129,7 @@ module Kitchen
129
129
  # found
130
130
  # @api private
131
131
  def author
132
- git_user_name = %x{git config user.name}.chomp
132
+ git_user_name = `git config user.name`.chomp
133
133
  git_user_name.empty? ? "TODO: Write your name" : git_user_name
134
134
  end
135
135
 
@@ -137,7 +137,7 @@ module Kitchen
137
137
  # if found
138
138
  # @api private
139
139
  def email
140
- git_user_email = %x{git config user.email}.chomp
140
+ git_user_email = `git config user.email`.chomp
141
141
  git_user_email.empty? ? "TODO: Write your email" : git_user_email
142
142
  end
143
143
 
@@ -176,11 +176,9 @@ module Kitchen
176
176
  #
177
177
  # @param version [Integer,String] a version number
178
178
  #
179
- # rubocop:disable Style/TrivialAccessors
180
179
  def self.kitchen_provisioner_api_version(version)
181
180
  @api_version = version
182
181
  end
183
- # rubocop:enable Style/TrivialAccessors
184
182
 
185
183
  private
186
184
 
@@ -19,6 +19,7 @@
19
19
  require "fileutils"
20
20
  require "pathname"
21
21
  require "json"
22
+ require "cgi"
22
23
 
23
24
  require "kitchen/provisioner/chef/berkshelf"
24
25
  require "kitchen/provisioner/chef/common_sandbox"
@@ -112,7 +113,7 @@ module Kitchen
112
113
 
113
114
  url = "#{base}#{metadata_project_from_options}"
114
115
  url << "?p=windows&m=x86_64&pv=2008r2" # same pacakge for all versions
115
- url << "&v=#{version.to_s.downcase}"
116
+ url << "&v=#{CGI.escape(version.to_s.downcase)}"
116
117
  url
117
118
  end
118
119
 
@@ -257,7 +258,7 @@ module Kitchen
257
258
  # @return [String] shell variable lines
258
259
  # @api private
259
260
  def install_command_vars_for_bourne(version)
260
- install_flags = %w[latest true].include?(version) ? "" : "-v #{version}"
261
+ install_flags = %w[latest true].include?(version) ? "" : "-v #{CGI.escape(version)}"
261
262
  if config[:chef_omnibus_install_options]
262
263
  install_flags << " " << config[:chef_omnibus_install_options]
263
264
  end
@@ -99,10 +99,10 @@ module Kitchen
99
99
  # these flags are modern/chef-client local most only and will not work
100
100
  # on older versions of chef-client
101
101
  if config[:chef_zero_host]
102
- args << "--chef-zero-host #{config[:chef_zero_host]}"
102
+ args << "--chef-zero-host #{config[:chef_zero_host]}"
103
103
  end
104
104
  if config[:chef_zero_port]
105
- args << "--chef-zero-port #{config[:chef_zero_port]}"
105
+ args << "--chef-zero-port #{config[:chef_zero_port]}"
106
106
  end
107
107
  end
108
108
 
@@ -169,7 +169,13 @@ module Kitchen
169
169
  when nil, false, true, 11, "11", "latest"
170
170
  true
171
171
  else
172
- Gem::Version.new(version) >= Gem::Version.new("11.8.0") ? true : false
172
+ if Gem::Version.correct?(version)
173
+ Gem::Version.new(version) >= Gem::Version.new("11.8.0") ? true : false
174
+ else
175
+ # Build versions of chef, for example
176
+ # 12.5.0-current.0+20150721082808.git.14.c91b337-1
177
+ true
178
+ end
173
179
  end
174
180
  end
175
181
 
@@ -58,7 +58,7 @@ module Kitchen
58
58
  #
59
59
  # @api private
60
60
  def failure_if_set
61
- if config[:"fail"]
61
+ if config[:fail]
62
62
  debug("Failure for Provisioner #{name}.")
63
63
  raise ActionFailed, "Action #converge failed for #{instance.to_str}."
64
64
  elsif config[:random_failure] && randomly_fail?
@@ -161,11 +161,9 @@ module Kitchen
161
161
  #
162
162
  # @param version [Integer,String] a version number
163
163
  #
164
- # rubocop:disable Style/TrivialAccessors
165
164
  def self.kitchen_transport_api_version(version)
166
165
  @api_version = version
167
166
  end
168
- # rubocop:enable Style/TrivialAccessors
169
167
  end
170
168
  end
171
169
  end
@@ -52,16 +52,26 @@ module Kitchen
52
52
  default_config :ssh_key, nil
53
53
  expand_path_for :ssh_key
54
54
 
55
- default_config :compression, "zlib"
56
- required_config :compression do |attr, value, transport|
57
- if !%W[zlib none].include?(value)
58
- raise UserError, "#{transport} :#{attr} value may only " \
59
- "be set to `none' or `zlib'."
60
- end
61
- end
55
+ default_config :compression, true
56
+ required_config :compression
62
57
 
63
58
  default_config :compression_level do |transport|
64
- transport[:compression] == "none" ? 0 : 6
59
+ transport[:compression] == false ? 0 : 6
60
+ end
61
+
62
+ def finalize_config!(instance)
63
+ super
64
+
65
+ # zlib was never a valid value and breaks in net-ssh >= 2.10
66
+ # TODO: remove these backwards compatiable casts in 2.0
67
+ case config[:compression]
68
+ when "zlib"
69
+ config[:compression] = "zlib@openssh.com"
70
+ when "none"
71
+ config[:compression] = false
72
+ end
73
+
74
+ self
65
75
  end
66
76
 
67
77
  # (see Base#connection)
@@ -153,7 +163,7 @@ module Kitchen
153
163
  PING_COMMAND = "echo '[SSH] Established'".freeze
154
164
 
155
165
  RESCUE_EXCEPTIONS_ON_ESTABLISH = [
156
- Errno::EACCES, Errno::EADDRINUSE, Errno::ECONNREFUSED,
166
+ Errno::EACCES, Errno::EADDRINUSE, Errno::ECONNREFUSED, Errno::ETIMEDOUT,
157
167
  Errno::ECONNRESET, Errno::ENETUNREACH, Errno::EHOSTUNREACH,
158
168
  Net::SSH::Disconnect, Net::SSH::AuthenticationFailed, Timeout::Error
159
169
  ].freeze
@@ -181,11 +181,9 @@ module Kitchen
181
181
  #
182
182
  # @param version [Integer,String] a version number
183
183
  #
184
- # rubocop:disable Style/TrivialAccessors
185
184
  def self.kitchen_verifier_api_version(version)
186
185
  @api_version = version
187
186
  end
188
- # rubocop:enable Style/TrivialAccessors
189
187
 
190
188
  private
191
189
 
@@ -58,7 +58,7 @@ module Kitchen
58
58
  #
59
59
  # @api private
60
60
  def failure_if_set
61
- if config[:"fail"]
61
+ if config[:fail]
62
62
  debug("Failure for Verifier #{name}.")
63
63
  raise ActionFailed, "Action #verify failed for #{instance.to_str}."
64
64
  elsif config[:random_failure] && randomly_fail?
@@ -18,5 +18,5 @@
18
18
 
19
19
  module Kitchen
20
20
 
21
- VERSION = "1.4.1"
21
+ VERSION = "1.4.2"
22
22
  end
@@ -311,25 +311,27 @@ describe Kitchen::Configurable do
311
311
  end
312
312
 
313
313
  it "expands a default value" do
314
- subject[:success_path].must_equal "/tmp/yo/self/success"
314
+ subject[:success_path].must_equal os_safe_root_path("/tmp/yo/self/success")
315
315
  end
316
316
 
317
317
  it "uses provided config over default_config" do
318
318
  config[:success_path] = "mine"
319
319
 
320
- subject[:success_path].must_equal "/tmp/yo/self/mine"
320
+ subject[:success_path].must_equal os_safe_root_path("/tmp/yo/self/mine")
321
321
  end
322
322
 
323
323
  it "leaves a full path expanded" do
324
324
  config[:success_path] = "/the/other/one"
325
325
 
326
- subject[:success_path].must_equal "/the/other/one"
326
+ subject[:success_path].must_equal os_safe_root_path("/the/other/one")
327
327
  end
328
328
 
329
329
  it "expands all items if path is an array" do
330
- subject[:bunch_of_paths].must_equal %W[
330
+ paths = %W[
331
331
  /tmp/yo/self/a /tmp/yo/self/b /tmp/yo/self/c
332
332
  ]
333
+ os_safe_paths = paths.collect { |path| os_safe_root_path(path) }
334
+ subject[:bunch_of_paths].must_equal os_safe_paths
333
335
  end
334
336
 
335
337
  it "doesn't expand path with a falsy expand_path_for value" do
@@ -342,7 +344,7 @@ describe Kitchen::Configurable do
342
344
  config[:something_else] = "is_set"
343
345
  config[:complex_path] = "./complex"
344
346
 
345
- subject[:complex_path].must_equal "/tmp/yo/self/complex"
347
+ subject[:complex_path].must_equal os_safe_root_path("/tmp/yo/self/complex")
346
348
  end
347
349
 
348
350
  it "leaves a nil config value as nil" do
@@ -369,7 +371,7 @@ describe Kitchen::Configurable do
369
371
  end
370
372
 
371
373
  it "contains expand_path_for from superclass" do
372
- subject[:success_path].must_equal "/rooty/success"
374
+ subject[:success_path].must_equal os_safe_root_path("/rooty/success")
373
375
  end
374
376
 
375
377
  it "uses its own expand_path_for over inherited expand_path_for" do
@@ -20,7 +20,7 @@ require_relative "../spec_helper"
20
20
 
21
21
  require "kitchen/data_munger"
22
22
 
23
- module Kitchen
23
+ module Kitchen # rubocop:disable Metrics/ModuleLength
24
24
 
25
25
  describe DataMunger do
26
26
 
@@ -585,7 +585,7 @@ describe Kitchen::Loader::YAML do
585
585
 
586
586
  it "global config contains a filename" do
587
587
  loader.diagnose[:global_config][:filename].
588
- must_equal File.join(ENV["HOME"], ".kitchen/config.yml")
588
+ must_equal File.join(ENV["HOME"].gsub('\\', "/"), ".kitchen/config.yml")
589
589
  end
590
590
 
591
591
  it "global config contains raw data" do
@@ -144,6 +144,14 @@ describe Kitchen::Provisioner::ChefBase do
144
144
  must_equal "#{base_url}?p=windows&m=x86_64&pv=2008r2&v=11.6.0.rc.1"
145
145
  end
146
146
 
147
+ it "defaults to a nightly package from :require_chef_omnibus" do
148
+ config[:require_chef_omnibus] = "12.5.0-current.0+20150721082808.git.14.c91b337-1"
149
+
150
+ provisioner[:chef_metadata_url].
151
+ must_equal "#{base_url}?p=windows&m=x86_64&pv=2008r2&" \
152
+ "v=12.5.0-current.0%2B20150721082808.git.14.c91b337-1"
153
+ end
154
+
147
155
  it "defaults to a chefdk package from :chef_omnibus_install_options" do
148
156
  config[:require_chef_omnibus] = true
149
157
  config[:chef_omnibus_install_options] = "-P chefdk"
@@ -195,33 +203,38 @@ describe Kitchen::Provisioner::ChefBase do
195
203
  end
196
204
 
197
205
  it ":data_path uses calculate_path and is expanded" do
198
- provisioner[:data_path].must_equal "/rooty/<calculated>/data"
206
+ provisioner[:data_path].
207
+ must_equal os_safe_root_path("/rooty/<calculated>/data")
199
208
  end
200
209
 
201
210
  it ":data_bags_path uses calculate_path and is expanded" do
202
- provisioner[:data_bags_path].must_equal "/rooty/<calculated>/data_bags"
211
+ provisioner[:data_bags_path].
212
+ must_equal os_safe_root_path("/rooty/<calculated>/data_bags")
203
213
  end
204
214
 
205
215
  it ":environments_path uses calculate_path and is expanded" do
206
216
  provisioner[:environments_path].
207
- must_equal "/rooty/<calculated>/environments"
217
+ must_equal os_safe_root_path("/rooty/<calculated>/environments")
208
218
  end
209
219
 
210
220
  it ":nodes_path uses calculate_path and is expanded" do
211
- provisioner[:nodes_path].must_equal "/rooty/<calculated>/nodes"
221
+ provisioner[:nodes_path].
222
+ must_equal os_safe_root_path("/rooty/<calculated>/nodes")
212
223
  end
213
224
 
214
225
  it ":roles_path uses calculate_path and is expanded" do
215
- provisioner[:roles_path].must_equal "/rooty/<calculated>/roles"
226
+ provisioner[:roles_path].
227
+ must_equal os_safe_root_path("/rooty/<calculated>/roles")
216
228
  end
217
229
 
218
230
  it ":clients_path uses calculate_path and is expanded" do
219
- provisioner[:clients_path].must_equal "/rooty/<calculated>/clients"
231
+ provisioner[:clients_path].
232
+ must_equal os_safe_root_path("/rooty/<calculated>/clients")
220
233
  end
221
234
 
222
235
  it "...secret_key_path uses calculate_path and is expanded" do
223
236
  provisioner[:encrypted_data_bag_secret_key_path].
224
- must_equal "/rooty/<calculated>/encrypted_data_bag_secret_key"
237
+ must_equal os_safe_root_path("/rooty/<calculated>/encrypted_data_bag_secret_key")
225
238
  end
226
239
  end
227
240
 
@@ -315,6 +328,17 @@ describe Kitchen::Provisioner::ChefBase do
315
328
  cmd.must_match regexify(%{version="10.1.0.rc.1"})
316
329
  end
317
330
 
331
+ it "will install a nightly, if necessary" do
332
+ config[:require_chef_omnibus] = "12.5.0-current.0+20150721082808.git.14.c91b337-1"
333
+
334
+ cmd.must_match(
335
+ regexify(%{install_flags="-v 12.5.0-current.0%2B20150721082808.git.14.c91b337-1"}))
336
+ cmd.must_match(
337
+ regexify(%{pretty_version="12.5.0-current.0+20150721082808.git.14.c91b337-1"}))
338
+ cmd.must_match(
339
+ regexify(%{version="12.5.0-current.0+20150721082808.git.14.c91b337-1"}))
340
+ end
341
+
318
342
  it "will install the latest of chef, if necessary" do
319
343
  config[:require_chef_omnibus] = "latest"
320
344
 
@@ -810,7 +810,6 @@ describe Kitchen::Provisioner::ChefZero do
810
810
  config[:require_chef_omnibus] = "10.20"
811
811
  end
812
812
 
813
- # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
814
813
  def self.common_old_shell_specs
815
814
  it "does not set local mode flag" do
816
815
  cmd.wont_match regexify(" --local-mode", :partial_line)
@@ -66,7 +66,7 @@ describe Kitchen::Provisioner::Shell do
66
66
  before { platform.stubs(:shell_type).returns("bourne") }
67
67
 
68
68
  it ":script uses calculate_path and is expanded" do
69
- provisioner[:script].must_equal "/rooty/<calculated>/bootstrap.sh"
69
+ provisioner[:script].must_equal os_safe_root_path("/rooty/<calculated>/bootstrap.sh")
70
70
  end
71
71
  end
72
72
 
@@ -75,12 +75,12 @@ describe Kitchen::Provisioner::Shell do
75
75
  before { platform.stubs(:shell_type).returns("powershell") }
76
76
 
77
77
  it ":script uses calculate_path and is expanded" do
78
- provisioner[:script].must_equal "/rooty/<calculated>/bootstrap.ps1"
78
+ provisioner[:script].must_equal os_safe_root_path("/rooty/<calculated>/bootstrap.ps1")
79
79
  end
80
80
  end
81
81
 
82
82
  it ":data_path uses calculate_path and is expanded" do
83
- provisioner[:data_path].must_equal "/rooty/<calculated>/data"
83
+ provisioner[:data_path].must_equal os_safe_root_path("/rooty/<calculated>/data")
84
84
  end
85
85
  end
86
86
 
@@ -398,7 +398,10 @@ describe Kitchen::Provisioner::Shell do
398
398
  provisioner.create_sandbox
399
399
 
400
400
  sandbox_path("my_script").file?.must_equal true
401
- sandbox_path("my_script").executable?.must_equal true
401
+ unless running_tests_on_windows?
402
+ # Windows doesn't have the concept of executable
403
+ sandbox_path("my_script").executable?.must_equal true
404
+ end
402
405
  IO.read(sandbox_path("my_script")).must_equal "gonuts"
403
406
  end
404
407
 
@@ -442,7 +445,10 @@ describe Kitchen::Provisioner::Shell do
442
445
  provisioner.create_sandbox
443
446
 
444
447
  sandbox_path("bootstrap.sh").file?.must_equal true
445
- sandbox_path("bootstrap.sh").executable?.must_equal true
448
+ unless running_tests_on_windows?
449
+ # Windows doesn't have the concept of executable
450
+ sandbox_path("bootstrap.sh").executable?.must_equal true
451
+ end
446
452
  IO.read(sandbox_path("bootstrap.sh")).
447
453
  must_match(/NO BOOTSTRAP SCRIPT PRESENT/)
448
454
  end
@@ -470,7 +476,10 @@ describe Kitchen::Provisioner::Shell do
470
476
  provisioner.create_sandbox
471
477
 
472
478
  sandbox_path("bootstrap.ps1").file?.must_equal true
473
- sandbox_path("bootstrap.ps1").executable?.must_equal true
479
+ unless running_tests_on_windows?
480
+ # Windows doesn't have the concept of executable
481
+ sandbox_path("bootstrap.ps1").executable?.must_equal true
482
+ end
474
483
  IO.read(sandbox_path("bootstrap.ps1")).
475
484
  must_match(/Write-Host "NO BOOTSTRAP SCRIPT PRESENT`n"/)
476
485
  end
@@ -36,7 +36,7 @@ def with_sorted_dir_entries
36
36
  class << self
37
37
  alias_method :__entries__, :entries unless method_defined?(:__entries__)
38
38
 
39
- def entries(*args)
39
+ def entries(*args) # rubocop:disable Lint/NestedMethodDefinition
40
40
  send(:__entries__, *args).sort
41
41
  end
42
42
  end
@@ -95,7 +95,7 @@ module Net
95
95
  pty_data = ["xterm", 80, 24, 640, 480, "\0"]
96
96
 
97
97
  script.events << Class.new(Net::SSH::Test::LocalPacket) do
98
- def types
98
+ def types # rubocop:disable Lint/NestedMethodDefinition
99
99
  if @type == 98 && @data[1] == "pty-req"
100
100
  @types ||= [
101
101
  :long, :string, :bool, :string,
@@ -158,9 +158,9 @@ describe Kitchen::SSH do
158
158
  rescue # rubocop:disable Lint/HandleExceptions
159
159
  end
160
160
 
161
- logged_output.string.lines.select { |l|
161
+ logged_output.string.lines.count { |l|
162
162
  l =~ debug_line("[SSH] opening connection to me@foo:22<{:ssh_retries=>3}>")
163
- }.size.must_equal opts[:ssh_retries]
163
+ }.must_equal opts[:ssh_retries]
164
164
  end
165
165
 
166
166
  it "sleeps for 1 second between retries" do
@@ -179,9 +179,9 @@ describe Kitchen::SSH do
179
179
  rescue # rubocop:disable Lint/HandleExceptions
180
180
  end
181
181
 
182
- logged_output.string.lines.select { |l|
182
+ logged_output.string.lines.count { |l|
183
183
  l =~ info_line_with("[SSH] connection failed, retrying ")
184
- }.size.must_equal 2
184
+ }.must_equal 2
185
185
  end
186
186
 
187
187
  it "logs the last retry failures on warn" do
@@ -190,9 +190,9 @@ describe Kitchen::SSH do
190
190
  rescue # rubocop:disable Lint/HandleExceptions
191
191
  end
192
192
 
193
- logged_output.string.lines.select { |l|
193
+ logged_output.string.lines.count { |l|
194
194
  l =~ warn_line_with("[SSH] connection failed, terminating ")
195
- }.size.must_equal 1
195
+ }.must_equal 1
196
196
  end
197
197
  end
198
198
  end
@@ -320,8 +320,9 @@ describe Kitchen::SSH do
320
320
 
321
321
  before do
322
322
  expect_scp_session("-t /tmp/remote") do |channel|
323
+ file_mode = running_tests_on_windows? ? 0644 : 0755
323
324
  channel.gets_data("\0")
324
- channel.sends_data("C0755 1234 #{File.basename(src.path)}\n")
325
+ channel.sends_data("C#{padded_octal_string(file_mode)} 1234 #{File.basename(src.path)}\n")
325
326
  channel.gets_data("\0")
326
327
  channel.sends_data("a" * 1234)
327
328
  channel.sends_data("\0")
@@ -357,6 +358,12 @@ describe Kitchen::SSH do
357
358
 
358
359
  before do
359
360
  @dir = Dir.mktmpdir("local")
361
+
362
+ # Since File.chmod is a NOOP on Windows
363
+ @tmp_dir_mode = running_tests_on_windows? ? 0755 : 0700
364
+ @alpha_file_mode = running_tests_on_windows? ? 0644 : 0644
365
+ @beta_file_mode = running_tests_on_windows? ? 0444 : 0555
366
+
360
367
  FileUtils.chmod(0700, @dir)
361
368
  File.open("#{@dir}/alpha", "wb") { |f| f.write("alpha-contents\n") }
362
369
  FileUtils.chmod(0644, "#{@dir}/alpha")
@@ -369,16 +376,16 @@ describe Kitchen::SSH do
369
376
 
370
377
  expect_scp_session("-t -r /tmp/remote") do |channel|
371
378
  channel.gets_data("\0")
372
- channel.sends_data("D0700 0 #{File.basename(@dir)}\n")
379
+ channel.sends_data("D#{padded_octal_string(@tmp_dir_mode)} 0 #{File.basename(@dir)}\n")
373
380
  channel.gets_data("\0")
374
- channel.sends_data("C0644 15 alpha\n")
381
+ channel.sends_data("C#{padded_octal_string(@alpha_file_mode)} 15 alpha\n")
375
382
  channel.gets_data("\0")
376
383
  channel.sends_data("alpha-contents\n")
377
384
  channel.sends_data("\0")
378
385
  channel.gets_data("\0")
379
386
  channel.sends_data("D0755 0 subdir\n")
380
387
  channel.gets_data("\0")
381
- channel.sends_data("C0555 14 beta\n")
388
+ channel.sends_data("C#{padded_octal_string(@beta_file_mode)} 14 beta\n")
382
389
  channel.gets_data("\0")
383
390
  channel.sends_data("beta-contents\n")
384
391
  channel.sends_data("\0")
@@ -642,9 +649,9 @@ describe Kitchen::SSH do
642
649
  TCPSocket.stubs(:new).returns(not_ready, not_ready, ready)
643
650
  ssh.wait
644
651
 
645
- logged_output.string.lines.select { |l|
652
+ logged_output.string.lines.count { |l|
646
653
  l =~ info_line_with("Waiting for foo:22...")
647
- }.size.must_equal 2
654
+ }.must_equal 2
648
655
  end
649
656
  end
650
657
 
@@ -36,7 +36,7 @@ def with_sorted_dir_entries
36
36
  class << self
37
37
  alias_method :__entries__, :entries unless method_defined?(:__entries__)
38
38
 
39
- def entries(*args)
39
+ def entries(*args) # rubocop:disable Lint/NestedMethodDefinition
40
40
  send(:__entries__, *args).sort
41
41
  end
42
42
  end
@@ -95,7 +95,7 @@ module Net
95
95
  pty_data = ["xterm", 80, 24, 640, 480, "\0"]
96
96
 
97
97
  script.events << Class.new(Net::SSH::Test::LocalPacket) do
98
- def types
98
+ def types # rubocop:disable Lint/NestedMethodDefinition
99
99
  if @type == 98 && @data[1] == "pty-req"
100
100
  @types ||= [
101
101
  :long, :string, :bool, :string,
@@ -145,21 +145,20 @@ describe Kitchen::Transport::Ssh do
145
145
  transport[:username].must_equal "root"
146
146
  end
147
147
 
148
- it "sets :compression to zlib by default" do
149
- transport[:compression].must_equal "zlib"
148
+ it "sets :compression to true by default" do
149
+ transport[:compression].must_equal true
150
150
  end
151
151
 
152
- it "sets :compression to none if set to none" do
152
+ it "sets :compression to false if set to none" do
153
153
  config[:compression] = "none"
154
154
 
155
- transport[:compression].must_equal "none"
155
+ transport[:compression].must_equal false
156
156
  end
157
157
 
158
- it "raises a UserError if :compression is set to a bogus value" do
159
- config[:compression] = "boom"
158
+ it "sets :compression to zlib@openssh.com if set to zlib" do
159
+ config[:compression] = "zlib"
160
160
 
161
- err = proc { transport }.must_raise Kitchen::UserError
162
- err.message.must_match(%r{value may only be set to `none' or `zlib'})
161
+ transport[:compression].must_equal "zlib@openssh.com"
163
162
  end
164
163
 
165
164
  it "sets :compression_level to 6 by default" do
@@ -204,7 +203,7 @@ describe Kitchen::Transport::Ssh do
204
203
  config[:kitchen_root] = "/rooty"
205
204
  config[:ssh_key] = "my_key"
206
205
 
207
- transport[:ssh_key].must_equal "/rooty/my_key"
206
+ transport[:ssh_key].must_equal os_safe_root_path("/rooty/my_key")
208
207
  end
209
208
  end
210
209
 
@@ -309,7 +308,7 @@ describe Kitchen::Transport::Ssh do
309
308
  config[:compression] = "none"
310
309
 
311
310
  klass.expects(:new).with do |hash|
312
- hash[:compression] == "none"
311
+ hash[:compression] == false
313
312
  end
314
313
 
315
314
  make_connection
@@ -509,7 +508,7 @@ describe Kitchen::Transport::Ssh do
509
508
  config[:ssh_key] = "ssh_key_from_config"
510
509
 
511
510
  klass.expects(:new).with do |hash|
512
- hash[:keys] == ["/r/ssh_key_from_config"]
511
+ hash[:keys] == [os_safe_root_path("/r/ssh_key_from_config")]
513
512
  end
514
513
 
515
514
  make_connection
@@ -579,9 +578,9 @@ describe Kitchen::Transport::Ssh do
579
578
  make_connection(state)
580
579
  make_connection(state)
581
580
 
582
- logged_output.string.lines.select { |l|
581
+ logged_output.string.lines.count { |l|
583
582
  l =~ debug_line_with("[SSH] reusing existing connection ")
584
- }.size.must_equal 1
583
+ }.must_equal 1
585
584
  end
586
585
 
587
586
  it "returns a new connection when called again if state differs" do
@@ -602,9 +601,9 @@ describe Kitchen::Transport::Ssh do
602
601
  make_connection(state)
603
602
  make_connection(state.merge(:port => 9000))
604
603
 
605
- logged_output.string.lines.select { |l|
604
+ logged_output.string.lines.count { |l|
606
605
  l =~ debug_line_with("[SSH] shutting previous connection ")
607
- }.size.must_equal 1
606
+ }.must_equal 1
608
607
  end
609
608
  end
610
609
  # rubocop:enable Metrics/MethodLength, Metrics/AbcSize
@@ -667,7 +666,7 @@ describe Kitchen::Transport::Ssh::Connection do
667
666
  describe "establishing a connection" do
668
667
 
669
668
  [
670
- Errno::EACCES, Errno::EADDRINUSE, Errno::ECONNREFUSED,
669
+ Errno::EACCES, Errno::EADDRINUSE, Errno::ECONNREFUSED, Errno::ETIMEDOUT,
671
670
  Errno::ECONNRESET, Errno::ENETUNREACH, Errno::EHOSTUNREACH,
672
671
  Net::SSH::Disconnect, Net::SSH::AuthenticationFailed, Timeout::Error
673
672
  ].each do |klass|
@@ -694,9 +693,9 @@ describe Kitchen::Transport::Ssh::Connection do
694
693
  # the raise is not what is being tested here, rather its side-effect
695
694
  end
696
695
 
697
- logged_output.string.lines.select { |l|
696
+ logged_output.string.lines.count { |l|
698
697
  l =~ debug_line("[SSH] opening connection to me@foo<{:port=>22}>")
699
- }.size.must_equal 3
698
+ }.must_equal 3
700
699
  end
701
700
 
702
701
  it "sleeps for :connection_retry_sleep seconds between retries" do
@@ -717,10 +716,10 @@ describe Kitchen::Transport::Ssh::Connection do
717
716
  # the raise is not what is being tested here, rather its side-effect
718
717
  end
719
718
 
720
- logged_output.string.lines.select { |l|
719
+ logged_output.string.lines.count { |l|
721
720
  l =~ info_line_with(
722
721
  "[SSH] connection failed, retrying in 7 seconds")
723
- }.size.must_equal 2
722
+ }.must_equal 2
724
723
  end
725
724
 
726
725
  it "logs the last retry failures on warn" do
@@ -730,9 +729,9 @@ describe Kitchen::Transport::Ssh::Connection do
730
729
  # the raise is not what is being tested here, rather its side-effect
731
730
  end
732
731
 
733
- logged_output.string.lines.select { |l|
732
+ logged_output.string.lines.count { |l|
734
733
  l =~ warn_line_with("[SSH] connection failed, terminating ")
735
- }.size.must_equal 1
734
+ }.must_equal 1
736
735
  end
737
736
  end
738
737
  end
@@ -1018,8 +1017,9 @@ describe Kitchen::Transport::Ssh::Connection do
1018
1017
 
1019
1018
  before do
1020
1019
  expect_scp_session("-t /tmp/remote") do |channel|
1020
+ file_mode = running_tests_on_windows? ? 0644 : 0755
1021
1021
  channel.gets_data("\0")
1022
- channel.sends_data("C0755 1234 #{File.basename(src.path)}\n")
1022
+ channel.sends_data("C#{padded_octal_string(file_mode)} 1234 #{File.basename(src.path)}\n")
1023
1023
  channel.gets_data("\0")
1024
1024
  channel.sends_data("a" * 1234)
1025
1025
  channel.sends_data("\0")
@@ -1054,6 +1054,12 @@ describe Kitchen::Transport::Ssh::Connection do
1054
1054
  describe "for a path" do
1055
1055
  before do
1056
1056
  @dir = Dir.mktmpdir("local")
1057
+
1058
+ # Since File.chmod is a NOOP on Windows
1059
+ @tmp_dir_mode = running_tests_on_windows? ? 0755 : 0700
1060
+ @alpha_file_mode = running_tests_on_windows? ? 0644 : 0644
1061
+ @beta_file_mode = running_tests_on_windows? ? 0444 : 0555
1062
+
1057
1063
  FileUtils.chmod(0700, @dir)
1058
1064
  File.open("#{@dir}/alpha", "wb") { |f| f.write("alpha-contents\n") }
1059
1065
  FileUtils.chmod(0644, "#{@dir}/alpha")
@@ -1066,16 +1072,16 @@ describe Kitchen::Transport::Ssh::Connection do
1066
1072
 
1067
1073
  expect_scp_session("-t -r /tmp/remote") do |channel|
1068
1074
  channel.gets_data("\0")
1069
- channel.sends_data("D0700 0 #{File.basename(@dir)}\n")
1075
+ channel.sends_data("D#{padded_octal_string(@tmp_dir_mode)} 0 #{File.basename(@dir)}\n")
1070
1076
  channel.gets_data("\0")
1071
- channel.sends_data("C0644 15 alpha\n")
1077
+ channel.sends_data("C#{padded_octal_string(@alpha_file_mode)} 15 alpha\n")
1072
1078
  channel.gets_data("\0")
1073
1079
  channel.sends_data("alpha-contents\n")
1074
1080
  channel.sends_data("\0")
1075
1081
  channel.gets_data("\0")
1076
1082
  channel.sends_data("D0755 0 subdir\n")
1077
1083
  channel.gets_data("\0")
1078
- channel.sends_data("C0555 14 beta\n")
1084
+ channel.sends_data("C#{padded_octal_string(@beta_file_mode)} 14 beta\n")
1079
1085
  channel.gets_data("\0")
1080
1086
  channel.sends_data("beta-contents\n")
1081
1087
  channel.sends_data("\0")
@@ -1161,16 +1167,16 @@ describe Kitchen::Transport::Ssh::Connection do
1161
1167
  # the raise is not what is being tested here, rather its side-effect
1162
1168
  end
1163
1169
 
1164
- logged_output.string.lines.select { |l|
1170
+ logged_output.string.lines.count { |l|
1165
1171
  l =~ info_line_with(
1166
1172
  "Waiting for SSH service on foo:22, retrying in 3 seconds")
1167
- }.size.must_equal((300 / 3) - 1)
1168
- logged_output.string.lines.select { |l|
1173
+ }.must_equal((300 / 3) - 1)
1174
+ logged_output.string.lines.count { |l|
1169
1175
  l =~ debug_line_with("[SSH] connection failed ")
1170
- }.size.must_equal((300 / 3) - 1)
1171
- logged_output.string.lines.select { |l|
1176
+ }.must_equal((300 / 3) - 1)
1177
+ logged_output.string.lines.count { |l|
1172
1178
  l =~ warn_line_with("[SSH] connection failed, terminating ")
1173
- }.size.must_equal 1
1179
+ }.must_equal 1
1174
1180
  end
1175
1181
 
1176
1182
  it "sleeps for 3 seconds between retries" do
@@ -306,9 +306,9 @@ describe Kitchen::Transport::Winrm do
306
306
  make_connection(state)
307
307
  make_connection(state)
308
308
 
309
- logged_output.string.lines.select { |l|
309
+ logged_output.string.lines.count { |l|
310
310
  l =~ debug_line_with("[WinRM] reusing existing connection ")
311
- }.size.must_equal 1
311
+ }.must_equal 1
312
312
  end
313
313
 
314
314
  it "returns a new connection when called again if state differs" do
@@ -329,9 +329,9 @@ describe Kitchen::Transport::Winrm do
329
329
  make_connection(state)
330
330
  make_connection(state.merge(:port => 9000))
331
331
 
332
- logged_output.string.lines.select { |l|
332
+ logged_output.string.lines.count { |l|
333
333
  l =~ debug_line_with("[WinRM] shutting previous connection ")
334
- }.size.must_equal 1
334
+ }.must_equal 1
335
335
  end
336
336
  end
337
337
  # rubocop:enable Metrics/MethodLength, Metrics/AbcSize
@@ -732,12 +732,12 @@ MSG
732
732
  # the raise is not what is being tested here, rather its side-effect
733
733
  end
734
734
 
735
- logged_output.string.lines.select { |l|
735
+ logged_output.string.lines.count { |l|
736
736
  l =~ debug_line("[WinRM] opening remote shell on #{info}")
737
- }.size.must_equal 3
738
- logged_output.string.lines.select { |l|
737
+ }.must_equal 3
738
+ logged_output.string.lines.count { |l|
739
739
  l =~ debug_line("[WinRM] remote shell shell-123 is open on #{info}")
740
- }.size.must_equal 0
740
+ }.must_equal 0
741
741
  end
742
742
 
743
743
  it "sleeps for :connection_retry_sleep seconds between retries" do
@@ -758,10 +758,10 @@ MSG
758
758
  # the raise is not what is being tested here, rather its side-effect
759
759
  end
760
760
 
761
- logged_output.string.lines.select { |l|
761
+ logged_output.string.lines.count { |l|
762
762
  l =~ info_line_with(
763
763
  "[WinRM] connection failed, retrying in 7 seconds")
764
- }.size.must_equal 2
764
+ }.must_equal 2
765
765
  end
766
766
 
767
767
  it "logs the last retry failures on warn" do
@@ -771,9 +771,9 @@ MSG
771
771
  # the raise is not what is being tested here, rather its side-effect
772
772
  end
773
773
 
774
- logged_output.string.lines.select { |l|
774
+ logged_output.string.lines.count { |l|
775
775
  l =~ warn_line_with("[WinRM] connection failed, terminating ")
776
- }.size.must_equal 1
776
+ }.must_equal 1
777
777
  end
778
778
  end
779
779
  end
@@ -968,7 +968,6 @@ MSG
968
968
  transporter.stubs(:upload)
969
969
  end
970
970
 
971
- # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
972
971
  def self.common_specs_for_upload
973
972
  it "builds a Winrm::FileTransporter" do
974
973
  WinRM::Transport::FileTransporter.unstub(:new)
@@ -990,7 +989,6 @@ MSG
990
989
  upload
991
990
  end
992
991
  end
993
- # rubocop:enable Metrics/MethodLength, Metrics/AbcSize
994
992
 
995
993
  describe "for a file" do
996
994
 
@@ -1035,16 +1033,16 @@ MSG
1035
1033
  # the raise is not what is being tested here, rather its side-effect
1036
1034
  end
1037
1035
 
1038
- logged_output.string.lines.select { |l|
1036
+ logged_output.string.lines.count { |l|
1039
1037
  l =~ info_line_with(
1040
1038
  "Waiting for WinRM service on http://foo:5985/wsman, retrying in 3 seconds")
1041
- }.size.must_equal((300 / 3) - 1)
1042
- logged_output.string.lines.select { |l|
1039
+ }.must_equal((300 / 3) - 1)
1040
+ logged_output.string.lines.count { |l|
1043
1041
  l =~ debug_line_with("[WinRM] connection failed ")
1044
- }.size.must_equal((300 / 3) - 1)
1045
- logged_output.string.lines.select { |l|
1042
+ }.must_equal((300 / 3) - 1)
1043
+ logged_output.string.lines.count { |l|
1046
1044
  l =~ warn_line_with("[WinRM] connection failed, terminating ")
1047
- }.size.must_equal 1
1045
+ }.must_equal 1
1048
1046
  end
1049
1047
 
1050
1048
  it "sleeps for 3 seconds between retries" do
@@ -47,7 +47,7 @@ describe Kitchen::Verifier::Busser do
47
47
  {
48
48
  "mondospec/charlie" => {
49
49
  :content => "charlie",
50
- :perms => "0764"
50
+ :perms => (running_tests_on_windows? ? "0644" : "0764")
51
51
  },
52
52
  "minispec/beta" => {
53
53
  :content => "beta",
@@ -55,7 +55,7 @@ describe Kitchen::Verifier::Busser do
55
55
  },
56
56
  "abba/alpha" => {
57
57
  :content => "alpha",
58
- :perms => "0440"
58
+ :perms => (running_tests_on_windows? ? "0444" : "0440")
59
59
  }
60
60
  }
61
61
  end
@@ -68,7 +68,7 @@ describe Kitchen::Verifier::Busser do
68
68
  },
69
69
  "abba/common" => {
70
70
  :content => "yeppers",
71
- :perms => "0664"
71
+ :perms => (running_tests_on_windows? ? "0644" : "0664")
72
72
  }
73
73
  }
74
74
  end
@@ -135,7 +135,6 @@ describe Kitchen::Verifier::Busser do
135
135
  end
136
136
  end
137
137
 
138
- # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
139
138
  def self.common_bourne_variable_specs
140
139
  it "uses bourne shell" do
141
140
  cmd.must_match(/\Ash -c '$/)
@@ -162,9 +161,7 @@ describe Kitchen::Verifier::Busser do
162
161
  cmd.must_match regexify(%{GEM_CACHE="/r/gems/cache"; export GEM_CACHE})
163
162
  end
164
163
  end
165
- # rubocop:enable Metrics/MethodLength, Metrics/AbcSize
166
164
 
167
- # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
168
165
  def self.common_powershell_variable_specs
169
166
  it "sets the BUSSER_ROOT environment variable" do
170
167
  cmd.must_match regexify(%{$env:BUSSER_ROOT = "\\r"})
@@ -182,7 +179,6 @@ describe Kitchen::Verifier::Busser do
182
179
  cmd.must_match regexify(%{$env:GEM_CACHE = "\\r\\gems\\cache"})
183
180
  end
184
181
  end
185
- # rubocop:enable Metrics/MethodLength, Metrics/AbcSize
186
182
 
187
183
  describe "#install_command" do
188
184
 
@@ -43,7 +43,20 @@ require "tempfile"
43
43
  # Nasty hack to redefine IO.read in terms of File#read for fakefs
44
44
  class IO
45
45
  def self.read(*args)
46
- File.open(args[0], "rb") { |f| f.read(args[1]) }
46
+ length = args[1]
47
+ offset = args[2]
48
+ opt = args[3]
49
+ if length.is_a? Hash
50
+ opt = length
51
+ length = nil
52
+ elsif offset.is_a? Hash
53
+ opt = offset
54
+ end
55
+ if opt && opt.key?(:mode)
56
+ File.open(args[0], opt) { |f| f.read(length) }
57
+ else
58
+ File.open(args[0], "rb", opt) { |f| f.read(length) }
59
+ end
47
60
  end
48
61
  end
49
62
 
@@ -54,3 +67,19 @@ def with_fake_fs
54
67
  FakeFS.deactivate!
55
68
  FakeFS::FileSystem.clear
56
69
  end
70
+
71
+ def running_tests_on_windows?
72
+ ENV["OS"] == "Windows_NT"
73
+ end
74
+
75
+ def os_safe_root_path(root_path)
76
+ if running_tests_on_windows?
77
+ "#{File.join(ENV["SystemDrive"], root_path)}"
78
+ else
79
+ root_path
80
+ end
81
+ end
82
+
83
+ def padded_octal_string(integer)
84
+ integer.to_s(8).rjust(4, "0")
85
+ end
@@ -2,9 +2,11 @@ Function Check-UpdateChef($root, $version) {
2
2
  if (-Not (Test-Path $root)) { return $true }
3
3
  elseif ("$version" -eq "true") { return $false }
4
4
  elseif ("$version" -eq "latest") { return $true }
5
-
6
- Try { $chef_version = (& $root\bin\chef-solo.bat -v).split(" ", 2)[1] }
7
- Catch { $chef_version = "" }
5
+ Try { $chef_version = Get-Content $root\version-manifest.txt | select-object -1}
6
+ Catch {
7
+ Try { $chef_version = (& $root\bin\chef-solo.bat -v).split(" ", 2)[1] }
8
+ Catch { $chef_version = "" }
9
+ }
8
10
 
9
11
  if ($chef_version.StartsWith($version)) { return $false }
10
12
  else { return $true }
@@ -172,13 +172,22 @@ should_update_chef() {
172
172
  return 0;
173
173
  fi
174
174
 
175
- chef_version="`${1}/bin/chef-solo -v | cut -d \" \" -f 2`";
175
+ if test -f "${1}/version-manifest.txt"; then
176
+ chef_version="`head -n 1 ${1}/version-manifest.txt | cut -d \" \" -f 2`";
177
+ else
178
+ chef_version="`${1}/bin/chef-solo -v | cut -d \" \" -f 2`";
179
+ fi
176
180
 
177
181
  echo "$chef_version" | grep "^${2}" 2>&1 >/dev/null;
178
182
  if test $? -eq 0; then
179
183
  return 1;
180
184
  else
181
- return 0;
185
+ echo "${2}" | grep "^$chef_version" 2>&1 >/dev/null;
186
+ if test $? -eq 0; then
187
+ return 1;
188
+ else
189
+ return 0;
190
+ fi
182
191
  fi
183
192
  }
184
193
 
@@ -25,7 +25,7 @@ Gem::Specification.new do |gem|
25
25
 
26
26
  gem.add_dependency "mixlib-shellout", ">= 1.2", "< 3.0"
27
27
  gem.add_dependency "net-scp", "~> 1.1"
28
- gem.add_dependency "net-ssh", "~> 2.7"
28
+ gem.add_dependency "net-ssh", "~> 2.7", "< 2.10"
29
29
  gem.add_dependency "safe_yaml", "~> 1.0"
30
30
  gem.add_dependency "thor", "~> 0.18"
31
31
 
@@ -35,7 +35,7 @@ Gem::Specification.new do |gem|
35
35
  gem.add_development_dependency "bundler", "~> 1.3"
36
36
  gem.add_development_dependency "rake"
37
37
 
38
- gem.add_development_dependency "aruba", "~> 0.5"
38
+ gem.add_development_dependency "aruba", "~> 0.7.0"
39
39
  gem.add_development_dependency "fakefs", "~> 0.4"
40
40
  gem.add_development_dependency "minitest", "~> 5.3"
41
41
  gem.add_development_dependency "mocha", "~> 1.1"
@@ -48,6 +48,6 @@ Gem::Specification.new do |gem|
48
48
  # style and complexity libraries are tightly version pinned as newer releases
49
49
  # may introduce new and undesireable style choices which would be immediately
50
50
  # enforced in CI
51
- gem.add_development_dependency "finstyle", "1.4.0"
51
+ gem.add_development_dependency "finstyle", "1.5.0"
52
52
  gem.add_development_dependency "cane", "2.6.2"
53
53
  end
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.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fletcher Nichol
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-18 00:00:00.000000000 Z
11
+ date: 2015-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout
@@ -51,6 +51,9 @@ dependencies:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
53
  version: '2.7'
54
+ - - "<"
55
+ - !ruby/object:Gem::Version
56
+ version: '2.10'
54
57
  type: :runtime
55
58
  prerelease: false
56
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,6 +61,9 @@ dependencies:
58
61
  - - "~>"
59
62
  - !ruby/object:Gem::Version
60
63
  version: '2.7'
64
+ - - "<"
65
+ - !ruby/object:Gem::Version
66
+ version: '2.10'
61
67
  - !ruby/object:Gem::Dependency
62
68
  name: safe_yaml
63
69
  requirement: !ruby/object:Gem::Requirement
@@ -148,14 +154,14 @@ dependencies:
148
154
  requirements:
149
155
  - - "~>"
150
156
  - !ruby/object:Gem::Version
151
- version: '0.5'
157
+ version: 0.7.0
152
158
  type: :development
153
159
  prerelease: false
154
160
  version_requirements: !ruby/object:Gem::Requirement
155
161
  requirements:
156
162
  - - "~>"
157
163
  - !ruby/object:Gem::Version
158
- version: '0.5'
164
+ version: 0.7.0
159
165
  - !ruby/object:Gem::Dependency
160
166
  name: fakefs
161
167
  requirement: !ruby/object:Gem::Requirement
@@ -260,14 +266,14 @@ dependencies:
260
266
  requirements:
261
267
  - - '='
262
268
  - !ruby/object:Gem::Version
263
- version: 1.4.0
269
+ version: 1.5.0
264
270
  type: :development
265
271
  prerelease: false
266
272
  version_requirements: !ruby/object:Gem::Requirement
267
273
  requirements:
268
274
  - - '='
269
275
  - !ruby/object:Gem::Version
270
- version: 1.4.0
276
+ version: 1.5.0
271
277
  - !ruby/object:Gem::Dependency
272
278
  name: cane
273
279
  requirement: !ruby/object:Gem::Requirement
@@ -302,6 +308,7 @@ files:
302
308
  - LICENSE
303
309
  - README.md
304
310
  - Rakefile
311
+ - appveyor.yml
305
312
  - bin/kitchen
306
313
  - features/kitchen_action_commands.feature
307
314
  - features/kitchen_command.feature