diff options
author | Tony Novak <afn2@cornell.edu> | 2017-11-20 10:03:08 -0500 |
---|---|---|
committer | Tony Novak <afn2@cornell.edu> | 2017-11-20 10:06:24 -0500 |
commit | ab2aad50f613eb9b2f59da2c1452b27fd3f2f589 (patch) | |
tree | c053cc8be6b5055dd2ddc9e87bfbb1b6823554a2 /spec | |
parent | 25d1ec70d26e999a9998e6b8df6078f0df01aa5a (diff) | |
download | chef-ab2aad50f613eb9b2f59da2c1452b27fd3f2f589.tar.gz |
Filter out periods from tmux session name
Fixes #6592
Signed-off-by: Tony Novak <tony@getnexar.com>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/knife/ssh_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/unit/knife/ssh_spec.rb b/spec/unit/knife/ssh_spec.rb index e15ca8a7f0..815995b687 100644 --- a/spec/unit/knife/ssh_spec.rb +++ b/spec/unit/knife/ssh_spec.rb @@ -295,6 +295,23 @@ describe Chef::Knife::Ssh do end end + describe "#tmux" do + before do + ssh_config = { :timeout => 50, :user => "locutus", :port => 23, :keepalive => true, :keepalive_interval => 60 } + allow(Net::SSH).to receive(:configuration_for).with("foo.example.org", true).and_return(ssh_config) + @query = Chef::Search::Query.new + expect(@query).to receive(:search).and_yield(@node_foo) + allow(Chef::Search::Query).to receive(:new).and_return(@query) + allow(@knife).to receive(:exec).and_return(0) + end + + it "filters out invalid characters from tmux session name" do + @knife.name_args = ["name:foo.example.org", "tmux"] + expect(@knife).to receive(:shell_out!).with("tmux new-session -d -s 'knife ssh name=foo-example-org' -n 'foo.example.org' 'ssh locutus@foo.example.org' ") + @knife.run + end + end + describe "#run" do before do @query = Chef::Search::Query.new |