spec/solaris/commands_spec.rb in serverspec-0.6.21 vs spec/solaris/commands_spec.rb in serverspec-0.6.22
- old
+ new
@@ -19,15 +19,30 @@
it_behaves_like 'support command check_authorized_key'
end
describe 'check_enabled' do
subject { commands.check_enabled('httpd') }
- it { should eq "svcs -l httpd 2> /dev/null | grep -wx '^enabled.*true$'" }
+ it { should eq "svcs -l httpd 2> /dev/null | egrep '^enabled *true$'" }
end
describe 'check_running' do
subject { commands.check_running('httpd') }
- it { should eq "svcs -l httpd status 2> /dev/null |grep -wx '^state.*online$'" }
+ it { should eq "svcs -l httpd status 2> /dev/null | egrep '^state *online$'" }
+end
+
+describe 'check_listening' do
+ subject { commands.check_listening(80) }
+ it { should eq %q!netstat -an 2> /dev/null | egrep 'LISTEN|Idle' | grep -- .80\\ ! }
+end
+
+describe 'check_listening_with_tcp' do
+ subject { commands.check_listening_with_protocol(80, "tcp") }
+ it { should eq %q!netstat -an -P tcp 2> /dev/null | egrep 'LISTEN|Idle' | grep -- .\\*.80\\ ! }
+end
+
+describe 'check_listening_with_udp' do
+ subject { commands.check_listening_with_protocol(123, "udp") }
+ it { should eq %q!netstat -an -P udp 2> /dev/null | egrep 'LISTEN|Idle' | grep -- .\\*.123\\ ! }
end
describe 'check_belonging_group' do
subject { commands.check_belonging_group('root', 'wheel') }
it { should eq "id -Gn root | grep -- wheel" }