From 1404f67a1b080ad0e0aaaa0fbf73cd4dabd4f8bb Mon Sep 17 00:00:00 2001 From: John Bond Date: Tue, 22 Dec 2020 13:00:50 +0100 Subject: [PATCH] fix beaker tests Seems that the beaker tests are sporadicly failing when running the following command dig +dnssec dnssec-failed.org @localhost Try fixing this by using 127.0.0.1 and +tcp --- .github/workflows/ci.yml | 24 ++++++++++++++++++++++++ Gemfile | 12 +++++------- Rakefile | 8 +++++++- spec/acceptance/unbound_spec.rb | 15 +++------------ 4 files changed, 39 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..ed03ae4e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: CI + +on: pull_request + +jobs: + acceptance: + runs-on: ubuntu-latest + env: + BUNDLE_WITHOUT: development:test:release + strategy: + fail-fast: false + name: 'Debian 10 puppet 6' + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + - name: Run tests + run: bundle exec rake beaker + env: + BEAKER_PUPPET_COLLECTION: puppet6 + BEAKER_setfile: "debian10-64{hostname=debian10-64.example.com}" diff --git a/Gemfile b/Gemfile index 2fce93ce..f6edeb42 100644 --- a/Gemfile +++ b/Gemfile @@ -24,6 +24,7 @@ group :development do end group :system_tests do + gem 'puppet_metadata', '~> 0.3.0', :require => false gem 'voxpupuli-acceptance', :require => false end @@ -35,14 +36,11 @@ group :release do end +gem 'puppetlabs_spec_helper', '~> 2.0', :require => false +gem 'rake', :require => false +gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -if facterversion = ENV['FACTER_GEM_VERSION'] - gem 'facter', facterversion.to_s, :require => false, :groups => [:test] -else - gem 'facter', :require => false, :groups => [:test] -end - -ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 6.0' : puppetversion = ENV['PUPPET_VERSION'].to_s +puppetversion = ENV['PUPPET_VERSION'] || '~> 6.0' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby diff --git a/Rakefile b/Rakefile index b450fe7b..3f9591d9 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,10 @@ -require 'voxpupuli/test/rake' +# Attempt to load voxupuli-test (which pulls in puppetlabs_spec_helper), +# otherwise attempt to load it directly. +begin + require 'voxpupuli/test/rake' +rescue LoadError + require 'puppetlabs_spec_helper/rake_tasks' +end # load optional tasks for releases # only available if gem group releases is installed diff --git a/spec/acceptance/unbound_spec.rb b/spec/acceptance/unbound_spec.rb index 0a7c6f45..f24758be 100644 --- a/spec/acceptance/unbound_spec.rb +++ b/spec/acceptance/unbound_spec.rb @@ -15,7 +15,7 @@ describe 'unbound class' do describe 'running puppet code' do it 'work with no errors' do - pp = "class {'unbound': }" + pp = "class {'unbound': verbosity => 5, logfile => '/tmp/unbound.log'}" apply_manifest(pp, catch_failures: true) apply_manifest(pp, catch_failures: true) expect(apply_manifest(pp, catch_failures: true).exit_code).to eq 0 @@ -29,19 +29,10 @@ describe port(53) do it { is_expected.to be_listening } end - describe command('dig +dnssec . soa @localhost') do - its(:stdout) { is_expected.to match %r{\.\s+\d+\s+IN\s+SOA\s+a\.root-servers\.net\.\snstld\.verisign-grs\.com\.\s\d+\s1800\s900\s604800\s86400} } - its(:stdout) { is_expected.to match %r{flags: qr rd ra ad;} } - end - describe command('dig +dnssec . soa @localhost') do - its(:stdout) { is_expected.to match %r{\.\s+\d+\s+IN\s+SOA\s+a\.root-servers\.net\.\snstld\.verisign-grs\.com\.\s\d+\s1800\s900\s604800\s86400} } - its(:stdout) { is_expected.to match %r{\.\s+\d+\s+IN\s+RRSIG\s+SOA} } - its(:stdout) { is_expected.to match %r{flags: qr rd ra ad;} } - end - describe command('dig +dnssec SOA dnssec-failed.org @localhost') do + describe command('dig +tcp +dnssec -t SOA dnssec-failed.org @127.0.0.1') do its(:stdout) { is_expected.to match %r{status: SERVFAIL} } end - describe command('dig +dnssec +cd SOA dnssec-failed.org @localhost') do + describe command('dig +dnssec +cd -t SOA dnssec-failed.org @127.0.0.1') do its(:stdout) { is_expected.to match %r{status: NOERROR} } end end