Skip to content

Commit 53c6eb6

Browse files
committed
Implement new service tests
1 parent 38384df commit 53c6eb6

File tree

8 files changed

+56
-0
lines changed

8 files changed

+56
-0
lines changed

tests/serverspec/spec/shared/apache/service.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
shared_examples 'apache::service::running' do
2+
describe command("service apache check") do
3+
it "should have running apache daemon", :retry => 5, :retry_wait => 10 do
4+
its(:stdout) { should match 'ok' }
5+
its(:exit_status) { should eq 0 }
6+
end
7+
end
8+
29
describe command('service apache pid | tr -d \'\n\'') do
310
# must not pid 0
411
its(:stdout) { should_not match %r!^0$! }

tests/serverspec/spec/shared/dovecot/service.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
shared_examples 'dovecot::service::running' do
2+
describe command("service dovecot check") do
3+
it "should have running dovecot daemon", :retry => 5, :retry_wait => 10 do
4+
its(:stdout) { should match 'ok' }
5+
its(:exit_status) { should eq 0 }
6+
end
7+
end
8+
29
describe command('service dovecot pid | tr -d \'\n\'') do
310
# must not pid 0
411
its(:stdout) { should_not match %r!^0$! }

tests/serverspec/spec/shared/hhvm/service.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
shared_examples 'hhvm::service::running' do
2+
describe command("service hhvm check") do
3+
it "should have running hhvm daemon", :retry => 5, :retry_wait => 10 do
4+
its(:stdout) { should match 'ok' }
5+
its(:exit_status) { should eq 0 }
6+
end
7+
end
8+
29
describe command('service hhvm pid | tr -d \'\n\'') do
310
# must not pid 0
411
its(:stdout) { should_not match %r!^0$! }

tests/serverspec/spec/shared/nginx/service.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
shared_examples 'nginx::service::running' do
2+
describe command("service nginx check") do
3+
it "should have running nginx daemon", :retry => 5, :retry_wait => 10 do
4+
its(:stdout) { should match 'ok' }
5+
its(:exit_status) { should eq 0 }
6+
end
7+
end
8+
29
describe command('service nginx pid | tr -d \'\n\'') do
310
# must not pid 0
411
its(:stdout) { should_not match %r!^0$! }

tests/serverspec/spec/shared/php/service.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
shared_examples 'php-fpm::service::running' do
2+
describe command("service php-fpm check") do
3+
it "should have running php-fpm daemon", :retry => 5, :retry_wait => 10 do
4+
its(:stdout) { should match 'ok' }
5+
its(:exit_status) { should eq 0 }
6+
end
7+
end
8+
29
describe command('service php-fpm pid | tr -d \'\n\'') do
310
# must not pid 0
411
its(:stdout) { should_not match %r!^0$! }

tests/serverspec/spec/shared/postfix/service.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
shared_examples 'postfix::service::running' do
2+
describe command("service postfix check") do
3+
it "should have running postfix daemon", :retry => 5, :retry_wait => 10 do
4+
its(:stdout) { should match 'ok' }
5+
its(:exit_status) { should eq 0 }
6+
end
7+
end
8+
29
describe command('service postfix pid | tr -d \'\n\'') do
310
# must not pid 0
411
its(:stdout) { should_not match %r!^0$! }

tests/serverspec/spec/shared/ssh/service.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
shared_examples 'ssh::service::running' do
2+
describe command("service ssh check") do
3+
it "should have running ssh daemon", :retry => 5, :retry_wait => 10 do
4+
its(:stdout) { should match 'ok' }
5+
its(:exit_status) { should eq 0 }
6+
end
7+
end
8+
29
describe command('service ssh pid | tr -d \'\n\'') do
310
# must not pid 0
411
its(:stdout) { should_not match %r!^0$! }

tests/serverspec/spec/shared/vsftp/service.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
shared_examples 'vsftp::service::running' do
2+
describe command("service vsftp check") do
3+
it "should have running vsftp daemon", :retry => 5, :retry_wait => 10 do
4+
its(:stdout) { should match 'ok' }
5+
its(:exit_status) { should eq 0 }
6+
end
7+
end
8+
29
describe command('service vsftp pid | tr -d \'\n\'') do
310
# must not pid 0
411
its(:stdout) { should_not match %r!^0$! }

0 commit comments

Comments
 (0)