Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of Trivial Acceptance Tests #255

Merged
merged 3 commits into from
Feb 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,33 @@ jobs:
- name: Run tests
run: bundle exec rake parallel_spec

acceptance:
needs: setup_matrix
runs-on: ubuntu-latest
env:
BUNDLE_WITHOUT: development:test:release
strategy:
fail-fast: false
matrix:
include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}}
name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }}
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Run tests
run: bundle exec rake beaker
env:
BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }}
BEAKER_setfile: ${{ matrix.setfile.value }}

tests:
needs:
- unit
- acceptance
runs-on: ubuntu-latest
name: Test suite
steps:
Expand Down
4 changes: 4 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
enabled_lint_checks:
- parameter_documentation
- parameter_types

spec/spec_helper_acceptance.rb:
unmanaged: false

13 changes: 13 additions & 0 deletions spec/acceptance/default_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

require 'spec_helper_acceptance'

describe 'systemd' do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
include systemd
PUPPET
end
end
end
26 changes: 26 additions & 0 deletions spec/acceptance/resolved_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# frozen_string_literal: true

require 'spec_helper_acceptance'

describe 'systemd' do
context 'configure systemd resolved' do
it 'works idempotently with no errors' do
pp = <<-PUPPET
class{'systemd':
manage_resolved => true,
manage_resolv_conf => #{default[:hypervisor] != 'docker'},
}
PUPPET
apply_manifest(pp, catch_failures: true)
# RedHat 9 and newer installs package first run before fact $facts['internal_services'] is set
apply_manifest(pp, catch_failures: true) if Gem::Version.new(fact('os.release.major')) >= Gem::Version.new('9') && (fact('os.family') == 'RedHat')
traylenator marked this conversation as resolved.
Show resolved Hide resolved
apply_manifest(pp, catch_changes: true)
end

# RedHat 7 does not have systemd-resolved available at all.
traylenator marked this conversation as resolved.
Show resolved Hide resolved
describe service('systemd-resolved'), unless: (fact('os.release.major') == '7' and fact('os.family') == 'RedHat') do
it { is_expected.to be_running }
it { is_expected.to be_enabled }
end
end
end
10 changes: 10 additions & 0 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

require 'voxpupuli/acceptance/spec_helper_acceptance'

configure_beaker

Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f }