summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielsdeleo <dan@getchef.com>2014-03-26 18:33:20 -0700
committerdanielsdeleo <dan@getchef.com>2014-03-26 22:04:52 -0700
commitf229f1d5f44f93a241f54417a470123a4d35be96 (patch)
tree1c81bb3f6da39f84197da3e304784ebcdca6cda4
parentc91fac611084d30510fdbd78b648355bffef4f8f (diff)
downloadchef-f229f1d5f44f93a241f54417a470123a4d35be96.tar.gz
Fix unit tests to not access /etc/chef/encrypted_data_bag_secret
-rw-r--r--spec/unit/knife/bootstrap_spec.rb17
1 files changed, 13 insertions, 4 deletions
diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb
index b055cadcee..501e678a2b 100644
--- a/spec/unit/knife/bootstrap_spec.rb
+++ b/spec/unit/knife/bootstrap_spec.rb
@@ -124,12 +124,21 @@ describe Chef::Knife::Bootstrap do
end
describe "specifying no_proxy with various entries" do
- subject(:knife) { described_class.new }
- let(:options){ ["--bootstrap-no-proxy", setting] }
+ subject(:knife) do
+ k = described_class.new
+ k.instance_variable_set("@template_file", template_file)
+ k.parse_options(options)
+ k.merge_configs
+ k
+ end
+
+ # Include a data bag secret in the options to prevent Bootstrap from
+ # attempting to access /etc/chef/encrypted_data_bag_secret, which
+ # can fail when the file exists but can't be accessed by the user
+ # running the tests.
+ let(:options){ ["--bootstrap-no-proxy", setting, "-s", "foo"] }
let(:template_file) { File.expand_path(File.join(CHEF_SPEC_DATA, "bootstrap", "no_proxy.erb")) }
let(:rendered_template) do
- knife.instance_variable_set("@template_file", template_file)
- knife.parse_options(options)
template_string = knife.read_template
knife.render_template(template_string)
end