-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(inspec): provide tests for the repo package and config
- Loading branch information
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# frozen_string_literal: true | ||
|
||
control 'epel repo configuration' do | ||
title 'should match desired lines' | ||
|
||
epel_version = | ||
case platform[:name] | ||
when 'amazon' | ||
case platform[:release] | ||
when '2' | ||
'7' | ||
when '2018.03' | ||
'6' | ||
end | ||
when 'centos' | ||
platform[:release][0] | ||
end | ||
|
||
describe file("/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-#{epel_version}") do | ||
it { should be_file } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into 'root' } | ||
its('mode') { should cmp '0644' } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
control 'epel package' do | ||
title 'should be installed' | ||
|
||
pkg = 'epel-release' | ||
version = | ||
case platform[:name] | ||
when 'amazon' | ||
case platform[:release] | ||
when '2' | ||
'7-12' | ||
when '2018.03' | ||
'6-8' | ||
end | ||
when 'centos' | ||
if platform[:release].start_with?('8') | ||
'8-7.el8' | ||
elsif platform[:release].start_with?('7') | ||
'7-12' | ||
elsif platform[:release].start_with?('6') | ||
'6-8' | ||
end | ||
end | ||
|
||
describe package(pkg) do | ||
it { should be_installed } | ||
its('version') { should eq version } | ||
end | ||
end |