|
3 | 3 | require 'spec_helper_acceptance' |
4 | 4 |
|
5 | 5 | describe 'nginx::resource::mailhost define:' do |
6 | | - has_recent_mail_module = true |
7 | | - |
8 | | - if fact('os.family') == 'RedHat' && fact('os.release.major') == '8' |
9 | | - # EPEL had recent nginx-mod-mail package for CentOS 7 but not CentOS 8 |
10 | | - # Stream. The base packages use an older version of nginx that does not |
11 | | - # work with the acceptance test configuration. |
12 | | - has_recent_mail_module = false |
13 | | - end |
| 6 | + has_recent_mail_module = fact('os.family') != 'RedHat' || fact('os.release.major') != '8' |
14 | 7 |
|
15 | 8 | it 'remove leftovers from previous tests', if: fact('os.family') == 'RedHat' do |
16 | | - shell('yum -y remove nginx nginx-filesystem passenger') |
17 | 9 | # nginx-mod-mail is not available for all versions of nginx, the one |
18 | 10 | # installed might be incompatible with the version of nginx-mod-mail we are |
19 | 11 | # about to install so clean everything. |
|
26 | 18 | } |
27 | 19 | " |
28 | 20 | apply_manifest(pp, catch_failures: true) |
| 21 | + shell('yum -y remove nginx nginx-filesystem passenger nginx-mod-mail') |
| 22 | + shell('yum clean all') |
29 | 23 | end |
30 | 24 |
|
31 | 25 | context 'actualy test the mail module', if: has_recent_mail_module do |
32 | 26 | it 'runs successfully' do |
33 | 27 | pp = " |
34 | | - if fact('os.family') == 'RedHat' { |
35 | | - package { 'nginx-mod-mail': |
36 | | - ensure => installed, |
37 | | - } |
38 | | - } |
39 | | -
|
40 | 28 | class { 'nginx': |
41 | 29 | mail => true, |
42 | | - dynamic_modules => fact('os.family') ? { |
43 | | - 'RedHat' => ['/usr/lib64/nginx/modules/ngx_mail_module.so'], |
44 | | - default => [], |
45 | | - } |
46 | 30 | } |
47 | 31 | nginx::resource::mailhost { 'domain1.example': |
48 | 32 | ensure => present, |
@@ -79,45 +63,5 @@ class { 'nginx': |
79 | 63 | describe port(465) do |
80 | 64 | it { is_expected.to be_listening } |
81 | 65 | end |
82 | | - |
83 | | - context 'when configured for nginx 1.14', if: !%w[Debian Archlinux].include?(fact('os.family')) do |
84 | | - it 'runs successfully' do |
85 | | - pp = " |
86 | | - if fact('os.family') == 'RedHat' { |
87 | | - package { 'nginx-mod-mail': |
88 | | - ensure => installed, |
89 | | - } |
90 | | - } |
91 | | -
|
92 | | - class { 'nginx': |
93 | | - mail => true, |
94 | | - nginx_version => '1.14.0', |
95 | | - dynamic_modules => fact('os.family') ? { |
96 | | - 'RedHat' => ['/usr/lib64/nginx/modules/ngx_mail_module.so'], |
97 | | - default => [], |
98 | | - } |
99 | | - } |
100 | | - nginx::resource::mailhost { 'domain1.example': |
101 | | - ensure => present, |
102 | | - auth_http => 'localhost/cgi-bin/auth', |
103 | | - protocol => 'smtp', |
104 | | - listen_port => 587, |
105 | | - ssl => true, |
106 | | - ssl_port => 465, |
107 | | - ssl_cert => '/etc/pki/tls/certs/blah.cert', |
108 | | - ssl_key => '/etc/pki/tls/private/blah.key', |
109 | | - xclient => 'off', |
110 | | - } |
111 | | - " |
112 | | - |
113 | | - apply_manifest(pp, catch_failures: true) |
114 | | - end |
115 | | - |
116 | | - describe file('/etc/nginx/conf.mail.d/domain1.example.conf') do |
117 | | - it 'does\'t contain `ssl` on `listen` line' do |
118 | | - is_expected.to contain 'listen *:465;' |
119 | | - end |
120 | | - end |
121 | | - end |
122 | 66 | end |
123 | 67 | end |
0 commit comments