Skip to content

Commit

Permalink
(SIMP-10056) resolv Add Puppet 7 acceptance test (#48)
Browse files Browse the repository at this point in the history
* Add a Puppet 7 acceptance test
* Remove check for Puppet >=6 in .fixtures.yml
* Fail acceptance tests if no examples are executed.
* Fixed a bug in the Augeas template
* Adjusted the tests to effect change on a switch to/from NetworkManager


Co-authored-by: Trevor Vaughan <tvaughan@onyxpoint.com>

[SIMP-9666] #comment pupmod-simp-resolv acceptance tests configured
SIMP-10056 #close
  • Loading branch information
lnemsick-simp authored Jul 1, 2021
1 parent cf2989f commit bbe0ab6
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 18 deletions.
8 changes: 2 additions & 6 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
---
fixtures:
repositories:
augeas_core:
repo: https://github.com/simp/pupmod-puppetlabs-augeas_core.git
puppet_version: ">= 6.0.0"
augeas_core: https://github.com/simp/pupmod-puppetlabs-augeas_core.git
compliance_markup: https://github.com/simp/pupmod-simp-compliance_markup.git
named: https://github.com/simp/pupmod-simp-named.git
rsync: https://github.com/simp/pupmod-simp-rsync.git
selinux_core:
repo: https://github.com/simp/pupmod-puppetlabs-selinux_core.git
puppet_version: ">= 6.0.0"
selinux_core: https://github.com/simp/pupmod-puppetlabs-selinux_core.git
stdlib: https://github.com/simp/puppetlabs-stdlib.git
simp_options: https://github.com/simp/pupmod-simp-simp_options.git
simplib: https://github.com/simp/pupmod-simp-simplib.git
Expand Down
6 changes: 6 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -362,3 +362,9 @@ pup6.pe-oel-fips:
<<: *with_SIMP_ACCEPTANCE_MATRIX_LEVEL_3
script:
- 'BEAKER_fips=yes bundle exec rake beaker:suites[default,oel]'

pup7.x:
<<: *pup_7_x
<<: *acceptance_base
script:
- 'bundle exec rake beaker:suites[default,default]'
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* Wed Jun 30 2021 Trevor Vaughan <tvaughan@onyxpoint.com> - 0.7.0
- Fixed a bug in the Augeas template
- Adjusted the tests to effect change on a switch to/from NetworkManager

* Wed Jun 16 2021 Chris Tessmer <chris.tessmer@onyxpoint.com> - 0.7.0
- Removed support for Puppet 5
- Ensured support for Puppet 7 in requirements and stdlib
Expand Down
12 changes: 6 additions & 6 deletions spec/acceptance/suites/default/00_default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
let(:manifest) do
<<~EOF
class { 'resolv':
servers => #{servers},
servers => #{servers.reverse},
search => ['simp.beaker', 'foo.bar', 'bar.baz'],
use_nmcli => false
}
Expand All @@ -40,9 +40,9 @@ class { 'resolv':
it 'should have a properly filled /etc/resolv.conf' do
expected_content = <<~EXPECTED
search simp.beaker foo.bar bar.baz
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 1.1.1.1
nameserver 8.8.4.4
nameserver 8.8.8.8
options attempts:2 ndots:1 rotate timeout:2
EXPECTED

Expand Down Expand Up @@ -216,7 +216,7 @@ class { 'resolv':
let(:manifest) do
<<~EOF
class { 'resolv':
servers => #{servers}
servers => #{servers.reverse}
}
EOF
end
Expand All @@ -233,9 +233,9 @@ class { 'resolv':
expected_content = <<~EXPECTED
# Generated by NetworkManager
search simp.beaker
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 1.1.1.1
nameserver 8.8.4.4
nameserver 8.8.8.8
options attempts:2 ndots:1 rotate timeout:2
EXPECTED

Expand Down
8 changes: 4 additions & 4 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@
<<~EXPECTED
rm #comment
rm nameserver[.!="1.2.3.4" and .!="5.6.7.8"]
set nameserver[.="1.2.3.4"] 1.2.3.4
set nameserver[.="5.6.7.8"] 5.6.7.8
set nameserver[1] 1.2.3.4
set nameserver[2] 5.6.7.8
rm search/domain[.!="example.com"]
set search/domain[.="example.com"] example.com
rm options/debug
Expand Down Expand Up @@ -136,8 +136,8 @@
<<~EXPECTED
rm #comment
rm nameserver[.!="1.2.3.4" and .!="5.6.7.8"]
set nameserver[.="1.2.3.4"] 1.2.3.4
set nameserver[.="5.6.7.8"] 5.6.7.8
set nameserver[1] 1.2.3.4
set nameserver[2] 5.6.7.8
rm search/domain[.!="foo.bar" and .!="test.net"]
set search/domain[.="foo.bar"] foo.bar
set search/domain[.="test.net"] test.net
Expand Down
4 changes: 4 additions & 0 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
# ensure that environment OS is ready on each host
fix_errata_on hosts

# Detect cases in which no examples are executed (e.g., nodeset does not
# have hosts with required roles)
c.fail_if_no_examples = true

# Readable test descriptions
c.formatter = :documentation

Expand Down
4 changes: 2 additions & 2 deletions templates/etc/resolv.conf.epp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ rm nameserver
<% else { -%>
<% unless empty($nameservers) { -%>
rm nameserver[.!="<%= $nameservers.join('" and .!="') %>"]
<% $nameservers.each |$nameserver| { -%>
set nameserver[.="<%= $nameserver %>"] <%= $nameserver %>
<% $nameservers.each |$i, $nameserver| { -%>
set nameserver[<%= $i + 1 %>] <%= $nameserver %>
<% } -%>
<% } -%>
<% } -%>
Expand Down

0 comments on commit bbe0ab6

Please sign in to comment.