Skip to content

Commit 88e6ca9

Browse files
authored
Merge pull request #186 from saz/cleanup-tests
cleanup test code for old OS releases
2 parents 6593f3a + 5a7036b commit 88e6ca9

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

spec/classes/powerdns_init_spec.rb

+7-19
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,9 @@
1717
authoritative_package_name = 'pdns'
1818
authoritative_service_name = 'pdns'
1919
authoritative_config = '/etc/pdns/pdns.conf'
20-
if facts[:os]['release']['major'].to_i == 7
21-
mysql_schema_file = '/usr/share/doc/pdns-backend-mysql-4.1.14/schema.mysql.sql'
22-
pgsql_schema_file = '/usr/share/doc/pdns-backend-postgresql-4.1.14/schema.pgsql.sql'
23-
sqlite_schema_file = '/usr/share/doc/pdns-backend-sqlite-4.1.14/schema.sqlite.sql'
24-
else
25-
mysql_schema_file = '/usr/share/doc/pdns-backend-mysql-4.8.1/schema.mysql.sql'
26-
pgsql_schema_file = '/usr/share/doc/pdns-backend-postgresql-4.8.1/schema.pgsql.sql'
27-
sqlite_schema_file = '/usr/share/doc/pdns-backend-sqlite-4.8.1/schema.sqlite.sql'
28-
end
20+
mysql_schema_file = '/usr/share/doc/pdns-backend-mysql-4.8.1/schema.mysql.sql'
21+
pgsql_schema_file = '/usr/share/doc/pdns-backend-postgresql-4.8.1/schema.pgsql.sql'
22+
sqlite_schema_file = '/usr/share/doc/pdns-backend-sqlite-4.8.1/schema.sqlite.sql'
2923
pgsql_backend_package_name = 'pdns-backend-postgresql'
3024
sqlite_backend_package_name = 'pdns-backend-sqlite'
3125
sqlite_binary_package_name = 'sqlite'
@@ -114,14 +108,13 @@
114108
it { is_expected.to contain_class('powerdns::repo') }
115109
case facts[:osfamily]
116110
when 'RedHat'
117-
it { is_expected.to contain_package('yum-plugin-priorities') } if facts[:operatingsystemmajrelease].to_i < 8
118-
it { is_expected.to contain_yumrepo('powertools') } if facts[:operatingsystemmajrelease].to_i >= 8
119-
if facts[:operatingsystem] != 'Rocky' && facts[:operatingsystemmajrelease].to_i >= 8
111+
it { is_expected.to contain_yumrepo('powertools') }
112+
if facts[:operatingsystem] != 'Rocky'
120113
it {
121114
is_expected.to contain_yumrepo('powertools').with('mirrorlist' => 'http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=PowerTools&infra=$infra')
122115
}
123116
end
124-
if facts[:operatingsystem] == 'Rocky' && facts[:operatingsystemmajrelease].to_i >= 8
117+
if facts[:operatingsystem] == 'Rocky'
125118
it {
126119
is_expected.to contain_yumrepo('powertools').with('mirrorlist' => 'https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=PowerTools-$releasever')
127120
}
@@ -139,12 +132,7 @@
139132
it { is_expected.to contain_apt__source('powerdns').with_release(%r{auth-48}) }
140133
it { is_expected.to contain_apt__source('powerdns-recursor') }
141134
it { is_expected.to contain_apt__source('powerdns-recursor').with_release(%r{rec-49}) }
142-
143-
# On Ubuntu 17.04 and higher and Debian 9 and higher it expects dirmngr
144-
if (facts[:operatingsystem] == 'Ubuntu' && facts[:operatingsystemmajrelease].to_i >= 17) ||
145-
(facts[:operatingsystem] == 'Debian' && facts[:operatingsystemmajrelease].to_i >= 9)
146-
it { is_expected.to contain_package('dirmngr') }
147-
end
135+
it { is_expected.to contain_package('dirmngr') }
148136
end
149137

150138
# Check the authoritative server

0 commit comments

Comments
 (0)