test-kitchen 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/.cane +1 -1
  3. data/.rubocop.yml +3 -0
  4. data/.travis.yml +20 -9
  5. data/CHANGELOG.md +219 -108
  6. data/Gemfile +10 -6
  7. data/Guardfile +38 -9
  8. data/README.md +11 -1
  9. data/Rakefile +21 -37
  10. data/bin/kitchen +4 -4
  11. data/features/kitchen_action_commands.feature +161 -0
  12. data/features/kitchen_console_command.feature +34 -0
  13. data/features/kitchen_diagnose_command.feature +64 -0
  14. data/features/kitchen_init_command.feature +29 -17
  15. data/features/kitchen_list_command.feature +2 -2
  16. data/features/kitchen_login_command.feature +56 -0
  17. data/features/{sink_command.feature → kitchen_sink_command.feature} +0 -0
  18. data/features/kitchen_test_command.feature +88 -0
  19. data/features/step_definitions/gem_steps.rb +8 -6
  20. data/features/step_definitions/git_steps.rb +4 -2
  21. data/features/step_definitions/output_steps.rb +5 -0
  22. data/features/support/env.rb +12 -9
  23. data/lib/kitchen.rb +60 -38
  24. data/lib/kitchen/base64_stream.rb +55 -0
  25. data/lib/kitchen/busser.rb +124 -58
  26. data/lib/kitchen/cli.rb +121 -38
  27. data/lib/kitchen/collection.rb +3 -3
  28. data/lib/kitchen/color.rb +4 -4
  29. data/lib/kitchen/command.rb +78 -11
  30. data/lib/kitchen/command/action.rb +3 -2
  31. data/lib/kitchen/command/console.rb +12 -5
  32. data/lib/kitchen/command/diagnose.rb +17 -3
  33. data/lib/kitchen/command/driver_discover.rb +26 -7
  34. data/lib/kitchen/command/exec.rb +41 -0
  35. data/lib/kitchen/command/list.rb +44 -14
  36. data/lib/kitchen/command/login.rb +2 -1
  37. data/lib/kitchen/command/sink.rb +2 -1
  38. data/lib/kitchen/command/test.rb +5 -4
  39. data/lib/kitchen/config.rb +146 -14
  40. data/lib/kitchen/configurable.rb +314 -0
  41. data/lib/kitchen/data_munger.rb +522 -18
  42. data/lib/kitchen/diagnostic.rb +43 -4
  43. data/lib/kitchen/driver.rb +4 -4
  44. data/lib/kitchen/driver/base.rb +80 -115
  45. data/lib/kitchen/driver/dummy.rb +34 -6
  46. data/lib/kitchen/driver/proxy.rb +14 -3
  47. data/lib/kitchen/driver/ssh_base.rb +61 -7
  48. data/lib/kitchen/errors.rb +109 -9
  49. data/lib/kitchen/generator/driver_create.rb +39 -5
  50. data/lib/kitchen/generator/init.rb +130 -45
  51. data/lib/kitchen/instance.rb +162 -28
  52. data/lib/kitchen/lazy_hash.rb +79 -7
  53. data/lib/kitchen/loader/yaml.rb +159 -27
  54. data/lib/kitchen/logger.rb +267 -21
  55. data/lib/kitchen/logging.rb +30 -3
  56. data/lib/kitchen/login_command.rb +11 -2
  57. data/lib/kitchen/metadata_chopper.rb +2 -2
  58. data/lib/kitchen/provisioner.rb +4 -4
  59. data/lib/kitchen/provisioner/base.rb +107 -103
  60. data/lib/kitchen/provisioner/chef/berkshelf.rb +36 -8
  61. data/lib/kitchen/provisioner/chef/librarian.rb +40 -11
  62. data/lib/kitchen/provisioner/chef_base.rb +206 -167
  63. data/lib/kitchen/provisioner/chef_solo.rb +25 -7
  64. data/lib/kitchen/provisioner/chef_zero.rb +105 -29
  65. data/lib/kitchen/provisioner/dummy.rb +1 -1
  66. data/lib/kitchen/provisioner/shell.rb +21 -6
  67. data/lib/kitchen/rake_tasks.rb +8 -3
  68. data/lib/kitchen/shell_out.rb +15 -18
  69. data/lib/kitchen/ssh.rb +122 -27
  70. data/lib/kitchen/state_file.rb +24 -7
  71. data/lib/kitchen/thor_tasks.rb +9 -4
  72. data/lib/kitchen/util.rb +43 -118
  73. data/lib/kitchen/version.rb +1 -1
  74. data/lib/vendor/hash_recursive_merge.rb +10 -2
  75. data/spec/kitchen/base64_stream_spec.rb +77 -0
  76. data/spec/kitchen/busser_spec.rb +490 -0
  77. data/spec/kitchen/collection_spec.rb +10 -10
  78. data/spec/kitchen/color_spec.rb +2 -2
  79. data/spec/kitchen/config_spec.rb +234 -62
  80. data/spec/kitchen/configurable_spec.rb +490 -0
  81. data/spec/kitchen/data_munger_spec.rb +1070 -862
  82. data/spec/kitchen/diagnostic_spec.rb +79 -0
  83. data/spec/kitchen/driver/base_spec.rb +80 -85
  84. data/spec/kitchen/driver/dummy_spec.rb +43 -14
  85. data/spec/kitchen/driver/proxy_spec.rb +134 -0
  86. data/spec/kitchen/driver/ssh_base_spec.rb +644 -0
  87. data/spec/kitchen/driver_spec.rb +15 -15
  88. data/spec/kitchen/errors_spec.rb +309 -0
  89. data/spec/kitchen/instance_spec.rb +143 -46
  90. data/spec/kitchen/lazy_hash_spec.rb +36 -9
  91. data/spec/kitchen/loader/yaml_spec.rb +237 -226
  92. data/spec/kitchen/logger_spec.rb +419 -0
  93. data/spec/kitchen/logging_spec.rb +59 -0
  94. data/spec/kitchen/login_command_spec.rb +49 -0
  95. data/spec/kitchen/metadata_chopper_spec.rb +82 -0
  96. data/spec/kitchen/platform_spec.rb +4 -4
  97. data/spec/kitchen/provisioner/base_spec.rb +65 -125
  98. data/spec/kitchen/provisioner/chef_base_spec.rb +798 -0
  99. data/spec/kitchen/provisioner/chef_solo_spec.rb +316 -0
  100. data/spec/kitchen/provisioner/chef_zero_spec.rb +624 -0
  101. data/spec/kitchen/provisioner/shell_spec.rb +269 -0
  102. data/spec/kitchen/provisioner_spec.rb +6 -6
  103. data/spec/kitchen/shell_out_spec.rb +143 -0
  104. data/spec/kitchen/ssh_spec.rb +683 -0
  105. data/spec/kitchen/state_file_spec.rb +28 -21
  106. data/spec/kitchen/suite_spec.rb +7 -7
  107. data/spec/kitchen/util_spec.rb +68 -10
  108. data/spec/kitchen_spec.rb +107 -0
  109. data/spec/spec_helper.rb +18 -13
  110. data/support/chef-client-zero.rb +10 -9
  111. data/support/chef_helpers.sh +16 -0
  112. data/support/download_helpers.sh +109 -0
  113. data/test-kitchen.gemspec +42 -33
  114. metadata +107 -33
@@ -16,11 +16,11 @@
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
18
 
19
- require_relative '../spec_helper'
19
+ require_relative "../spec_helper"
20
20
 
21
- require 'kitchen/errors'
22
- require 'kitchen/state_file'
23
- require 'kitchen/util'
21
+ require "kitchen/errors"
22
+ require "kitchen/state_file"
23
+ require "kitchen/util"
24
24
 
25
25
  class YamledState
26
26
  attr_accessor :yoinks
@@ -28,8 +28,8 @@ end
28
28
 
29
29
  describe Kitchen::StateFile do
30
30
 
31
- let(:state_file) { Kitchen::StateFile.new('/tmp', 'oftheunion') }
32
- let(:file_name) { '/tmp/.kitchen/oftheunion.yml' }
31
+ let(:state_file) { Kitchen::StateFile.new("/tmp", "oftheunion") }
32
+ let(:file_name) { "/tmp/.kitchen/oftheunion.yml" }
33
33
 
34
34
  before do
35
35
  FakeFS.activate!
@@ -47,61 +47,68 @@ describe Kitchen::StateFile do
47
47
  state_file.read.must_equal(Hash.new)
48
48
  end
49
49
 
50
+ it "returns and empty hash if the file is zero length" do
51
+ stub_state_file!("")
52
+
53
+ state_file.read.must_equal(Hash.new)
54
+ end
55
+
50
56
  it "returns a Hash with symbolized keys from the state file" do
51
57
  stub_state_file!
52
58
 
53
- state_file.read.must_equal({
59
+ state_file.read.must_equal(
54
60
  :cloud_id => 42,
55
- :flavor => 'extra_crispy'
56
- })
61
+ :flavor => "extra_crispy"
62
+ )
57
63
  end
58
64
 
59
65
  it "arbitrary objects aren't deserialized from state file" do
60
- stub_state_file! <<-'YAML'.gsub(/^ {8}/, '')
66
+ stub_state_file! <<-'YAML'.gsub(/^ {8}/, "")
61
67
  --- !ruby/object:YamledState
62
68
  yoinks: zoinks
63
69
  YAML
64
70
 
65
71
  state_file.read.class.wont_equal YamledState
66
72
  state_file.read.class.must_equal Hash
67
- state_file.read.must_equal({ :yoinks => 'zoinks' })
73
+ state_file.read.must_equal(:yoinks => "zoinks")
68
74
  end
69
75
 
70
76
  it "raises a StateFileLoadError if the state file cannot be parsed" do
71
- stub_state_file!('&*%^*')
77
+ stub_state_file!("&*%^*")
72
78
 
73
79
  proc { state_file.read }.must_raise Kitchen::StateFileLoadError
74
80
  end
81
+
75
82
  end
76
83
 
77
84
  describe "#write" do
78
85
 
79
86
  it "creates the directory path to the state file" do
80
- File.directory?('/tmp/.kitchen').must_equal false
87
+ File.directory?("/tmp/.kitchen").must_equal false
81
88
  state_file.write({})
82
- File.directory?('/tmp/.kitchen').must_equal true
89
+ File.directory?("/tmp/.kitchen").must_equal true
83
90
  end
84
91
 
85
92
  it "writes a state file with stringified keys" do
86
- state_file.write({ :thekey => 'thyself' })
93
+ state_file.write(:thekey => "thyself")
87
94
 
88
- IO.read(file_name).split("\n").must_include 'thekey: thyself'
95
+ IO.read(file_name).split("\n").must_include "thekey: thyself"
89
96
  end
90
97
  end
91
98
 
92
99
  describe "#destroy" do
93
100
 
94
101
  it "executes if no file exists" do
95
- File.exists?(file_name).must_equal false
102
+ File.exist?(file_name).must_equal false
96
103
  state_file.destroy
97
- File.exists?(file_name).must_equal false
104
+ File.exist?(file_name).must_equal false
98
105
  end
99
106
 
100
107
  it "deletes the state file" do
101
108
  stub_state_file!
102
109
  state_file.destroy
103
110
 
104
- File.exists?(file_name).must_equal false
111
+ File.exist?(file_name).must_equal false
105
112
  end
106
113
  end
107
114
 
@@ -109,7 +116,7 @@ describe Kitchen::StateFile do
109
116
 
110
117
  def stub_state_file!(yaml_string = nil)
111
118
  if yaml_string.nil?
112
- yaml_string = <<-'YAML'.gsub(/^ {8}/, '')
119
+ yaml_string = <<-'YAML'.gsub(/^ {8}/, "")
113
120
  ---
114
121
  cloud_id: 42
115
122
  flavor: extra_crispy
@@ -117,6 +124,6 @@ describe Kitchen::StateFile do
117
124
  end
118
125
 
119
126
  FileUtils.mkdir_p(File.dirname(file_name))
120
- File.open(file_name, 'wb') { |f| f.write(yaml_string) }
127
+ File.open(file_name, "wb") { |f| f.write(yaml_string) }
121
128
  end
122
129
  end
@@ -16,18 +16,18 @@
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
18
 
19
- require_relative '../spec_helper'
19
+ require_relative "../spec_helper"
20
20
 
21
- require 'kitchen/errors'
22
- require 'kitchen/suite'
21
+ require "kitchen/errors"
22
+ require "kitchen/suite"
23
23
 
24
24
  describe Kitchen::Suite do
25
25
 
26
26
  let(:opts) do
27
27
  {
28
28
  :name => "suitezy",
29
- :includes => ["testbuntu", "testcent"],
30
- :excludes => ["prodbuntu"]
29
+ :includes => %w[testbuntu testcent],
30
+ :excludes => %w[prodbuntu]
31
31
  }
32
32
  end
33
33
 
@@ -43,7 +43,7 @@ describe Kitchen::Suite do
43
43
  end
44
44
 
45
45
  it "returns the includes" do
46
- suite.includes.must_equal ["testbuntu", "testcent"]
46
+ suite.includes.must_equal %w[testbuntu testcent]
47
47
  end
48
48
 
49
49
  it "returns an empty Array when includes not given" do
@@ -52,7 +52,7 @@ describe Kitchen::Suite do
52
52
  end
53
53
 
54
54
  it "returns the excludes" do
55
- suite.excludes.must_equal ["prodbuntu"]
55
+ suite.excludes.must_equal %w[prodbuntu]
56
56
  end
57
57
 
58
58
  it "returns an empty Array when excludes not given" do
@@ -16,21 +16,21 @@
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
18
 
19
- require_relative '../spec_helper'
19
+ require_relative "../spec_helper"
20
20
 
21
- require 'logger'
21
+ require "logger"
22
22
 
23
- require 'kitchen/util'
23
+ require "kitchen/util"
24
24
 
25
25
  describe Kitchen::Util do
26
26
 
27
- describe '.to_logger_level' do
27
+ describe ".to_logger_level" do
28
28
 
29
29
  it "returns nil for invalid symbols" do
30
30
  Kitchen::Util.to_logger_level(:nope).must_be_nil
31
31
  end
32
32
 
33
- %w{debug info warn error fatal}.each do |level|
33
+ %w[debug info warn error fatal].each do |level|
34
34
  it "returns Logger::#{level.upcase} for :#{level} input" do
35
35
  Kitchen::Util.to_logger_level(level.to_sym).
36
36
  must_equal Logger.const_get(level.upcase)
@@ -44,7 +44,7 @@ describe Kitchen::Util do
44
44
  Kitchen::Util.from_logger_level("nope").must_equal :fatal
45
45
  end
46
46
 
47
- %w{debug info warn error fatal}.each do |level|
47
+ %w[debug info warn error fatal].each do |level|
48
48
  it "returns :#{level} for Logger::#{level.upcase} input" do
49
49
  Kitchen::Util.from_logger_level(Logger.const_get(level.upcase)).
50
50
  must_equal(level.to_sym)
@@ -66,8 +66,8 @@ describe Kitchen::Util do
66
66
 
67
67
  it "converts string keys into symbols" do
68
68
  Kitchen::Util.
69
- symbolized_hash({ "one" => [{ "two" => :three, :four => "five" }] }).
70
- must_equal({ :one => [{ :two => :three, :four => "five" }] })
69
+ symbolized_hash("one" => [{ "two" => :three, :four => "five" }]).
70
+ must_equal(:one => [{ :two => :three, :four => "five" }])
71
71
  end
72
72
  end
73
73
 
@@ -85,8 +85,8 @@ describe Kitchen::Util do
85
85
 
86
86
  it "converts symbol keys into strings" do
87
87
  Kitchen::Util.
88
- stringified_hash({ :one => [{ :two => :three, "four" => "five" }] }).
89
- must_equal({ "one" => [{ "two" => :three, "four" => "five" }] })
88
+ stringified_hash(:one => [{ :two => :three, "four" => "five" }]).
89
+ must_equal("one" => [{ "two" => :three, "four" => "five" }])
90
90
  end
91
91
  end
92
92
 
@@ -104,4 +104,62 @@ describe Kitchen::Util do
104
104
  Kitchen::Util.duration(48033).must_equal "(800m33.00s)"
105
105
  end
106
106
  end
107
+
108
+ describe ".wrap_unix_command" do
109
+
110
+ it "returns the wrapped command" do
111
+ end
112
+
113
+ it "returns a false if command is nil" do
114
+ Kitchen::Util.wrap_command(nil).must_equal("sh -c '\nfalse\n'")
115
+ end
116
+
117
+ it "returns a true if command string is empty" do
118
+ Kitchen::Util.wrap_command("yoyo").must_equal("sh -c '\nyoyo\n'")
119
+ end
120
+
121
+ it "handles a command string with a trailing newline" do
122
+ Kitchen::Util.wrap_command("yep\n").must_equal("sh -c '\nyep\n'")
123
+ end
124
+ end
125
+
126
+ describe ".outdent!" do
127
+
128
+ it "modifies the argument string in place, destructively" do
129
+ string = "yep"
130
+
131
+ Kitchen::Util.outdent!(string).object_id.must_equal string.object_id
132
+ end
133
+
134
+ it "returns the same string if no leading whitespace exists" do
135
+ string = "one\ntwo\nthree"
136
+
137
+ Kitchen::Util.outdent!(string).must_equal "one\ntwo\nthree"
138
+ end
139
+
140
+ it "strips same amount of leading whitespace as found on first line" do
141
+ string = " one\n two\n three\nfour"
142
+
143
+ Kitchen::Util.outdent!(string).must_equal "one\n two\n three\nfour"
144
+ end
145
+ end
146
+
147
+ describe ".shell_helpers" do
148
+
149
+ %w[
150
+ exists do_wget do_curl do_fetch do_perl do_python do_download
151
+ ].each do |func|
152
+ it "contains a #{func} shell function" do
153
+ Kitchen::Util.shell_helpers.must_match "#{func}() {"
154
+ end
155
+ end
156
+
157
+ it "does not contain bare single quotes" do
158
+ Kitchen::Util.shell_helpers.wont_match "'"
159
+ end
160
+
161
+ def regexify(str)
162
+ Regexp.new("^\s+" + Regexp.escape(str) + "$")
163
+ end
164
+ end
107
165
  end
@@ -0,0 +1,107 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
+ #
5
+ # Copyright (C) 2014, Fletcher Nichol
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ require_relative "spec_helper"
20
+
21
+ require "kitchen"
22
+
23
+ describe "Kitchen" do
24
+
25
+ let(:stdout) { StringIO.new }
26
+
27
+ before do
28
+ FakeFS.activate!
29
+ FileUtils.mkdir_p(Dir.pwd)
30
+ stdout.stubs(:tty?).returns(true)
31
+ @orig_stdout = $stdout
32
+ $stdout = stdout
33
+ end
34
+
35
+ after do
36
+ $stdout = @orig_stdout
37
+ FakeFS.deactivate!
38
+ FakeFS::FileSystem.clear
39
+ end
40
+
41
+ describe "defaults" do
42
+
43
+ it "sets DEFAULT_LOG_LEVEL to :info" do
44
+ Kitchen::DEFAULT_LOG_LEVEL.must_equal :info
45
+ end
46
+
47
+ it "sets DEFAULT_TEST_DIR to test/integration, which is frozen" do
48
+ Kitchen::DEFAULT_TEST_DIR.must_equal "test/integration"
49
+ Kitchen::DEFAULT_TEST_DIR.frozen?.must_equal true
50
+ end
51
+
52
+ it "sets DEFAULT_LOG_DIR to .kitchen/logs, which is frozen" do
53
+ Kitchen::DEFAULT_LOG_DIR.must_equal ".kitchen/logs"
54
+ Kitchen::DEFAULT_LOG_DIR.frozen?.must_equal true
55
+ end
56
+ end
57
+
58
+ it ".tty? returns true if $stdout.tty? is true" do
59
+ Kitchen.tty?.must_equal true
60
+ end
61
+
62
+ it ".tty? returns flse is $stdout.tty? is false" do
63
+ stdout.stubs(:tty?).returns(false)
64
+
65
+ Kitchen.tty?.must_equal false
66
+ end
67
+
68
+ it ".source_root returns the root path of the gem" do
69
+ Kitchen.source_root.
70
+ must_equal Pathname.new(File.expand_path("../..", __FILE__))
71
+ end
72
+
73
+ it ".default_logger is a Kitchen::Logger" do
74
+ Kitchen.default_logger.must_be_instance_of Kitchen::Logger
75
+ end
76
+
77
+ it ".default_logger returns a $stdout logger" do
78
+ Kitchen.default_logger.warn("uhoh")
79
+
80
+ stdout.string.must_match %r{ uhoh$}
81
+ end
82
+
83
+ it ".default_file_logger is a Kitchen::Logger" do
84
+ Kitchen.default_file_logger.must_be_instance_of Kitchen::Logger
85
+ end
86
+
87
+ it ".default_file_logger returns a logger that uses $stdout" do
88
+ Kitchen.default_logger.warn("uhoh")
89
+
90
+ stdout.string.must_match %r{ uhoh$}
91
+ end
92
+
93
+ it ".default_file_logger returns a logger that uses a file" do
94
+ Kitchen.default_file_logger.warn("uhoh")
95
+
96
+ IO.read(File.join(%w[.kitchen logs kitchen.log])).
97
+ must_match %r{ -- Kitchen: uhoh$}
98
+ end
99
+
100
+ it "sets Kitchen.logger to a Kitchen::Logger" do
101
+ Kitchen.default_logger.must_be_instance_of Kitchen::Logger
102
+ end
103
+
104
+ it "sets Kitchen.mutex to a Mutex" do
105
+ Kitchen.mutex.must_be_instance_of Mutex
106
+ end
107
+ end
@@ -16,24 +16,29 @@
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
18
 
19
- gem 'minitest'
19
+ gem "minitest"
20
20
 
21
- require 'simplecov'
22
- SimpleCov.adapters.define 'gem' do
23
- command_name 'Specs'
21
+ if ENV["CODECLIMATE_REPO_TOKEN"]
22
+ require "codeclimate-test-reporter"
23
+ CodeClimate::TestReporter.start
24
+ elsif ENV["COVERAGE"]
25
+ require "simplecov"
26
+ SimpleCov.profiles.define "gem" do
27
+ command_name "Specs"
24
28
 
25
- add_filter '.gem/'
26
- add_filter '/spec/'
27
- add_filter '/lib/vendor/'
29
+ add_filter ".gem/"
30
+ add_filter "/spec/"
31
+ add_filter "/lib/vendor/"
28
32
 
29
- add_group 'Libraries', '/lib/'
33
+ add_group "Libraries", "/lib/"
34
+ end
35
+ SimpleCov.start "gem"
30
36
  end
31
- SimpleCov.start 'gem'
32
37
 
33
- require 'fakefs/safe'
34
- require 'minitest/autorun'
35
- require 'mocha/setup'
36
- require 'tempfile'
38
+ require "fakefs/safe"
39
+ require "minitest/autorun"
40
+ require "mocha/setup"
41
+ require "tempfile"
37
42
 
38
43
  # Nasty hack to redefine IO.read in terms of File#read for fakefs
39
44
  class IO
@@ -17,19 +17,20 @@
17
17
  # See the License for the specific language governing permissions and
18
18
  # limitations under the License.
19
19
 
20
- require 'rubygems'
21
- require 'chef/config'
22
- require 'chef_zero/server'
23
- require 'chef/chef_fs/chef_fs_data_store'
24
- require 'chef/chef_fs/config'
25
- require 'fileutils'
20
+ require "rubygems"
21
+ require "chef/config"
22
+ require "chef_zero/server"
23
+ require "chef/chef_fs/chef_fs_data_store"
24
+ require "chef/chef_fs/config"
25
+ require "English"
26
+ require "fileutils"
26
27
 
27
28
  # Bust out of our self-imposed sandbox before running chef-client so
28
29
  # gems installed via gem_package land in Chef's GEM_HOME.
29
30
  #
30
31
  # https://github.com/opscode/test-kitchen/issues/240
31
32
  #
32
- ENV['GEM_HOME'] = ENV['GEM_PATH'] = ENV['GEM_CACHE'] = nil
33
+ ENV["GEM_HOME"] = ENV["GEM_PATH"] = ENV["GEM_CACHE"] = nil
33
34
 
34
35
  class ChefClientZero
35
36
 
@@ -64,12 +65,12 @@ class ChefClientZero
64
65
  end
65
66
 
66
67
  def repo_path
67
- ENV.fetch('CHEF_REPO_PATH', Dir.pwd)
68
+ ENV.fetch("CHEF_REPO_PATH", Dir.pwd)
68
69
  end
69
70
 
70
71
  def run_chef_client
71
72
  system("chef-client", *ARGV)
72
- fail if $? != 0
73
+ fail if $CHILD_STATUS != 0
73
74
  end
74
75
  end
75
76