Skip to content

Commit

Permalink
fix beaker tests
Browse files Browse the repository at this point in the history
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
  • Loading branch information
b4ldr committed Dec 22, 2020
1 parent df33e54 commit 4389848
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 12 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: CI

on: pull_request

jobs:
setup_matrix:
name: 'Setup Test Matrix'
runs-on: ubuntu-latest
outputs:
beaker_setfiles: ${{ steps.get-outputs.outputs.beaker_setfiles }}
puppet_major_versions: ${{ steps.get-outputs.outputs.puppet_major_versions }}
puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }}
env:
BUNDLE_WITHOUT: development:test:release
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true
- name: Run rake validate
run: bundle exec rake validate
- name: Setup Test Matrix
id: get-outputs
run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false

unit:
needs: setup_matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}}
env:
BUNDLE_WITHOUT: development:system_tests:release
PUPPET_VERSION: "~> ${{ matrix.puppet }}.0"
name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }})
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run tests
run: bundle exec rake

acceptance:
needs: setup_matrix
runs-on: ubuntu-latest
env:
BUNDLE_WITHOUT: development:test:release
strategy:
fail-fast: false
matrix:
setfile: ${{fromJson(needs.setup_matrix.outputs.beaker_setfiles)}}
puppet: ${{fromJson(needs.setup_matrix.outputs.puppet_major_versions)}}
name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }}
steps:
- name: Enable IPv6 on docker
run: |
echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json
sudo service docker restart
- 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: ${{ matrix.puppet.collection }}
BEAKER_setfile: ${{ matrix.setfile.value }}

12 changes: 5 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
8 changes: 7 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
17 changes: 13 additions & 4 deletions spec/acceptance/unbound_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,28 @@
describe port(53) do
it { is_expected.to be_listening }
end
describe command('dig +dnssec . soa @localhost') do
describe command('dig +dnssec . soa @127.0.0.1') do
# Sneaky suspicion there may be some type of rate limiting
let(:pre_command) { 'sleep 1' }

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
describe command('dig +dnssec . soa @127.0.0.1') do
let(:pre_command) { 'sleep 1' }

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 SOA dnssec-failed.org @127.0.0.1') do
let(:pre_command) { 'sleep 1' }

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 SOA dnssec-failed.org @127.0.0.1') do
let(:pre_command) { 'sleep 1' }

its(:stdout) { is_expected.to match %r{status: NOERROR} }
end
end
Expand Down

0 comments on commit 4389848

Please sign in to comment.