]> review.fuel-infra Code Review - puppet-modules/puppetlabs-apt.git/commit
Modify apt::source release parameter test
authorReid Vandewiele <marut@cat.pdx.edu>
Wed, 7 Mar 2012 18:10:46 +0000 (10:10 -0800)
committerReid Vandewiele <marut@cat.pdx.edu>
Wed, 7 Mar 2012 18:10:46 +0000 (10:10 -0800)
commitd4fec561f3eb7a61570dcdca1c3b10f309b3f4d5
tree5ce8daae4f3c01b556e7a1ab0fc5cd641a128b7f
parent65a7a030e08273c2bd0aa322ced618c95c7bbd66
Modify apt::source release parameter test

This commit modifies the release parameter test in apt::source to work
correctly within puppet-rspec for edge-case resource definitions. Previously,
the test for the $release parameter was written as

`if ! $release { fail() }`

This commit updates the test to be written as

`if $release == undef { fail() }`

Additionally, the tests for correct behavior in the presence or absence of a
$release parameter have been beefed up.

The reason for making this change relates to examples such as the following
resource definition:

apt::source { "jenkins":
  location    => "http://pkg.jenkins-ci.org/debian",
  release     => "",
  repos       => "binary/",
  key         => "D50582E6",
  key_source  => "http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key",
  include_src => false,
}

Note that the $release parameter is given as the empty string. In practice,
this is perfectly valid and everything will work great. However, it seems that
the empty string gets interpreted by something in puppet-rspec as something
equivalent to "False", and thus when testing, the above resource definition
would fail with "Puppet::Error: lsbdistcodename fact not available: release
parameter required" even though the $release parameter has been explicitely
specified (as the empty string).

See also: https://github.com/rtyler/puppet-jenkins/issues/9
manifests/source.pp
spec/defines/source_spec.rb