]> review.fuel-infra Code Review - puppet-modules/puppetlabs-apt.git/commitdiff
Test to ensure empty string allowed for $release in apt::source
authorTom Duckering <tduckeri@thoughtworks.com>
Tue, 31 Jan 2017 17:59:40 +0000 (17:59 +0000)
committerHelen Campbell <helen@puppetlabs.com>
Tue, 30 May 2017 10:59:23 +0000 (11:59 +0100)
Test added to make sure when release is set to an empty string the
source file is rendered correctly.

manifests/source.pp
spec/defines/source_spec.rb

index a9769ea890c39bcdf098db2fac8e1d043c0a24ae..be743eb26ca207fc9a3c2b09f82a52caff3ae494 100644 (file)
@@ -19,7 +19,7 @@ define apt::source(
 
   $_before = Apt::Setting["list-${title}"]
 
-  if ! $release {
+  if !$release {
     if $facts['lsbdistcodename'] {
       $_release = $facts['lsbdistcodename']
     } else {
index c224668f4791bf350145bc391dd07ad0d39beaf0..79cc11b990d782ec58ef7f9e84a4c352a3ce0e3d 100644 (file)
@@ -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
         {