summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2019-06-25 09:36:47 -0700
committerGitHub <noreply@github.com>2019-06-25 09:36:47 -0700
commit19278b684d5c3f2e117ff005171f8c05001780a9 (patch)
tree122171be4ce75ea5b00f46dd409cff9f2f6993ac /spec
parent3b2495c5a2c6cc4e558b11a6ddb0328643907a8c (diff)
parentc00bf5d692d89a22357f04ba40ee8a9ed4d79798 (diff)
downloadchef-19278b684d5c3f2e117ff005171f8c05001780a9.tar.gz
Merge pull request #8682 from higanworks/handle_temp_dir_stdout
Ignore noisy outputs at create temp_dir during bootstrap
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/knife/bootstrap/train_connector_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/unit/knife/bootstrap/train_connector_spec.rb b/spec/unit/knife/bootstrap/train_connector_spec.rb
index c3c559c65b..52345f3cde 100644
--- a/spec/unit/knife/bootstrap/train_connector_spec.rb
+++ b/spec/unit/knife/bootstrap/train_connector_spec.rb
@@ -163,6 +163,15 @@ describe Chef::Knife::Bootstrap::TrainConnector do
expect(subject.temp_dir).to eq "/a/path"
end
+ context "with noise in stderr" do
+ it "uses the *nix command to create the temp dir and sets ownership to logged-in user" do
+ expected_command = Chef::Knife::Bootstrap::TrainConnector::MKTEMP_NIX_COMMAND
+ expect(subject).to receive(:run_command!).with(expected_command)
+ .and_return double("result", stdout: "sudo: unable to resolve host hostname.localhost\r\n" + "/a/path\r\n")
+ expect(subject).to receive(:run_command!).with("chown user1 '/a/path'")
+ expect(subject.temp_dir).to eq "/a/path"
+ end
+ end
end
end
context "#upload_file_content!" do