diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/data/trusted_certs_empty/.gitkeep | 0 | ||||
-rw-r--r-- | spec/data/trusted_certs_empty/README.md | 1 | ||||
-rw-r--r-- | spec/unit/knife/bootstrap_spec.rb | 10 |
3 files changed, 7 insertions, 4 deletions
diff --git a/spec/data/trusted_certs_empty/.gitkeep b/spec/data/trusted_certs_empty/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/spec/data/trusted_certs_empty/.gitkeep diff --git a/spec/data/trusted_certs_empty/README.md b/spec/data/trusted_certs_empty/README.md new file mode 100644 index 0000000000..e7e52627f1 --- /dev/null +++ b/spec/data/trusted_certs_empty/README.md @@ -0,0 +1 @@ +A directory with no certs. Used for testing directories with no certs during bootstrap. diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb index b5698c5a9f..f54c8ac1d6 100644 --- a/spec/unit/knife/bootstrap_spec.rb +++ b/spec/unit/knife/bootstrap_spec.rb @@ -447,11 +447,13 @@ describe Chef::Knife::Bootstrap do end end - it "doesn't create /etc/chef/trusted_certs if :trusted_certs_dir is empty", :focus do - allow(Dir).to receive(:glob).and_call_original # ensure the template can be found - expect(Dir).to receive(:glob).with(File.join(trusted_certs_dir, "*.{crt,pem}")).and_return([]) - expect(rendered_template).not_to match(%r{mkdir -p /etc/chef/trusted_certs}) + context "when :trusted_cets_dir is empty" do + let(:trusted_certs_dir) { Chef::Util::PathHelper.cleanpath(File.join(File.dirname(__FILE__), "../../data/trusted_certs_empty")) } + it "doesn't create /etc/chef/trusted_certs if :trusted_certs_dir is empty" do + expect(rendered_template).not_to match(%r{mkdir -p /etc/chef/trusted_certs}) + end end + end context "when doing fips things" do |