summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Cragun <me@ryan.ec>2014-11-06 16:13:03 -0800
committerSerdar Sutay <serdar@opscode.com>2014-11-07 17:22:33 -0800
commit3630b9bae02b5ef882e90e43626e6ab39899642d (patch)
treed6af8a772af56dd6136ca2309ebfc98ca34ec836
parentccf7974905b6f6dce1e626f2894970813177445f (diff)
downloadchef-3630b9bae02b5ef882e90e43626e6ab39899642d.tar.gz
Add spec for making client.pem a symlink a config option
-rw-r--r--spec/unit/api_client/registration_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/unit/api_client/registration_spec.rb b/spec/unit/api_client/registration_spec.rb
index 55348ec8ee..ae0ad96f71 100644
--- a/spec/unit/api_client/registration_spec.rb
+++ b/spec/unit/api_client/registration_spec.rb
@@ -209,6 +209,22 @@ describe Chef::ApiClient::Registration do
registration.write_key
expect(IO.read(key_location)).to eq("--begin rsa key etc--")
end
+
+ context 'when the client key location is a symlink' do
+ it 'does not follow the symlink', :unix_only do
+ registration.file_flags.should == File::CREAT|File::TRUNC|File::RDWR|File::NOFOLLOW
+ end
+
+ context 'with follow_client_key_symlink set to true' do
+ before do
+ Chef::Config[:follow_client_key_symlink] = true
+ end
+
+ it 'follows the symlink', :unix_only do
+ registration.file_flags.should == File::CREAT|File::TRUNC|File::RDWR
+ end
+ end
+ end
end
describe "when registering a client" do