summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorVivek Singh <vivek.singh@msystechnologies.com>2020-09-18 16:09:12 +0530
committerTim Smith <tsmith84@gmail.com>2021-02-02 11:58:07 -0800
commit36dbbdc8494401e8859aec7e45b468d82454a013 (patch)
treeb11813dace86e368a8d17d0f051f956e0d5bf88c /spec
parentb1470272c084fadf658f35d03e28a66f8e1052fd (diff)
downloadchef-36dbbdc8494401e8859aec7e45b468d82454a013.tar.gz
Rescue Train::UserError and re-try with su_password
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/knife/bootstrap_spec.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb
index ede8d029c6..294942c229 100644
--- a/spec/unit/knife/bootstrap_spec.rb
+++ b/spec/unit/knife/bootstrap_spec.rb
@@ -1763,7 +1763,6 @@ describe Chef::Knife::Bootstrap do
let(:exit_status) { 1 }
let(:stdout) { "su: Authentication failure" }
let(:connection_obj) { double("connection", transport_options: {}) }
- let(:result_mock2) { double("result", exit_status: 1, stderr: "A message", stdout: "") }
it "shows an error and exits" do
allow(connection).to receive(:connection).and_return(connection_obj)
expect(knife.ui).to receive(:info).with(/Bootstrapping.*/)
@@ -1774,10 +1773,8 @@ describe Chef::Knife::Bootstrap do
.to receive(:run_command)
.with("su - USER -c 'sh /path.sh'")
.and_yield("output here", nil)
- .and_return result_mock
- expect(knife.ui).to receive(:ask).and_return("password").twice
- expect(connection).to receive(:run_command).with("su - USER -c 'sh /path.sh'").and_return(result_mock, result_mock2)
- expect { knife.perform_bootstrap("/path.sh") }.to raise_error(SystemExit)
+ .and_raise(Train::UserError)
+ expect { knife.perform_bootstrap("/path.sh") }.to raise_error(Train::UserError)
end
end
end