diff options
author | snehaldwivedi <sdwivedi@msystechnologies.com> | 2021-10-28 02:18:01 -0700 |
---|---|---|
committer | snehaldwivedi <sdwivedi@msystechnologies.com> | 2021-11-01 23:56:51 -0700 |
commit | e677f67853fde238206c2f96b3770fc3af81f4e3 (patch) | |
tree | bc54f58f469ede79f2ce5f88274cf5841f388851 /spec/integration | |
parent | 9110f7e9b1dc6e9d9406cc148fb3becc90d2abd7 (diff) | |
download | chef-e677f67853fde238206c2f96b3770fc3af81f4e3.tar.gz |
Moved rspec for base.rb and added integration test
Signed-off-by: snehaldwivedi <sdwivedi@msystechnologies.com>
Diffstat (limited to 'spec/integration')
-rw-r--r-- | spec/integration/client/client_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb index b23935f317..54503a6d67 100644 --- a/spec/integration/client/client_spec.rb +++ b/spec/integration/client/client_spec.rb @@ -49,6 +49,37 @@ describe "chef-client" do let(:chef_solo) { "bundle exec #{ChefUtils::Dist::Solo::EXEC} --legacy-mode --minimal-ohai" } context "when validation.pem in current Directory" do + let(:validation_path) { "" } + + before do + tempfile = Tempfile.new(validation_path) + tempfile.write "string" + tempfile.close + @path = tempfile.path + Chef::Config.validation_key = @path + + file "config/client.rb", <<~EOM + local_mode true + cookbook_path "#{path_to("cookbooks")}" + EOM + end + + it "should find validation.pem successfully in current dir" do + validation_path = "validation.pem" + shell_out!("#{chef_client} -c \"#{path_to("config/client.rb")}\" -K #{@path} ", cwd: chef_dir) + end + + it "should find validation.pem successfully in current dir" do + validation_path = "/tmp/validation.pem" + shell_out!("#{chef_client} -c \"#{path_to("config/client.rb")}\" -K #{@path} ", cwd: chef_dir) + end + + it "should find validation.pem successfully in /etc/chef/ directory" do + shell_out!("#{chef_client} -c \"#{path_to("config/client.rb")}\" ", cwd: chef_dir) + end + end + + context "when validation.pem in current Directory" do before do file "mykey.pem", <<~EOM -----BEGIN RSA PRIVATE KEY----- |