summaryrefslogtreecommitdiff
path: root/spec/functions
AgeCommit message (Collapse)Author
2017-08-09(MODULES-5436) release prep for 4.17.2Eric Putnam
2017-05-09add testsHunter Haugen
2017-05-09(PE-20308) Also fix defined type strings & referencesHunter Haugen
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-04-26(PE-20308) Correct boundary for 4.5 vs 4.6Hunter Haugen
2017-04-25(PE-20308) Pass a literal type and not a string to findresourceHunter Haugen
- `defined_with_params` calls `findresource(reference.to_s)` - `findresource` is https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/parser/compiler.rb#L407 and points to https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/resource/catalog.rb#L352 - This calls `Puppet::Resource.new` with the type https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/resource/catalog.rb#L366 - This ends up calling `resource_type` via https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/resource.rb#L317-L319 and that ends up declaring the type via the autoloader api at https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/resource.rb#L390 - But why does the autoloader API fail to find it in the current environment? - Okay, so when the autoloader is trying to find the type, it uses the typeloader to look it up in the current environment https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/metatype/manager.rb#L171 - this calls `get_file` and `mark_loaded` https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/util/autoload.rb#L64-L67 Suggested workaround is to pass a literal type instead of a string to `findresource` to fix in stdlib, and also to fix loading/requiring of type in core puppet. This seems to affect more recent versions of puppet, so fallback to original behavior on pre-4.5
2017-03-21Merge pull request #718 from sspreitzer/master_globWilson McCoubrey
Add glob function
2017-03-16Merge pull request #737 from domcleal/versioncmpWilson McCoubrey
(MODULES-4528) Use versioncmp to check Puppet version for 4.10.x compat
2017-03-14Addition of new length functionHelen Campbell
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-03-03Merge pull request #732 from pmcmaw/FM-6063-unitTestsHailee Kenney
(FM-6063) - Unit tests for high effort functions
2017-03-03(FM-6063) - Unit tests for high effort functionsPaula McMaw
2017-03-03(MODULES-4485) Improve ipv6 support for typePeter Souter
* Improves regex to catch some valid (but less known) ipv6 strings, mostly those which are a mix of ipv6 strings and embedded ipv4 numbers * Regex inspired by the following: * https://github.com/sindresorhus/ip-regex * https://gist.github.com/cpetschnig/294476 * The original Dartware forum thread where someone originally created this beast of a regex, now lost except to archive.org * Whilst we're here, we can add the more tricky ipv6 strings to the existing functions to validate * Luckily, the `ipaddr` native ruby library used in the original functions already supports these
2017-02-28(FM-6058) - Unit tests for med effort functionsPaula McMaw
2017-02-23(FM-6054) - Unit tests for low effort functionsPaula McMaw
2017-02-21Adding unit test for i18n delete_value functionPaula McMaw
2017-02-21Adding unit test for i18n delete_at functionPaula McMaw
2017-02-21Adding unit test for i18n delete functionPaula McMaw
2017-02-21Adding unit test for i18n count functionPaula McMaw
2017-02-21Adding unit test for i18n concat functionPaula McMaw
2017-02-21Merge pull request #714 from pmcmaw/SPIKEi18NDavid Schmitt
(FM-6019) - i18N tests for Spike
2017-02-21Merge pull request #719 from domcleal/metadata-test-moduleDavid Schmitt
Allow test module metadata.json to be read
2017-02-20Merge pull request #715 from domcleal/function-fact-freezeDavid Schmitt
Fix unsupported data type error with rspec-puppet master
2017-02-05Add glob functionSascha Spreitzer
2017-02-04Allow test module metadata.json to be readDominic Cleal
Since puppetlabs/puppet@f2e8e66, the test module's metadata.json is also read causing expectation failures. Like 5c51463, permit it to be read by Puppet.
2017-02-04Fix unsupported data type error with rspec-puppet masterDominic Cleal
The symbol used in the value of the facts hash is not a valid type of value for facts, and results in the following error since rspec-puppet@d50acf0e. Puppet::Error: Unsupported data type: 'Symbol' # puppet/lib/puppet/parser/scope.rb:788:in `deep_freeze' # puppet/lib/puppet/parser/scope.rb:781:in `block in deep_freeze' # puppet/lib/puppet/parser/scope.rb:781:in `each' # puppet/lib/puppet/parser/scope.rb:781:in `deep_freeze' # puppet/lib/puppet/parser/scope.rb:764:in `set_facts' # puppet/lib/puppet/parser/compiler.rb:850:in `set_node_parameters' # puppet/lib/puppet/parser/compiler.rb:166:in `block (2 levels) in compile' # puppet/lib/puppet/util/profiler/around_profiler.rb:58:in `profile' # puppet/lib/puppet/util/profiler.rb:51:in `profile' # puppet/lib/puppet/parser/compiler.rb:166:in `block in compile' # puppet/lib/puppet/context.rb:65:in `override' # puppet/lib/puppet.rb:293:in `override' # puppet/lib/puppet/parser/compiler.rb:162:in `compile' # rspec-puppet/lib/rspec-puppet/example/function_example_group.rb:161:in `build_compiler' The fact's presence doesn't change the behaviour, so remove it.
2017-02-02(FM-6019) - [WIP] - i18N tests for SpikePaula McMaw
2017-01-24(MODULES-4098) Sync the rest of the filesHunter Haugen
2016-12-13Merge pull request #700 from petems/MODULES-4188-uuid_functionBryan Jen
(MODULES-4188) Add UUID generation function
2016-12-09Merge pull request #697 from ↵David Schmitt
HAIL9000/issue/master/MODULES-3829_add_tests_for_ensure_resources (MODULES-3829) Add tests for ensure_resources
2016-12-09(MODULES-3829) Make ensure_packages work with < 2.0Hailee Kenney
Prior to this commit, if a hash was passed in as an argument to the ensure_packages function a method of hash duplication would be used that is not supported with versions of ruby older than 2.0. In order to ensure the method is compatible with older ruby versions, switch to a different method of duplication. Additionally add tests to prevent further regressions.
2016-12-09(MODULES-4188) Add FQDN UUID generation functionPeter Souter
* Generates UUID based on a given FQDN string and the DNS namespace (6ba7b810-9dad-11d1-80b4-00c04fd430c8)
2016-11-29Update deprecation tests to include future parserHelen Campbell
2016-11-10Merge pull request #632 from MiamiOH/masterWilson McCoubrey
Handle array values in join_keys_to_values function
2016-11-10Fix spec failures on puppet 4.8David Schmitt
These were caused by a change in the tested error message.
2016-10-25(MODULES-3980) Fix ipv4 regex validatorDavid Schmitt
This also updates all ipv4 tests to use the same test data for better comparability. Closes #676, #679 Fix-Originally-By: Nate Potter <nathaniel.potter@intel.com>
2016-10-09Add testcase for #665David Schmitt
@keymone added information on how to reproduce his issue, so here's the test case that would fail without his change.
2016-10-04(MODULES-3933) Fix getparam for 'false' valuesDavid Schmitt
This is the idiomatic version of #634, and also addresses the test failures. Original-Fix-By: Michiel Brandenburg <michiel@silverstreet.com>
2016-10-04Permit undef passed as `nil` to validate_stringDominic Cleal
When validate_string is called via the Puppet 4 deprecation wrappers from deprecation_gen (introduced in 970852d), `undef` is passed as `nil` where it was previously passed as `''` from the Puppet 3-style function API. This change explicitly permits a `nil` value in validate_string, and adds a test case to `is_string` which also accepts the same. Fixes test failures in apt, concat etc: Error while evaluating a Function Call, nil is not a string. It looks to be a NilClass at apt/manifests/source.pp:23:3 [..] # ./spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_string.rb:34:in `block (2 levels) in <module:Functions>' # ./spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_string.rb:32:in `each' # ./spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_string.rb:32:in `block in <module:Functions>' # puppet-4.7.0/lib/puppet/parser/functions.rb:174:in `block (2 levels) in newfunction' # puppet-4.7.0/lib/puppet/util/profiler/around_profiler.rb:58:in `profile' # puppet-4.7.0/lib/puppet/util/profiler.rb:51:in `profile' # puppet-4.7.0/lib/puppet/parser/functions.rb:167:in `block in newfunction' # ./spec/fixtures/modules/stdlib/lib/puppet_x/puppetlabs/stdlib/deprecation_gen.rb:13:in `block (2 levels) in deprecation_gen'
2016-10-03Replace :context with :all in spec testsHelen Campbell
2016-09-26Remove duplicate deprecation warningsHelen Campbell
2016-09-26Merge pull request #656 from HelenCampbell/hashFupdateHunter Haugen
Add deprecation warnings to remaining validates
2016-09-26Add deprecation warnings to remaining validatesHelen Campbell
2016-09-15Merge pull request #644 from dmitryilyin/masterBryan Jen
Refactor dig44 function
2016-09-07(MODULES-3737) validate_legacy: refactoringDavid Schmitt
* validate_legacy now accepts undef values * update the TypeMismatch message to include the original validate function name * only notice, not warn, on newly allowed values * changed previous_validation to function_name to avoid confusion with the function of the same name * use deprecation() instead of warn(), when hitting a deprecated value * prepare the tests and function for MODULES-3735 * rewrite validate_legacy tests to use new rspec-puppet * move validate_re deprecation to puppet4 only * adapt validate_re_spec
2016-09-07Fix assert_private tests to not hit the newly deprecated subject.callDavid Schmitt
2016-09-05Deprecation function to be mutable in all casesHelen Campbell
2016-08-30Refactor dig44 functionDmitry Ilyin
The current implementation of the dig44 function has the following problems: * Doesn't recognise Puppet4's :undef value as an empty value and doesn't return the default value. * Doesn't make a different between false and nil value and returns the default value for a non-empty false value
2016-08-17Merge pull request #637 from HelenCampbell/ipdeprecationDavid Schmitt
(MODULES-3534) Deprecation of ip functions
2016-08-17Deprecation of ip functionsHelen Campbell