summaryrefslogtreecommitdiff
path: root/spec/functions/ensure_resource_spec.rb
AgeCommit message (Collapse)Author
2017-05-09Test for defined_with_params() returning false for defined typesDominic Cleal
defined_with_params() now returns false for defined types, causing duplicate resources when using ensure_resources(). Introduced by 4f19c27 in PE-20308.
2017-03-14(MODULES-4528) Use versioncmp to check Puppet version for 4.10.x compatDominic Cleal
`Puppet.version.to_f` on Puppet 4.10.0 will evaluate to `4.1`, causing test and behavioural changes when conditionals check that the version is equal or greater than versions such as `4.3`. Version comparisons that are vulnerable to this have been changed to use Puppet's versioncmp implementation, while most others only check for for major version boundaries which is safe.
2017-02-02(FM-6019) - [WIP] - i18N tests for SpikePaula McMaw
2016-08-14(MAINT) Update ensure_resource specsDavid Schmitt
This updates the test to match the new behaviour in puppet 4.6.0
2016-06-30(MODULES-3543) Fixup defined_with_params to work on all puppet versionsDavid Schmitt
2016-06-29(MODULES-3543) Fix define_with_params to handle undef properlyDavid Schmitt
As described in PUP-6422, ensure_resources('File[/tmp/a]', { owner => undef }) would not actually create the file. This fixes it, and adds tests to prove it.
2015-06-01Convert tests to use plain rspec-puppetDavid Schmitt
Tests in the new style produces the following documentation output: abs should not eq nil should run abs() and raise an Puppet::ParseError should run abs(-34) and return 34 should run abs("-34") and return 34 should run abs(34) and return 34 should run abs("34") and return 34
2014-05-08Move unit tests to spec/functionsHunter Haugen
rspec-puppet matchers are defined for tests which exist in spec/functions, but the function unit tests lived in spec/unit/puppet/parser/functions. This moves them to the correct place for using rspec-puppet
2014-05-07Move the 4 misplaced testsHunter Haugen
2014-05-07Add the missing shebangs and fix the wrong ones for rpmlint to stop ↵Andrea Veri
complaining loudly
2014-03-08Numerous changes to update testing gems.Ashley Penney
This work updates a number of Gems to the latest versions (rspec, rspec-puppet), and updates and tweaks a bunch of tests to work with the updated gems.
2013-05-06Refactor ensure_resource expectationsAlex Cline
This splits out the ensure_resource expectations into separate blocks for clarity. Per adrienthebo's recommendation.
2013-05-03(#20548) Allow an array of resource titles to be passed into the ↵Alex Cline
ensure_resource function This patch allows an array of resource titles to be passed into the ensure_resource function. Each item in the array will be checked for existence and will be created if it doesn't already exist.
2012-08-15Revert "Revert "Merge pull request #86 from bodepd/ensure_resource""Dan Bode
This reverts commit 1e0983362464e8f2832239b09cdbc9175a51e6ec.
2012-08-14Revert "Merge pull request #86 from bodepd/ensure_resource"Jeff McCune
This reverts commit 42ddd7fe54f37b84e34b4a005de2249e53f07469, reversing changes made to 53243605b28fc31618d079155c86b37b4e88a6ca.
2012-08-13re-formattingDan Bode
This commit refactors to ensure 80 character lines.
2012-08-13Handle undef for parameter argumentDan Bode
This commit adds better handling of the case where undef is passed as the parameter value. This works by converting '' into []
2012-08-13Add function ensure_resource and defined_with_paramsDan Bode
This commit adds 2 new functions with unit tests. defined_with_params works similarily to puppet's defined function, except it allows you to also specify a hash of params. defined_with_params will return true if a resource also exists that matches the specified type/title (just like with defined) as well as all of the specified params. ensure_resource is a function that basically combines defined_with_params with create_resources to conditionally create resources only if the specified resource (title, type, params) does not already exist. These functions are created to serve as an alternative to using defined as follows: if ! defined(Package['some_package']) { package { 'some_package': ensure => present, } The issue with this usage is that there is no guarentee about what parameters were set in the previous definition of the package that made its way into the catalog. ensure_resource could be used instead, as: ensure_resource('package', 'some_package', { 'ensure' => 'present' }) This will creat the package resources only if another resource does not exist with the specified parameters.