Skip to content

Commit

Permalink
Enable and add CentOS 8 accept tests
Browse files Browse the repository at this point in the history
Correct acceptence tests for DNF (8) system

Use the new versionlock specification from voxpupuli#169 on CentOS 8.

Also test the new specification on 7 and 8 also.

Finally test that if samba-devel is filtered at
an impossible version it is no longer available.

This for the yum case probably assumes that samba-devel is not
  • Loading branch information
traylenator committed May 18, 2020
1 parent aa9b065 commit b04992c
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 9 deletions.
1 change: 1 addition & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
docker_sets:
- set: centos6-64
- set: centos7-64
- set: centos8-64
secure: "iItNJ/PlMvdSiYjtXWJkS69mF/4XUriTRC6axFoiTgX8BzGNWA1U/anENNyzmhRKcH/Nc0erVeau+RX8vyJ0HmIJOCvYfq5Q/SQWex1fDXLe/UYJkAEWwmeIOVSF2nTEUPDvDn/d6bNEdULw5yrNn1dT8eLqIIXl6/nThdpiS917BX6CeYdojr/mISrLsvihuB5DQRdVzH+hK1bXcECihnOfNH9lQ0lZ2v2ohJiLJL0DadDg0YMMeJMlP7CnBZzRs7fhTPdLMjzCvysef9nqBYRlGBRUn+CaQ4VoQZlWB1JchJup4qCGeU9ANkb8gdKYTy1kFkBrEDuqlUUuuTTMhDpQ+2fGF32zgnXCSnVY8AIriFfO9c1ljxL6k6vaHpfnsPcMrxuQXNeOPGYpVjNGi/Hz8OjuZ3IT07c8SmZgmGaNp+ZIKErJQV0eob0NeA/1P7HheRS5aPEiN8vj/ZGuIGa+BhbTp2riJ599urrSqGDcJ0YzNeW2BvBZQoXs953X4N4yROz4xKMNqPz/jhyGM9w5SBJ/uLiIvKTu+bSsJ2VNyrOOu25eYqzH1zKc71fKiWa1ZOTHKVM24chlmoq3tZTSpSn6OxpptKLxAYZG0IUdFSMy66m8nss1AxL2djScAptugsqpfLqziMArAoN9iWXCeGiWz1qLRl+5AlMrmMY="
spec/spec_helper_acceptance.rb:
unmanaged: false
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ matrix:
bundler_args: --without development release
env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=centos7-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=centos8-64 CHECK=beaker
services: docker
- rvm: 2.5.3
bundler_args: --without development release
env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=centos8-64 CHECK=beaker
services: docker
branches:
only:
- master
Expand Down
65 changes: 56 additions & 9 deletions spec/acceptance/define_versionlock_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,53 @@
# Using puppet_apply as a helper
it 'must work idempotently with no errors' do
pp = <<-EOS
yum::versionlock{ '0:bash-4.1.2-9.el6_2.*':
ensure => present,
if versioncmp($facts['os']['release']['major'],'7') <= 0 {
yum::versionlock{ '0:bash-4.1.2-9.el6_2.*':
ensure => present,
}
yum::versionlock{ '0:tcsh-3.1.2-9.el6_2.*':
ensure => present,
}
} else {
yum::versionlock{ 'bash':
ensure => present,
version => '4.1.2',
release => '9.el6_2',
}
yum::versionlock{ 'tcsh':
ensure => present,
version => '3.1.2',
release => '9.el6_2',
arch => '*',
epoch => 0,
}
}
yum::versionlock{ '0:tcsh-3.1.2-9.el6_2.*':
ensure => present,
# Lock a package with new style on all OSes
yum::versionlock{ 'netscape':
ensure => present,
version => '8.1.2',
release => '9.el6_2',
arch => '*',
epoch => 2,
}
EOS
# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
describe file('/etc/yum/pluginconf.d/versionlock.list') do
it { is_expected.to be_file }
it { is_expected.to contain '0:bash-4.1.2-9.el6_2.*' }
it { is_expected.to contain '0:tcsh-3.1.2-9.el6_2.*' }
if %w[6 7].include?(fact('os.release.major'))
it { is_expected.to contain '0:bash-4.1.2-9.el6_2.*' }
it { is_expected.to contain '0:tcsh-3.1.2-9.el6_2.*' }
it { is_expected.to contain '2:netscape-8.1.2-9.el6_2.*' }
else
it { is_expected.to contain 'bash-0:4.1.2-9.el6_2.*' }
it { is_expected.to contain 'tcsh-0:3.1.2-9.el6_2.*' }
it { is_expected.to contain 'netscape-2:8.1.2-9.el6_2.*' }
end
end
end
it 'must work if clean is specified' do
Expand All @@ -28,15 +60,30 @@
class{yum::plugin::versionlock:
clean => true,
}
yum::versionlock{ '0:bash-3.1.2-9.el6_2.*':
ensure => present,
# Pick an obscure package that hopefully will not be installed.
if versioncmp($facts['os']['release']['major'],'7') <= 0 {
yum::versionlock{ '0:samba-devel-3.1.2-9.el6_2.*':
ensure => present,
}
} else {
yum::versionlock{'samba-devel':
ensure => present,
version => '3.1.2',
release => '9.el6_2',
}
}
EOS
# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
# Check the cache is really empty.
# all repos will have 0 packages.
shell('yum -C repolist -d0 | grep -v "repo id" | awk "{print $NF}" FS= | grep -v 0', acceptable_exit_codes: [1])
# bit confused by the motivation of the first test?
if %w[6 7].include?(fact('os.release.major'))
shell('yum -C repolist -d0 | grep -v "repo id" | awk "{print $NF}" FS= | grep -v 0', acceptable_exit_codes: [1])
shell('yum -q list available samba-devel', acceptable_exit_codes: [1])
else
shell('dnf -q list --available samba-devel', acceptable_exit_codes: [1])
end
end
end

0 comments on commit b04992c

Please sign in to comment.