summaryrefslogtreecommitdiff
path: root/spec/unit/knife/bootstrap
diff options
context:
space:
mode:
authorsawanoboly <sawanoboriyu@higanworks.com>2019-06-24 17:19:19 +0900
committersawanoboly <sawanoboriyu@higanworks.com>2019-06-24 17:19:52 +0900
commita4b4416a6123bcfc33d5efffb56e1773951d1ae6 (patch)
tree3fbcdd35322f4f08f24d1da602d771cae9ffd4eb /spec/unit/knife/bootstrap
parentfdbdc97b7f7bace8df63f11d452de4ff26567e6d (diff)
downloadchef-a4b4416a6123bcfc33d5efffb56e1773951d1ae6.tar.gz
ignore noise outputs
Signed-off-by: sawanoboly <sawanoboriyu@higanworks.com>
Diffstat (limited to 'spec/unit/knife/bootstrap')
-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