Skip to content

Commit

Permalink
test(packages_spec): generalise version number verification [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
myii committed Jul 10, 2020
1 parent b83c7a0 commit e4952f0
Showing 1 changed file with 5 additions and 31 deletions.
36 changes: 5 additions & 31 deletions test/integration/default/controls/packages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,12 @@
end
version =
case platform[:name]
when 'debian'
if os[:release].start_with?('10')
'1:4.4.9-1+buster'
elsif os[:release].start_with?('9')
'1:4.4.9-1+stretch'
elsif os[:release].start_with?('8')
'1:4.4.9-1+jessie'
end
when 'ubuntu'
if os[:release].start_with?('20')
'1:4.4.9-1+focal'
elsif os[:release].start_with?('18')
'1:4.4.9-1+bionic'
elsif os[:release].start_with?('16')
'1:4.4.9-1+xenial'
end
when 'debian', 'ubuntu'
'1:4.4'
when 'centos'
if os[:release].start_with?('8')
'4.4.9-1.el8'
elsif os[:release].start_with?('7')
'4.4.9-1.el7'
elsif os[:release].start_with?('6')
'4.4.9-1.el6'
end
'4.4'
when 'fedora'
if os[:release].start_with?('32')
'4.0.16-2.fc32'
elsif os[:release].start_with?('31')
'4.0.15-1.fc31'
elsif os[:release].start_with?('30')
'4.0.15-1.fc30'
end
'4.0'
end

control 'zabbix packages' do
Expand All @@ -55,7 +29,7 @@
].each do |p|
describe package(p) do
it { should be_installed }
its('version') { should eq version }
its('version') { should match(/^#{version}/) }
end
end
end

0 comments on commit e4952f0

Please sign in to comment.