Skip to content

Commit 577f7b2

Browse files
committed
Replace all bat integration tests with serverspec tests
1 parent bf67cb4 commit 577f7b2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+666
-549
lines changed

.kitchen.docker.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ platforms:
2929
driver_config:
3030
privileged: true
3131
run_command: /sbin/init
32+
- name: fedora-23
33+
- name: fedora-24
34+
- name: fedora-25
3235

3336
# Non-official images with systemd
3437
- name: scientific-6.6

.kitchen.ses.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
suites:
22
- name: default
3-
run_list:
4-
- recipe[postfix-dovecot_test]
5-
attributes: { }
3+
run_list: recipe[postfix-dovecot_test]
64
- name: ses
75
run_list:
8-
- recipe[minitest-handler]
9-
- recipe[postfix-dovecot_test]
6+
- recipe[minitest-handler]
7+
- recipe[postfix-dovecot_test]
108
attributes:
119
postfix-dovecot:
1210
ses:

.travis.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ services: docker
99
env:
1010
matrix:
1111
- TESTS="style unit" CHEF_VERSION="~> 12.0"
12-
- TESTS="integration[mysql-centos-5,verify]"
1312
- TESTS="integration[mysql-centos-6,verify]"
1413
- TESTS="integration[mysql-centos-7,verify]"
1514
- TESTS="integration[mysql-debian-7,verify]"
@@ -18,8 +17,10 @@ env:
1817
- TESTS="integration[mysql-ubuntu-1404,verify]"
1918
- TESTS="integration[mysql-ubuntu-1604,verify]"
2019
- TESTS="integration[mysql-ubuntu-1610,verify]"
20+
- TESTS="integration[mysql-fedora-23,verify]"
21+
- TESTS="integration[mysql-fedora-24,verify]"
22+
- TESTS="integration[mysql-fedora-25,verify]"
2123
- TESTS="integration[mysql-scientific-66,verify]"
22-
- TESTS="integration[postgresql-centos-5,verify]"
2324
- TESTS="integration[postgresql-centos-6,verify]"
2425
- TESTS="integration[postgresql-centos-7,verify]"
2526
- TESTS="integration[postgresql-debian-7,verify]"
@@ -28,22 +29,22 @@ env:
2829
- TESTS="integration[postgresql-ubuntu-1404,verify]"
2930
- TESTS="integration[postgresql-ubuntu-1604,verify]"
3031
- TESTS="integration[postgresql-ubuntu-1610,verify]"
32+
- TESTS="integration[postgresql-fedora-23,verify]"
33+
- TESTS="integration[postgresql-fedora-24,verify]"
34+
- TESTS="integration[postgresql-fedora-25,verify]"
3135
- TESTS="integration[postgresql-scientific-66,verify]"
32-
- TESTS="integration[postfixpgsql-centos-5,verify]"
33-
- TESTS="integration[postfixpgsql-centos-6,verify]"
34-
- TESTS="integration[postfixpgsql-centos-7,verify]"
3536
- TESTS="integration[postfixpgsql-debian-7,verify]"
3637
- TESTS="integration[postfixpgsql-debian-8,verify]"
3738
- TESTS="integration[postfixpgsql-ubuntu-1204,verify]"
3839
- TESTS="integration[postfixpgsql-ubuntu-1404,verify]"
3940
- TESTS="integration[postfixpgsql-ubuntu-1604,verify]"
4041
- TESTS="integration[postfixpgsql-ubuntu-1610,verify]"
42+
- TESTS="integration[postfixpgsql-fedora-24,verify]"
43+
- TESTS="integration[postfixpgsql-fedora-25,verify]"
4144
- TESTS="integration[postfixpgsql-scientific-66,verify]"
4245

4346
matrix:
4447
exclude:
45-
- rvm: 2.2
46-
env: TESTS="integration[mysql-centos-5,verify]"
4748
- rvm: 2.2
4849
env: TESTS="integration[mysql-centos-6,verify]"
4950
- rvm: 2.2
@@ -61,9 +62,13 @@ matrix:
6162
- rvm: 2.2
6263
env: TESTS="integration[mysql-ubuntu-1610,verify]"
6364
- rvm: 2.2
64-
env: TESTS="integration[mysql-scientific-66,verify]"
65+
env: TESTS="integration[mysql-fedora-23,verify]"
66+
- rvm: 2.2
67+
env: TESTS="integration[mysql-fedora-24,verify]"
6568
- rvm: 2.2
66-
env: TESTS="integration[postgresql-centos-5,verify]"
69+
env: TESTS="integration[mysql-fedora-25,verify]"
70+
- rvm: 2.2
71+
env: TESTS="integration[mysql-scientific-66,verify]"
6772
- rvm: 2.2
6873
env: TESTS="integration[postgresql-centos-6,verify]"
6974
- rvm: 2.2
@@ -81,13 +86,13 @@ matrix:
8186
- rvm: 2.2
8287
env: TESTS="integration[postgresql-ubuntu-1610,verify]"
8388
- rvm: 2.2
84-
env: TESTS="integration[postgresql-scientific-66,verify]"
89+
env: TESTS="integration[postgresql-fedora-23,verify]"
8590
- rvm: 2.2
86-
env: TESTS="integration[postfixpgsql-centos-5,verify]"
91+
env: TESTS="integration[postgresql-fedora-24,verify]"
8792
- rvm: 2.2
88-
env: TESTS="integration[postfixpgsql-centos-6,verify]"
93+
env: TESTS="integration[postgresql-fedora-25,verify]"
8994
- rvm: 2.2
90-
env: TESTS="integration[postfixpgsql-centos-7,verify]"
95+
env: TESTS="integration[postgresql-scientific-66,verify]"
9196
- rvm: 2.2
9297
env: TESTS="integration[postfixpgsql-debian-7,verify]"
9398
- rvm: 2.2
@@ -100,6 +105,10 @@ matrix:
100105
env: TESTS="integration[postfixpgsql-ubuntu-1604,verify]"
101106
- rvm: 2.2
102107
env: TESTS="integration[postfixpgsql-ubuntu-1610,verify]"
108+
- rvm: 2.2
109+
env: TESTS="integration[postfixpgsql-fedora-24,verify]"
110+
- rvm: 2.2
111+
env: TESTS="integration[postfixpgsql-fedora-25,verify]"
103112
- rvm: 2.2
104113
env: TESTS="integration[postfixpgsql-scientific-66,verify]"
105114

test/cookbooks/postfix-dovecot_test/recipes/default.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@
1919
# limitations under the License.
2020
#
2121

22-
package 'rsyslog'
23-
service 'rsyslog' do
24-
action [:enable, :start]
25-
end
26-
2722
if node['postfix-dovecot']['database']['type'] == 'postgresql'
2823
include_recipe 'postfix-dovecot_test::postgresql_memory'
2924
end

test/integration/mysql/bats/dovecot.bats

Lines changed: 0 additions & 31 deletions
This file was deleted.

test/integration/mysql/bats/mysql.bats

Lines changed: 0 additions & 11 deletions
This file was deleted.

test/integration/mysql/bats/postfix.bats

Lines changed: 0 additions & 50 deletions
This file was deleted.

test/integration/mysql/bats/postfix_mysql.bats

Lines changed: 0 additions & 5 deletions
This file was deleted.

test/integration/mysql/bats/postfixadmin.bats

Lines changed: 0 additions & 5 deletions
This file was deleted.

test/integration/mysql/bats/spam.bats

Lines changed: 0 additions & 32 deletions
This file was deleted.

test/integration/mysql/serverspec/Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
source 'https://rubygems.org'
66

77
gem 'serverspec', '~> 2.0'
8+
gem 'infrataster', '~> 0.3.0'
9+
gem 'rspec-retry', '~> 0.5.0'

test/integration/mysql/serverspec/dovecot_spec.rb

Lines changed: 57 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,67 @@
1818
#
1919

2020
require 'spec_helper'
21+
require 'net/imap'
2122

22-
describe process('dovecot') do
23-
it { should be_running }
24-
end
23+
describe 'Dovecot' do
24+
describe command('doveconf') do
25+
its(:exit_status) { should eq 0 }
26+
its(:stderr) { should eq '' }
27+
end
2528

26-
# imap
27-
describe port(143) do
28-
it { should be_listening.with('tcp') }
29-
end
29+
describe process('dovecot') do
30+
it { should be_running }
31+
end
3032

31-
# imaps
32-
describe port(993) do
33-
it { should be_listening.with('tcp') }
34-
end
33+
# imap
34+
describe port(143) do
35+
it { should be_listening.with('tcp') }
36+
end
3537

36-
describe file('/etc/dovecot/sieve') do
37-
it { should be_directory }
38-
it { should be_mode 755 }
39-
it { should be_owned_by 'root' }
40-
it { should be_grouped_into 'root' }
41-
end
38+
# imaps
39+
describe port(993) do
40+
it { should be_listening.with('tcp') }
41+
end
4242

43-
describe file('/etc/dovecot/sieve/default.sieve') do
44-
it { should be_file }
45-
it { should be_mode 644 }
46-
it { should be_owned_by 'root' }
47-
it { should be_grouped_into 'root' }
48-
end
43+
it 'connects to imap SSL' do
44+
expect(
45+
command('echo | openssl s_client -connect 127.0.0.1:imaps')
46+
.exit_status
47+
).to eq 0
48+
end
49+
50+
it 'connects to imap with startls' do
51+
expect(
52+
command('echo | openssl s_client -starttls imap -connect 127.0.0.1:imap')
53+
.exit_status
54+
).to eq 0
55+
end
56+
57+
it 'is able to login using imap (plain)' do
58+
imap = Net::IMAP.new('localhost')
59+
imap.authenticate('PLAIN', '[email protected]', 'p0stm@st3r1')
60+
imap.examine('INBOX')
61+
imap.close
62+
end
63+
64+
describe file('/etc/dovecot/sieve') do
65+
it { should be_directory }
66+
it { should be_mode 755 }
67+
it { should be_owned_by 'root' }
68+
it { should be_grouped_into 'root' }
69+
end
70+
71+
describe file('/etc/dovecot/sieve/default.sieve') do
72+
it { should be_file }
73+
it { should be_mode 644 }
74+
it { should be_owned_by 'root' }
75+
it { should be_grouped_into 'root' }
76+
end
4977

50-
describe file('/etc/dovecot/sieve/default.svbin') do
51-
it { should be_file }
52-
it { should be_mode 644 }
53-
it { should be_owned_by 'root' }
54-
it { should be_grouped_into 'root' }
78+
describe file('/etc/dovecot/sieve/default.svbin') do
79+
it { should be_file }
80+
it { should be_mode 644 }
81+
it { should be_owned_by 'root' }
82+
it { should be_grouped_into 'root' }
83+
end
5584
end

0 commit comments

Comments
 (0)