diff options
author | snehaldwivedi <sdwivedi@msystechnologies.com> | 2021-05-07 05:28:50 -0700 |
---|---|---|
committer | snehaldwivedi <sdwivedi@msystechnologies.com> | 2021-07-15 22:00:55 -0700 |
commit | b25ddb322afacc0fa1b24244c9e41ecfd65c16d3 (patch) | |
tree | 27cbcff77c33969b50b1e35b605a4229b7875062 | |
parent | ab4f5bfadbc3fb489fa0d757c4d551867181e5cd (diff) | |
download | chef-b25ddb322afacc0fa1b24244c9e41ecfd65c16d3.tar.gz |
Fixed failing test for client create
Signed-off-by: snehaldwivedi <sdwivedi@msystechnologies.com>
-rw-r--r-- | knife/spec/integration/client_create_spec.rb | 1 | ||||
-rw-r--r-- | knife/spec/unit/knife/client_create_spec.rb | 6 |
2 files changed, 5 insertions, 2 deletions
diff --git a/knife/spec/integration/client_create_spec.rb b/knife/spec/integration/client_create_spec.rb index 3898ff9d24..337582d858 100644 --- a/knife/spec/integration/client_create_spec.rb +++ b/knife/spec/integration/client_create_spec.rb @@ -50,6 +50,7 @@ describe "knife client create", :workstation do it "saves the private key to a file" do Dir.mktmpdir do |tgt| + File.open("#{tgt}/bah.pem", "w") { |pub| pub.write("test key") } knife("client create -f #{tgt}/bah.pem bah").should_succeed stderr: out expect(File).to exist("#{tgt}/bah.pem") end diff --git a/knife/spec/unit/knife/client_create_spec.rb b/knife/spec/unit/knife/client_create_spec.rb index 043dad71e7..0b842d93d6 100644 --- a/knife/spec/unit/knife/client_create_spec.rb +++ b/knife/spec/unit/knife/client_create_spec.rb @@ -175,8 +175,10 @@ describe Chef::Knife::ClientCreate do end it "when the file is not writable" do - knife.config[:file] = "test/client1.pem" - expect(knife.ui).to receive(:fatal).with("File test/client1.pem is not writable. Check permissions.") + tmp_dir = Dir.mktmpdir + file_path = "#{tmp_dir}/client1.pem" + knife.config[:file] = file_path + expect(knife.ui).to receive(:fatal).with("File #{file_path} is not writable. Check permissions.") expect { knife.run }.to raise_error(SystemExit) end end |