mirror of
https://github.com/saltstack-formulas/packages-formula.git
synced 2025-04-16 17:50:24 +00:00
test: fix existing tests
This commit is contained in:
parent
1755f76fde
commit
8e75c9d5c0
4 changed files with 25 additions and 27 deletions
|
@ -16,7 +16,7 @@ control 'Wanted/Required npm packages' do
|
|||
desc '(only testing in the Debian platform, as the node-formula dependency is too specific)'
|
||||
|
||||
only_if do
|
||||
os.name == 'debian'
|
||||
platform.name == 'debian'
|
||||
end
|
||||
|
||||
describe directory(npms_path) do
|
||||
|
@ -39,7 +39,7 @@ control 'Unwanted npm packages' do
|
|||
desc '(only testing in the Debian platform, as the node-formula dependency is too specific)'
|
||||
|
||||
only_if do
|
||||
os.name == 'debian'
|
||||
platform.name == 'debian'
|
||||
end
|
||||
|
||||
%w{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
### WANTED/REQUIRED
|
||||
case os[:name]
|
||||
when 'fedora', 'opensuse'
|
||||
case platform[:family]
|
||||
when 'fedora', 'suse'
|
||||
wanted_pips = []
|
||||
else
|
||||
wanted_pips = %w{
|
||||
|
|
|
@ -7,9 +7,9 @@ common_packages = %w(
|
|||
fail2ban
|
||||
)
|
||||
|
||||
case os[:name]
|
||||
when 'redhat', 'centos'
|
||||
os_packages = %w(yum-plugin-versionlock)
|
||||
case platform[:family]
|
||||
when 'redhat'
|
||||
platform_packages = %w(yum-plugin-versionlock)
|
||||
held_packages = {
|
||||
# We use this test for held packages in a list,
|
||||
# with no version (current version).
|
||||
|
@ -18,11 +18,11 @@ when 'redhat', 'centos'
|
|||
}
|
||||
lock_file = '/etc/yum/pluginconf.d/versionlock.list'
|
||||
when 'fedora'
|
||||
case os[:release]
|
||||
case platform[:release]
|
||||
when '29'
|
||||
os_packages = ['python2-dnf-plugin-versionlock']
|
||||
platform_packages = ['python2-dnf-plugin-versionlock']
|
||||
when '30'
|
||||
os_packages = ['python3-dnf-plugin-versionlock']
|
||||
platform_packages = ['python3-dnf-plugin-versionlock']
|
||||
end
|
||||
held_packages = {
|
||||
'alien': '8.95-8.fc29',
|
||||
|
@ -31,12 +31,12 @@ when 'fedora'
|
|||
lock_file = '/etc/dnf/plugins/versionlock.list'
|
||||
# Adding empty Suse entries, to get tests passing
|
||||
# Don't know the correct values to add here.
|
||||
when 'opensuse'
|
||||
os_packages = %w()
|
||||
when 'suse'
|
||||
platform_packages = %w()
|
||||
held_packages = {}
|
||||
lock_file = ''
|
||||
when 'debian', 'ubuntu'
|
||||
os_packages = %w()
|
||||
when 'debian'
|
||||
platform_packages = %w()
|
||||
held_packages = {
|
||||
'alien': '8.95',
|
||||
# To match also ubuntu16's
|
||||
|
@ -45,14 +45,14 @@ when 'debian', 'ubuntu'
|
|||
lock_file = '/var/lib/dpkg/status'
|
||||
when 'amazon'
|
||||
common_packages.delete('fail2ban')
|
||||
os_packages = ['git']
|
||||
platform_packages = ['git']
|
||||
held_packages = []
|
||||
end
|
||||
|
||||
## FIXME - not testing Held packages
|
||||
held_packages = {}
|
||||
|
||||
unheld_packages = (common_packages + os_packages).flatten.uniq
|
||||
unheld_packages = (common_packages + platform_packages).flatten.uniq
|
||||
all_packages = (unheld_packages + held_packages.keys.map { |k| k.to_s }).flatten.uniq
|
||||
|
||||
### WANTED/REQUIRED/HELD
|
||||
|
@ -71,13 +71,13 @@ control 'Wanted packages' do
|
|||
title 'should NOT be marked as hold'
|
||||
|
||||
unheld_packages.each do |p,v|
|
||||
case os[:name]
|
||||
when 'redhat', 'centheld_packagesheld_packagesos', 'fedora'
|
||||
case platform[:family]
|
||||
when 'redhat', 'fedora'
|
||||
match_string = "#{p}-.*#{v}"
|
||||
describe file(lock_file) do
|
||||
its('content') { should_not match(match_string) }
|
||||
end
|
||||
when 'debian', 'ubuntu'
|
||||
when 'debian'
|
||||
match_string = "^Package: #{p}\nStatus: install ok installed"
|
||||
describe file(lock_file) do
|
||||
its('content') { should match(match_string) }
|
||||
|
@ -91,10 +91,10 @@ control 'Held packages' do
|
|||
title 'should be marked as hold'
|
||||
|
||||
held_packages.each do |p,v|
|
||||
case os[:name]
|
||||
when 'redhat', 'centos', 'fedora'
|
||||
case platform[:family]
|
||||
when 'redhat', 'fedora'
|
||||
match_string = "#{p}-.*#{v}"
|
||||
when 'debian', 'ubuntu'
|
||||
when 'debian'
|
||||
match_string = "^Package: #{p}\nStatus: hold ok installed\nP.*\nS.*\nI.*\nM.*\nA.*\nVersion: #{v}"
|
||||
end
|
||||
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
### REMOTE PKGS
|
||||
remote_pkgs = ['zoom']
|
||||
|
||||
case os[:name]
|
||||
when 'opensuse'
|
||||
case platform[:family]
|
||||
when 'suse'
|
||||
remote_pkgs = []
|
||||
end
|
||||
|
||||
control 'Remote packages' do
|
||||
title 'should be downloaded and installed'
|
||||
|
||||
%w{
|
||||
zoom
|
||||
}.each do |p|
|
||||
remote_pkgs.each do |p|
|
||||
describe package(p) do
|
||||
it { should be_installed }
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue