Skip to content

Commit 3d67c35

Browse files
committed
Switch to new test syntax
1 parent f5a1e6b commit 3d67c35

File tree

10 files changed

+97
-99
lines changed

10 files changed

+97
-99
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
shared_examples 'apache::service::running' do
2-
describe command("service apache check") do
2+
describe "service apache check" do
33
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 }
4+
cmd = command("service apache check")
5+
expect(cmd.stdout).to match('ok')
6+
expect(cmd.exit_status).to eq 0
67
end
78
end
89

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
shared_examples 'dovecot::service::running' do
2-
describe command("service dovecot check") do
2+
describe "service dovecot check" do
33
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 }
4+
cmd = command("service dovecot check")
5+
expect(cmd.stdout).to match('ok')
6+
expect(cmd.exit_status).to eq 0
67
end
78
end
89

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
shared_examples 'hhvm::service::running' do
2-
describe command("service hhvm check") do
2+
describe "service hhvm check" do
33
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 }
4+
cmd = command("service hhvm check")
5+
expect(cmd.stdout).to match('ok')
6+
expect(cmd.exit_status).to eq 0
67
end
78
end
89

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
shared_examples 'nginx::service::running' do
2-
describe command("service nginx check") do
2+
describe "service nginx check" do
33
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 }
4+
cmd = command("service nginx check")
5+
expect(cmd.stdout).to match('ok')
6+
expect(cmd.exit_status).to eq 0
67
end
78
end
89

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
shared_examples 'php-fpm::service::running' do
2-
describe command("service php-fpm check") do
2+
describe "service php-fpm check" do
33
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 }
4+
cmd = command("service php-fpm check")
5+
expect(cmd.stdout).to match('ok')
6+
expect(cmd.exit_status).to eq 0
67
end
78
end
89

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

Lines changed: 61 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,16 @@
3535
'http://localhost/php-test.php?test=sha1',
3636
'https://localhost/php-test.php?test=sha1'
3737
].each do |url|
38-
describe command("curl --insecure --silent --retry 10 --fail #{url}") do
39-
it "should have running and answering webserver and php app server", :retry => 5, :retry_wait => 10 do
40-
its(:stdout) { should_not contain('PHP Notice') }
41-
its(:stdout) { should_not contain('Notice') }
42-
its(:stdout) { should_not contain('PHP Warning') }
43-
its(:stderr) { should_not contain('PHP Notice') }
44-
its(:stderr) { should_not contain('Notice') }
45-
its(:stderr) { should_not contain('PHP Warning') }
46-
47-
its(:stdout) { should contain('2ae62521966cf6d4188acefc943c903e5fc0a25c') }
48-
49-
its(:exit_status) { should eq 0 }
38+
describe url do
39+
it "should have running and answering webserver", :retry => 5, :retry_wait => 10 do
40+
cmd = command("curl --insecure --silent --retry 10 --fail #{url}")
41+
expect(cmd.stdout).not_to contain('PHP Notice')
42+
expect(cmd.stdout).not_to contain('Notice')
43+
expect(cmd.stdout).not_to contain('PHP Warning')
44+
expect(cmd.stdout).not_to contain('Warning')
45+
expect(cmd.stdout).not_to contain('Fatal Error')
46+
expect(cmd.stdout).to contain('2ae62521966cf6d4188acefc943c903e5fc0a25c')
47+
expect(cmd.exit_status).to eq 0
5048
end
5149
end
5250
end
@@ -57,18 +55,16 @@
5755
'http://localhost/php-test.php?test=php_sapi_name',
5856
'https://localhost/php-test.php?test=php_sapi_name'
5957
].each do |url|
60-
describe command("curl --insecure --silent --retry 10 --fail #{url}") do
61-
it "should have running and answering webserver and php app server", :retry => 5, :retry_wait => 10 do
62-
its(:stdout) { should_not contain('PHP Notice') }
63-
its(:stdout) { should_not contain('Notice') }
64-
its(:stdout) { should_not contain('PHP Warning') }
65-
its(:stderr) { should_not contain('PHP Notice') }
66-
its(:stderr) { should_not contain('Notice') }
67-
its(:stderr) { should_not contain('PHP Warning') }
68-
69-
its(:stdout) { should contain('fpm-fcgi') }
70-
71-
its(:exit_status) { should eq 0 }
58+
describe url do
59+
it "should have running and answering webserver", :retry => 5, :retry_wait => 10 do
60+
cmd = command("curl --insecure --silent --retry 10 --fail #{url}")
61+
expect(cmd.stdout).not_to contain('PHP Notice')
62+
expect(cmd.stdout).not_to contain('Notice')
63+
expect(cmd.stdout).not_to contain('PHP Warning')
64+
expect(cmd.stdout).not_to contain('Warning')
65+
expect(cmd.stdout).not_to contain('Fatal Error')
66+
expect(cmd.stdout).to contain('fpm-fcgi')
67+
expect(cmd.exit_status).to eq 0
7268
end
7369
end
7470
end
@@ -80,18 +76,17 @@
8076
'http://localhost/php-test.php?test=php_ini_scanned_files',
8177
'https://localhost/php-test.php?test=php_ini_scanned_files'
8278
].each do |url|
83-
describe command("curl --insecure --silent --retry 10 --fail #{url}") do
84-
it "should have running and answering webserver and php app server", :retry => 5, :retry_wait => 10 do
85-
its(:stdout) { should_not contain('PHP Notice') }
86-
its(:stdout) { should_not contain('Notice') }
87-
its(:stdout) { should_not contain('PHP Warning') }
88-
its(:stderr) { should_not contain('PHP Notice') }
89-
its(:stderr) { should_not contain('Notice') }
90-
its(:stderr) { should_not contain('PHP Warning') }
91-
its(:stdout) { should contain('-docker.ini') }
92-
its(:stdout) { should contain('-webdevops.ini') }
93-
94-
its(:exit_status) { should eq 0 }
79+
describe url do
80+
it "should have running and answering webserver", :retry => 5, :retry_wait => 10 do
81+
cmd = command("curl --insecure --silent --retry 10 --fail #{url}")
82+
expect(cmd.stdout).not_to contain('PHP Notice')
83+
expect(cmd.stdout).not_to contain('Notice')
84+
expect(cmd.stdout).not_to contain('PHP Warning')
85+
expect(cmd.stdout).not_to contain('Warning')
86+
expect(cmd.stdout).not_to contain('Fatal Error')
87+
expect(cmd.stdout).to contain('-docker.ini')
88+
expect(cmd.stdout).to contain('-webdevops.ini')
89+
expect(cmd.exit_status).to eq 0
9590
end
9691
end
9792
end
@@ -102,18 +97,16 @@
10297
'http://localhost/php-test.php?test=version',
10398
'https://localhost/php-test.php?test=version'
10499
].each do |url|
105-
describe command("curl --insecure --silent --retry 10 --fail #{url}") do
106-
it "should have running and answering webserver and php app server", :retry => 5, :retry_wait => 10 do
107-
its(:stdout) { should_not contain('PHP Notice') }
108-
its(:stdout) { should_not contain('Notice') }
109-
its(:stdout) { should_not contain('PHP Warning') }
110-
its(:stderr) { should_not contain('PHP Notice') }
111-
its(:stderr) { should_not contain('Notice') }
112-
its(:stderr) { should_not contain('PHP Warning') }
113-
114-
its(:stdout) { should match %r!PHP 5\.[3-9]\.[0-9]{1,2}(-[^\(]*)?! }
115-
116-
its(:exit_status) { should eq 0 }
100+
describe url do
101+
it "should have running and answering webserver", :retry => 5, :retry_wait => 10 do
102+
cmd = command("curl --insecure --silent --retry 10 --fail #{url}")
103+
expect(cmd.stdout).not_to contain('PHP Notice')
104+
expect(cmd.stdout).not_to contain('Notice')
105+
expect(cmd.stdout).not_to contain('PHP Warning')
106+
expect(cmd.stdout).not_to contain('Warning')
107+
expect(cmd.stdout).not_to contain('Fatal Error')
108+
expect(cmd.stdout).to match %r!PHP 5\.[3-9]\.[0-9]{1,2}(-[^\(]*)?!
109+
expect(cmd.exit_status).to eq 0
117110
end
118111
end
119112
end
@@ -124,18 +117,16 @@
124117
'http://localhost/php-test.php?test=version',
125118
'https://localhost/php-test.php?test=version'
126119
].each do |url|
127-
describe command("curl --insecure --silent --retry 10 --fail #{url}") do
128-
it "should have running and answering webserver and php app server", :retry => 5, :retry_wait => 10 do
129-
its(:stdout) { should_not contain('PHP Notice') }
130-
its(:stdout) { should_not contain('Notice') }
131-
its(:stdout) { should_not contain('PHP Warning') }
132-
its(:stderr) { should_not contain('PHP Notice') }
133-
its(:stderr) { should_not contain('Notice') }
134-
its(:stderr) { should_not contain('PHP Warning') }
135-
136-
its(:stdout) { should match %r!PHP 7\.[0-9]\.[0-9]{1,2}(-[^\(]*)?! }
137-
138-
its(:exit_status) { should eq 0 }
120+
describe url do
121+
it "should have running and answering webserver", :retry => 5, :retry_wait => 10 do
122+
cmd = command("curl --insecure --silent --retry 10 --fail #{url}")
123+
expect(cmd.stdout).not_to contain('PHP Notice')
124+
expect(cmd.stdout).not_to contain('Notice')
125+
expect(cmd.stdout).not_to contain('PHP Warning')
126+
expect(cmd.stdout).not_to contain('Warning')
127+
expect(cmd.stdout).not_to contain('Fatal Error')
128+
expect(cmd.stdout).to match %r!PHP 7\.[0-9]\.[0-9]{1,2}(-[^\(]*)?!
129+
expect(cmd.exit_status).to eq 0
139130
end
140131
end
141132
end
@@ -146,18 +137,16 @@
146137
'http://localhost/php-test.php?test=process_user_id',
147138
'https://localhost/php-test.php?test=process_user_id'
148139
].each do |url|
149-
describe command("curl --insecure --silent --retry 10 --fail #{url}") do
150-
it "should have running and answering webserver and php app server", :retry => 5, :retry_wait => 10 do
151-
its(:stdout) { should_not contain('PHP Notice') }
152-
its(:stdout) { should_not contain('Notice') }
153-
its(:stdout) { should_not contain('PHP Warning') }
154-
its(:stderr) { should_not contain('PHP Notice') }
155-
its(:stderr) { should_not contain('Notice') }
156-
its(:stderr) { should_not contain('PHP Warning') }
157-
158-
its(:stdout) { should contain('UID:1000#') }
159-
160-
its(:exit_status) { should eq 0 }
140+
describe url do
141+
it "should have running and answering webserver", :retry => 5, :retry_wait => 10 do
142+
cmd = command("curl --insecure --silent --retry 10 --fail #{url}")
143+
expect(cmd.stdout).not_to contain('PHP Notice')
144+
expect(cmd.stdout).not_to contain('Notice')
145+
expect(cmd.stdout).not_to contain('PHP Warning')
146+
expect(cmd.stdout).not_to contain('Warning')
147+
expect(cmd.stdout).not_to contain('Fatal Error')
148+
expect(cmd.stdout).to contain('UID:1000#')
149+
expect(cmd.exit_status).to eq 0
161150
end
162151
end
163152
end

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
shared_examples 'postfix::service::running' do
2-
describe command("service postfix check") do
2+
describe "service postfix check" do
33
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 }
4+
cmd = command("service postfix check")
5+
expect(cmd.stdout).to match('ok')
6+
expect(cmd.exit_status).to eq 0
67
end
78
end
89

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
shared_examples 'ssh::service::running' do
2-
describe command("service ssh check") do
2+
describe "service ssh check" do
33
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 }
4+
cmd = command("service ssh check")
5+
expect(cmd.stdout).to match('ok')
6+
expect(cmd.exit_status).to eq 0
67
end
78
end
89

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
shared_examples 'vsftp::service::running' do
2-
describe command("service vsftp check") do
2+
describe "service vsftp check" do
33
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 }
4+
cmd = command("service vsftp check")
5+
expect(cmd.stdout).to match('ok')
6+
expect(cmd.exit_status).to eq 0
67
end
78
end
89

tests/serverspec/spec/shared/web/test.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
'http://localhost/pi-number.html',
44
'https://localhost/pi-number.html'
55
].each do |url|
6-
describe command("curl --insecure --silent --retry 10 --fail #{url}") do
6+
describe url do
77
it "should have running and answering webserver", :retry => 5, :retry_wait => 10 do
8-
its(:stdout) { should contain('3.14159265359') }
9-
its(:exit_status) { should eq 0 }
8+
cmd = command("curl --insecure --silent --retry 10 --fail #{url}")
9+
expect(cmd.stdout).to contain('3.14159265359')
10+
expect(cmd.exit_status).to eq 0
1011
end
1112
end
1213
end

0 commit comments

Comments
 (0)