Skip to content

Commit

Permalink
Acceptance Test for systemd-resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
traylenator committed Feb 21, 2022
1 parent 0603b3b commit 51d70ea
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require 'spec_helper_acceptance'

describe 'systemd' do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
Expand Down
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 => false,
}
PUPPET
apply_manifest(pp, catch_failures: true)
# RedHat 9 installs package first run before fact $facts['internal_services'] is set
apply_manifest(pp, catch_failures: true) if (Puppet::Util::Package.versioncmp(fact('os.release.major'), '9') >= 0) && (fact('os.family') == 'RedHat')
apply_manifest(pp, catch_changes: true)
end

# RedHat 7 does not have systemd-resolved available at all.
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

0 comments on commit 51d70ea

Please sign in to comment.