test-kitchen 1.14.1 → 1.14.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/Berksfile +1 -1
  3. data/CHANGELOG.md +7 -0
  4. data/Gemfile +1 -1
  5. data/Guardfile +5 -5
  6. data/Rakefile +5 -5
  7. data/bin/kitchen +1 -1
  8. data/features/step_definitions/gem_steps.rb +6 -6
  9. data/features/support/env.rb +6 -7
  10. data/lib/kitchen.rb +5 -7
  11. data/lib/kitchen/base64_stream.rb +2 -8
  12. data/lib/kitchen/cli.rb +76 -80
  13. data/lib/kitchen/collection.rb +0 -2
  14. data/lib/kitchen/color.rb +7 -9
  15. data/lib/kitchen/command.rb +0 -4
  16. data/lib/kitchen/command/action.rb +0 -3
  17. data/lib/kitchen/command/console.rb +4 -7
  18. data/lib/kitchen/command/diagnose.rb +7 -14
  19. data/lib/kitchen/command/driver_discover.rb +1 -4
  20. data/lib/kitchen/command/exec.rb +0 -3
  21. data/lib/kitchen/command/list.rb +9 -12
  22. data/lib/kitchen/command/login.rb +0 -3
  23. data/lib/kitchen/command/package.rb +0 -3
  24. data/lib/kitchen/command/sink.rb +6 -9
  25. data/lib/kitchen/command/test.rb +1 -4
  26. data/lib/kitchen/config.rb +25 -27
  27. data/lib/kitchen/configurable.rb +26 -31
  28. data/lib/kitchen/data_munger.rb +34 -36
  29. data/lib/kitchen/diagnostic.rb +5 -7
  30. data/lib/kitchen/driver.rb +3 -5
  31. data/lib/kitchen/driver/base.rb +0 -3
  32. data/lib/kitchen/driver/dummy.rb +0 -3
  33. data/lib/kitchen/driver/proxy.rb +0 -3
  34. data/lib/kitchen/driver/ssh_base.rb +13 -16
  35. data/lib/kitchen/errors.rb +11 -16
  36. data/lib/kitchen/generator/driver_create.rb +18 -21
  37. data/lib/kitchen/generator/init.rb +21 -26
  38. data/lib/kitchen/instance.rb +19 -23
  39. data/lib/kitchen/lazy_hash.rb +1 -2
  40. data/lib/kitchen/loader/yaml.rb +22 -25
  41. data/lib/kitchen/logger.rb +9 -14
  42. data/lib/kitchen/logging.rb +0 -3
  43. data/lib/kitchen/login_command.rb +0 -2
  44. data/lib/kitchen/metadata_chopper.rb +0 -2
  45. data/lib/kitchen/platform.rb +1 -3
  46. data/lib/kitchen/provisioner.rb +3 -5
  47. data/lib/kitchen/provisioner/base.rb +2 -5
  48. data/lib/kitchen/provisioner/chef/berkshelf.rb +1 -5
  49. data/lib/kitchen/provisioner/chef/common_sandbox.rb +24 -29
  50. data/lib/kitchen/provisioner/chef/librarian.rb +2 -6
  51. data/lib/kitchen/provisioner/chef/policyfile.rb +4 -8
  52. data/lib/kitchen/provisioner/chef_apply.rb +14 -17
  53. data/lib/kitchen/provisioner/chef_base.rb +43 -46
  54. data/lib/kitchen/provisioner/chef_solo.rb +10 -13
  55. data/lib/kitchen/provisioner/chef_zero.rb +22 -29
  56. data/lib/kitchen/provisioner/dummy.rb +0 -3
  57. data/lib/kitchen/provisioner/shell.rb +6 -9
  58. data/lib/kitchen/rake_tasks.rb +4 -6
  59. data/lib/kitchen/shell_out.rb +3 -5
  60. data/lib/kitchen/ssh.rb +16 -22
  61. data/lib/kitchen/state_file.rb +3 -5
  62. data/lib/kitchen/suite.rb +0 -2
  63. data/lib/kitchen/thor_tasks.rb +2 -4
  64. data/lib/kitchen/transport.rb +3 -5
  65. data/lib/kitchen/transport/base.rb +1 -7
  66. data/lib/kitchen/transport/dummy.rb +0 -4
  67. data/lib/kitchen/transport/ssh.rb +41 -47
  68. data/lib/kitchen/transport/winrm.rb +41 -40
  69. data/lib/kitchen/util.rb +1 -3
  70. data/lib/kitchen/verifier.rb +3 -5
  71. data/lib/kitchen/verifier/base.rb +2 -5
  72. data/lib/kitchen/verifier/busser.rb +24 -24
  73. data/lib/kitchen/verifier/dummy.rb +0 -3
  74. data/lib/kitchen/verifier/shell.rb +1 -3
  75. data/lib/kitchen/version.rb +1 -1
  76. data/lib/vendor/hash_recursive_merge.rb +0 -2
  77. data/spec/kitchen/base64_stream_spec.rb +3 -6
  78. data/spec/kitchen/cli_spec.rb +0 -2
  79. data/spec/kitchen/collection_spec.rb +4 -8
  80. data/spec/kitchen/color_spec.rb +0 -3
  81. data/spec/kitchen/config_spec.rb +91 -106
  82. data/spec/kitchen/configurable_spec.rb +44 -76
  83. data/spec/kitchen/data_munger_spec.rb +1178 -1247
  84. data/spec/kitchen/diagnostic_spec.rb +37 -38
  85. data/spec/kitchen/driver/base_spec.rb +7 -14
  86. data/spec/kitchen/driver/dummy_spec.rb +1 -7
  87. data/spec/kitchen/driver/proxy_spec.rb +2 -7
  88. data/spec/kitchen/driver/ssh_base_spec.rb +128 -149
  89. data/spec/kitchen/driver_spec.rb +7 -13
  90. data/spec/kitchen/errors_spec.rb +50 -60
  91. data/spec/kitchen/instance_spec.rb +217 -294
  92. data/spec/kitchen/lazy_hash_spec.rb +14 -18
  93. data/spec/kitchen/loader/yaml_spec.rb +201 -227
  94. data/spec/kitchen/logger_spec.rb +7 -15
  95. data/spec/kitchen/logging_spec.rb +1 -4
  96. data/spec/kitchen/login_command_spec.rb +3 -4
  97. data/spec/kitchen/metadata_chopper_spec.rb +0 -3
  98. data/spec/kitchen/platform_spec.rb +31 -32
  99. data/spec/kitchen/provisioner/base_spec.rb +22 -41
  100. data/spec/kitchen/provisioner/chef/policyfile_spec.rb +15 -15
  101. data/spec/kitchen/provisioner/chef_apply_spec.rb +8 -13
  102. data/spec/kitchen/provisioner/chef_base_spec.rb +150 -182
  103. data/spec/kitchen/provisioner/chef_solo_spec.rb +58 -72
  104. data/spec/kitchen/provisioner/chef_zero_spec.rb +99 -125
  105. data/spec/kitchen/provisioner/dummy_spec.rb +8 -11
  106. data/spec/kitchen/provisioner/shell_spec.rb +86 -103
  107. data/spec/kitchen/provisioner_spec.rb +5 -11
  108. data/spec/kitchen/shell_out_spec.rb +15 -19
  109. data/spec/kitchen/ssh_spec.rb +16 -35
  110. data/spec/kitchen/state_file_spec.rb +6 -11
  111. data/spec/kitchen/suite_spec.rb +5 -6
  112. data/spec/kitchen/transport/base_spec.rb +6 -14
  113. data/spec/kitchen/transport/ssh_spec.rb +39 -64
  114. data/spec/kitchen/transport/winrm_spec.rb +99 -127
  115. data/spec/kitchen/transport_spec.rb +7 -13
  116. data/spec/kitchen/util_spec.rb +17 -26
  117. data/spec/kitchen/verifier/base_spec.rb +24 -40
  118. data/spec/kitchen/verifier/busser_spec.rb +38 -68
  119. data/spec/kitchen/verifier/dummy_spec.rb +8 -11
  120. data/spec/kitchen/verifier/shell_spec.rb +14 -17
  121. data/spec/kitchen/verifier_spec.rb +7 -13
  122. data/spec/kitchen_spec.rb +4 -6
  123. data/spec/spec_helper.rb +1 -1
  124. data/spec/support/powershell_max_size_spec.rb +1 -2
  125. data/support/chef-client-zero.rb +3 -4
  126. data/test-kitchen.gemspec +4 -6
  127. metadata +9 -9
@@ -24,24 +24,23 @@ require "stringio"
24
24
  require "kitchen/verifier/dummy"
25
25
 
26
26
  describe Kitchen::Verifier::Dummy do
27
-
28
27
  let(:logged_output) { StringIO.new }
29
28
  let(:logger) { Logger.new(logged_output) }
30
- let(:platform) { stub(:os_type => nil, :shell_type => nil) }
31
- let(:suite) { stub(:name => "fries") }
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
- { :test_base_path => "/basist", :kitchen_root => "/rooty" }
34
+ { test_base_path: "/basist", kitchen_root: "/rooty" }
36
35
  end
37
36
 
38
37
  let(:instance) do
39
38
  stub(
40
- :name => "coolbeans",
41
- :to_str => "instance",
42
- :logger => logger,
43
- :suite => suite,
44
- :platform => platform
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::Verifier::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
  verifier[:sleep].must_equal 0
64
62
  end
@@ -69,7 +67,6 @@ describe Kitchen::Verifier::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
  verifier.expects(:sleep).with(12.5).returns(true)
@@ -25,24 +25,23 @@ require "kitchen/verifier/shell"
25
25
  require "kitchen/transport/ssh"
26
26
 
27
27
  describe Kitchen::Verifier::Shell do
28
-
29
28
  let(:logged_output) { StringIO.new }
30
29
  let(:logger) { Logger.new(logged_output) }
31
- let(:platform) { stub(:os_type => nil, :shell_type => nil, :name => "coolbeans") }
32
- let(:suite) { stub(:name => "fries") }
30
+ let(:platform) { stub(os_type: nil, shell_type: nil, name: "coolbeans") }
31
+ let(:suite) { stub(name: "fries") }
33
32
  let(:state) { Hash.new }
34
33
 
35
34
  let(:config) do
36
- { :test_base_path => "/basist", :kitchen_root => "/rooty" }
35
+ { test_base_path: "/basist", kitchen_root: "/rooty" }
37
36
  end
38
37
 
39
38
  let(:instance) do
40
39
  stub(
41
- :name => [platform.name, suite.name].join("-"),
42
- :to_str => "instance",
43
- :logger => logger,
44
- :suite => suite,
45
- :platform => platform
40
+ name: [platform.name, suite.name].join("-"),
41
+ to_str: "instance",
42
+ logger: logger,
43
+ suite: suite,
44
+ platform: platform
46
45
  )
47
46
  end
48
47
 
@@ -59,7 +58,6 @@ describe Kitchen::Verifier::Shell do
59
58
  end
60
59
 
61
60
  describe "configuration" do
62
-
63
61
  it "sets :sleep to 0 by default" do
64
62
  verifier[:sleep].must_equal 0
65
63
  end
@@ -74,7 +72,6 @@ describe Kitchen::Verifier::Shell do
74
72
  end
75
73
 
76
74
  describe "#call" do
77
-
78
75
  describe "#shell_out" do
79
76
  it "calls sleep if :sleep value is greater than 0" do
80
77
  config[:sleep] = 3
@@ -124,12 +121,12 @@ describe Kitchen::Verifier::Shell do
124
121
 
125
122
  let(:instance) do
126
123
  stub(
127
- :name => "coolbeans",
128
- :to_str => "instance",
129
- :logger => logger,
130
- :platform => platform,
131
- :suite => suite,
132
- :transport => transport
124
+ name: "coolbeans",
125
+ to_str: "instance",
126
+ logger: logger,
127
+ platform: platform,
128
+ suite: suite,
129
+ transport: transport
133
130
  )
134
131
  end
135
132
 
@@ -33,14 +33,11 @@ module Kitchen
33
33
  end
34
34
 
35
35
  module Kitchen
36
-
37
36
  module Verifier
38
-
39
37
  class Coolbeans < Kitchen::Verifier::Base
40
38
  end
41
39
 
42
40
  class ItDepends < Kitchen::Verifier::Base
43
-
44
41
  attr_reader :verify_call_count
45
42
 
46
43
  def initialize(config = {})
@@ -54,7 +51,6 @@ module Kitchen
54
51
  end
55
52
 
56
53
  class UnstableDepends < Kitchen::Verifier::Base
57
-
58
54
  def verify_dependencies
59
55
  raise UserError, "Oh noes, you don't have software!"
60
56
  end
@@ -63,9 +59,7 @@ module Kitchen
63
59
  end
64
60
 
65
61
  describe Kitchen::Verifier do
66
-
67
62
  describe ".for_plugin" do
68
-
69
63
  before do
70
64
  Kitchen::Verifier.stubs(:require).returns(true)
71
65
  end
@@ -77,7 +71,7 @@ describe Kitchen::Verifier do
77
71
  end
78
72
 
79
73
  it "returns a verifier initialized with its config" do
80
- verifier = Kitchen::Verifier.for_plugin("coolbeans", :foo => "bar")
74
+ verifier = Kitchen::Verifier.for_plugin("coolbeans", foo: "bar")
81
75
 
82
76
  verifier[:foo].must_equal "bar"
83
77
  end
@@ -100,21 +94,21 @@ describe Kitchen::Verifier do
100
94
  it "raises ClientError if the verifier could not be required" do
101
95
  Kitchen::Verifier.stubs(:require).raises(LoadError)
102
96
 
103
- proc { Kitchen::Verifier.for_plugin("coolbeans", {}) }.
104
- must_raise Kitchen::ClientError
97
+ proc { Kitchen::Verifier.for_plugin("coolbeans", {}) }
98
+ .must_raise Kitchen::ClientError
105
99
  end
106
100
 
107
101
  it "raises ClientError if the verifier's class constant was not found" do
108
102
  # pretend require worked
109
103
  Kitchen::Verifier.stubs(:require).returns(true)
110
104
 
111
- proc { Kitchen::Verifier.for_plugin("nope", {}) }.
112
- must_raise Kitchen::ClientError
105
+ proc { Kitchen::Verifier.for_plugin("nope", {}) }
106
+ .must_raise Kitchen::ClientError
113
107
  end
114
108
 
115
109
  it "raises UserError if #verify_dependencies failes" do
116
- proc { Kitchen::Verifier.for_plugin("unstable_depends", {}) }.
117
- must_raise Kitchen::UserError
110
+ proc { Kitchen::Verifier.for_plugin("unstable_depends", {}) }
111
+ .must_raise Kitchen::UserError
118
112
  end
119
113
  end
120
114
  end
@@ -21,7 +21,6 @@ require_relative "spec_helper"
21
21
  require "kitchen"
22
22
 
23
23
  describe "Kitchen" do
24
-
25
24
  let(:stdout) { StringIO.new }
26
25
 
27
26
  before do
@@ -39,7 +38,6 @@ describe "Kitchen" do
39
38
  end
40
39
 
41
40
  describe "defaults" do
42
-
43
41
  it "sets DEFAULT_LOG_LEVEL to :info" do
44
42
  Kitchen::DEFAULT_LOG_LEVEL.must_equal :info
45
43
  end
@@ -66,8 +64,8 @@ describe "Kitchen" do
66
64
  end
67
65
 
68
66
  it ".source_root returns the root path of the gem" do
69
- Kitchen.source_root.
70
- must_equal Pathname.new(File.expand_path("../..", __FILE__))
67
+ Kitchen.source_root
68
+ .must_equal Pathname.new(File.expand_path("../..", __FILE__))
71
69
  end
72
70
 
73
71
  it ".default_logger is a Kitchen::Logger" do
@@ -93,8 +91,8 @@ describe "Kitchen" do
93
91
  it ".default_file_logger returns a logger that uses a file" do
94
92
  Kitchen.default_file_logger.warn("uhoh")
95
93
 
96
- IO.read(File.join(%w[.kitchen logs kitchen.log])).
97
- must_match %r{ -- Kitchen: uhoh$}
94
+ IO.read(File.join(%w{.kitchen logs kitchen.log}))
95
+ .must_match %r{ -- Kitchen: uhoh$}
98
96
  end
99
97
 
100
98
  it ".default_file_logger accepts a level and log_overwrite" do
@@ -71,7 +71,7 @@ end
71
71
 
72
72
  def os_safe_root_path(root_path)
73
73
  if running_tests_on_windows?
74
- "#{File.join(ENV["SystemDrive"], root_path)}"
74
+ File.join(ENV["SystemDrive"], root_path).to_s
75
75
  else
76
76
  root_path
77
77
  end
@@ -27,10 +27,9 @@ require_relative "../spec_helper"
27
27
  # in terms of PowerShell invocations).
28
28
 
29
29
  describe "PowerShell script max size" do
30
-
31
30
  MAX_POWERSHELL_SIZE = 3010
32
31
 
33
- Dir.glob(File.join(File.dirname(__FILE__), "../../support/*.ps1*")).each do|script|
32
+ Dir.glob(File.join(File.dirname(__FILE__), "../../support/*.ps1*")).each do |script|
34
33
  base = File.basename(script)
35
34
 
36
35
  it "support/#{base} size must be less than #{MAX_POWERSHELL_SIZE} bytes" do
@@ -33,7 +33,6 @@ require "fileutils"
33
33
  ENV["GEM_HOME"] = ENV["GEM_PATH"] = ENV["GEM_CACHE"] = nil
34
34
 
35
35
  class ChefClientZero
36
-
37
36
  def self.start
38
37
  new.run
39
38
  end
@@ -52,8 +51,8 @@ class ChefClientZero
52
51
  chef_fs.write_pretty_json = true
53
52
 
54
53
  @server = ChefZero::Server.new(
55
- :generate_real_keys => false,
56
- :data_store => Chef::ChefFS::ChefFSDataStore.new(chef_fs)
54
+ generate_real_keys: false,
55
+ data_store: Chef::ChefFS::ChefFSDataStore.new(chef_fs)
57
56
  )
58
57
  puts "-----> Starting Chef Zero server in #{chef_fs.fs_description}"
59
58
  @server.start_background
@@ -70,7 +69,7 @@ class ChefClientZero
70
69
 
71
70
  def run_chef_client
72
71
  system("chef-client", *ARGV)
73
- fail if $CHILD_STATUS != 0
72
+ raise if $CHILD_STATUS != 0
74
73
  end
75
74
  end
76
75
 
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
17
17
  gem.homepage = "http://kitchen.ci"
18
18
 
19
19
  gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
20
- gem.executables = %w[kitchen]
20
+ gem.executables = %w{kitchen}
21
21
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
22
22
  gem.require_paths = ["lib"]
23
23
 
@@ -41,7 +41,7 @@ Gem::Specification.new do |gem|
41
41
  gem.add_development_dependency "winrm-fs", "~> 1.0"
42
42
 
43
43
  gem.add_development_dependency "bundler", "~> 1.3"
44
- gem.add_development_dependency "rake", "~> 10.0"
44
+ gem.add_development_dependency "rake", "~> 12.0"
45
45
  gem.add_development_dependency "github_changelog_generator", "1.11.3"
46
46
 
47
47
  gem.add_development_dependency "aruba", "~> 0.11"
@@ -56,8 +56,6 @@ Gem::Specification.new do |gem|
56
56
  gem.add_development_dependency "simplecov", "~> 0.7"
57
57
  gem.add_development_dependency "yard", "~> 0.8"
58
58
 
59
- # style and complexity libraries are tightly version pinned as newer releases
60
- # may introduce new and undesireable style choices which would be immediately
61
- # enforced in CI
62
- gem.add_development_dependency "finstyle", "1.5.0"
59
+ # Replacing finstyle in favor of chefstyle
60
+ gem.add_development_dependency "chefstyle"
63
61
  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.14.1
4
+ version: 1.14.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: 2016-12-08 00:00:00.000000000 Z
11
+ date: 2016-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout
@@ -258,14 +258,14 @@ dependencies:
258
258
  requirements:
259
259
  - - "~>"
260
260
  - !ruby/object:Gem::Version
261
- version: '10.0'
261
+ version: '12.0'
262
262
  type: :development
263
263
  prerelease: false
264
264
  version_requirements: !ruby/object:Gem::Requirement
265
265
  requirements:
266
266
  - - "~>"
267
267
  - !ruby/object:Gem::Version
268
- version: '10.0'
268
+ version: '12.0'
269
269
  - !ruby/object:Gem::Dependency
270
270
  name: github_changelog_generator
271
271
  requirement: !ruby/object:Gem::Requirement
@@ -407,19 +407,19 @@ dependencies:
407
407
  - !ruby/object:Gem::Version
408
408
  version: '0.8'
409
409
  - !ruby/object:Gem::Dependency
410
- name: finstyle
410
+ name: chefstyle
411
411
  requirement: !ruby/object:Gem::Requirement
412
412
  requirements:
413
- - - '='
413
+ - - ">="
414
414
  - !ruby/object:Gem::Version
415
- version: 1.5.0
415
+ version: '0'
416
416
  type: :development
417
417
  prerelease: false
418
418
  version_requirements: !ruby/object:Gem::Requirement
419
419
  requirements:
420
- - - '='
420
+ - - ">="
421
421
  - !ruby/object:Gem::Version
422
- version: 1.5.0
422
+ version: '0'
423
423
  description: Test Kitchen is an integration tool for developing and testing infrastructure
424
424
  code and software on isolated target platforms.
425
425
  email: