spec/debian/commands_spec.rb in serverspec-0.2.21 vs spec/debian/commands_spec.rb in serverspec-0.2.22

- old
+ new

@@ -13,9 +13,24 @@ describe 'check_mounted', :os => :debian do subject { commands.check_mounted('/') } it { should eq "mount | grep -w 'on /'" } end +describe 'check_reachable', :os => :debian do + context "connect with name from /etc/services to localhost" do + subject { commands.check_reachable('localhost', 'ssh', 'tcp', 1) } + it { should eq "nc -vvvvzt localhost ssh -w 1" } + end + context "connect with ip and port 11111 and timeout of 5" do + subject { commands.check_reachable('127.0.0.1', '11111', 'udp', 5) } + it { should eq "nc -vvvvzu 127.0.0.1 11111 -w 5" } + end + context "do a ping" do + subject { commands.check_reachable('127.0.0.1', nil, 'icmp', 1) } + it { should eq "ping -n 127.0.0.1 -w 1 -c 2" } + end +end + describe 'check_resolvable', :os => :debian do context "resolve localhost by hosts" do subject { commands.check_resolvable('localhost', 'hosts') } it { should eq "grep -w localhost /etc/hosts" } end