From cd15d611ddb0b2cc0178db00bcc123cb97ec768e Mon Sep 17 00:00:00 2001 From: Tom Duckering Date: Tue, 31 Jan 2017 17:59:40 +0000 Subject: [PATCH] Test to ensure empty string allowed for $release in apt::source Test added to make sure when release is set to an empty string the source file is rendered correctly. --- manifests/source.pp | 2 +- spec/defines/source_spec.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/manifests/source.pp b/manifests/source.pp index a9769ea..be743eb 100644 --- a/manifests/source.pp +++ b/manifests/source.pp @@ -19,7 +19,7 @@ define apt::source( $_before = Apt::Setting["list-${title}"] - if ! $release { + if !$release { if $facts['lsbdistcodename'] { $_release = $facts['lsbdistcodename'] } else { diff --git a/spec/defines/source_spec.rb b/spec/defines/source_spec.rb index c224668..79cc11b 100644 --- a/spec/defines/source_spec.rb +++ b/spec/defines/source_spec.rb @@ -373,6 +373,20 @@ describe 'apt::source' do end end + context 'release is empty string' do + let :facts do + { + :os => { :family => 'Debian', :name => 'Debian', :release => { :major => '7', :full => '7.0' }}, + :lsbdistid => 'Debian', + :osfamily => 'Debian', + :puppetversion => Puppet.version, + } + end + let(:params) { { :location => 'hello.there', :release => '' } } + + it { is_expected.to contain_apt__setting('list-my_source').with_content(/hello\.there main/) } + end + context 'invalid pin' do let :facts do { -- 2.45.2