summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorSerdar Sutay <serdar@opscode.com>2014-11-07 20:35:56 -0800
committerSerdar Sutay <serdar@opscode.com>2014-11-07 20:36:39 -0800
commit8fb31b81c6892c55792143a2625c1a1ea941cbdb (patch)
tree3cf393ea94f7b6fc381cf4bf13262a64dd8bde1e /spec
parent2ed1a91a4a8256b47d3aa7644b426f393f44601f (diff)
downloadchef-8fb31b81c6892c55792143a2625c1a1ea941cbdb.tar.gz
Merge pull request #2370 from opscode/ryan/follow_symlinks
Make client.pem being a symlink a configurable option
Diffstat (limited to 'spec')
-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 d752429676..5812eb2fb5 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
IO.read(key_location).should == "--begin rsa key etc--"
end
+
+ context 'when the client key location is a symlink' do
+ it 'does not follow the symlink', :unix_only do
+ expect(registration.file_flags).to eq(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
+ expect(registration.file_flags).to eq(File::CREAT|File::TRUNC|File::RDWR)
+ end
+ end
+ end
end
describe "when registering a client" do