Skip to content

Commit

Permalink
Allow additional option for $cache parameter (#169)
Browse files Browse the repository at this point in the history
* Allow additional option for $cache parameter

Update the cache parameter on init class to match the allowed values for
resolved.

* added tests for resolved cache variants
  • Loading branch information
bryangwilliam authored Jan 29, 2021
1 parent ea214da commit 448ec1d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
4 changes: 2 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# Takes a boolean argument or "opportunistic"
#
# @param cache
# Takes a boolean argument.
# Takes a boolean argument or "no-negative".
#
# @param dns_stub_listener
# Takes a boolean argument or one of "udp" and "tcp".
Expand Down Expand Up @@ -98,7 +98,7 @@
Optional[Variant[Boolean,Enum['resolve']]] $multicast_dns,
Optional[Variant[Boolean,Enum['allow-downgrade']]] $dnssec,
Optional[Variant[Boolean,Enum['opportunistic', 'no']]] $dnsovertls,
Boolean $cache,
Optional[Variant[Boolean,Enum['no-negative']]] $cache,
Optional[Variant[Boolean,Enum['udp','tcp']]] $dns_stub_listener,
Boolean $use_stub_resolver,
Boolean $manage_networkd,
Expand Down
25 changes: 24 additions & 1 deletion spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,33 @@
it { is_expected.to contain_ini_setting('llmnr') }
it { is_expected.to contain_ini_setting('dnssec') }
it { is_expected.to contain_ini_setting('dnsovertls') }
it { is_expected.to contain_ini_setting('cache') }
it {
is_expected.to contain_ini_setting('cache').with(
path: '/etc/systemd/resolved.conf',
value: 'yes',
)
}
it { is_expected.to contain_ini_setting('dns_stub_listener') }
end

context 'when enabling resolved with no-negative cache variant' do
let(:params) do
{
manage_resolved: true,
cache: 'no-negative',
}
end

it { is_expected.to create_service('systemd-resolved').with_ensure('running') }
it { is_expected.to create_service('systemd-resolved').with_enable(true) }
it {
is_expected.to contain_ini_setting('cache').with(
path: '/etc/systemd/resolved.conf',
value: 'no-negative',
)
}
end

context 'when enabling timesyncd' do
let(:params) do
{
Expand Down

0 comments on commit 448ec1d

Please sign in to comment.