summaryrefslogtreecommitdiff
path: root/spec/functions
AgeCommit message (Collapse)Author
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
2016-08-15Merge pull request #636 from domcleal/deprecation-warning-loggerDavid Schmitt
(maint) Switch 3.x deprecation() to use Puppet warning logger
2016-08-15(maint) Switch 3.x deprecation() to use Puppet warning loggerDominic Cleal
The deprecation function was calling the `Kernel#warn` function which prints to stderr, rather than the Puppet logger. This causes problems for Puppet module tests on Travis CI, which has a cap on the amount of stdout/err permitted in its logs and also prevents users from finding the deprecation warnings when running under a Puppet master.
2016-08-14(MAINT) Update ensure_resource specsDavid Schmitt
This updates the test to match the new behaviour in puppet 4.6.0
2016-08-08(modules-3532) deprecate string type checkstphoney
2016-08-08(modules-3533) deprecation for 3.x number functiontphoney
2016-07-22Added the regexpescape function.Steve Moore
2016-07-18Merge pull request #617 from tphoney/add_deprecate_functionDavid Schmitt
(MODULES-3529) add deprecation function
2016-07-18(MODULES-3529)add deprecation functiontphoney
2016-07-13Merge pull request #618 from ntpttr/fix/master/modules-3568David Schmitt
(MODULES-3568) Move dig to dig44 and deprecate dig
2016-07-08(MODULES-3568) Move dig to dig44 and deprecate digNate Potter
A new version of dig was introduced in Puppet 4.5.0 that isn't compatible with the stdlib version of dig. To maintain backwards compatibility and ensure that tests for stdlib aren't broken, this patch renames dig to dig44 and adds a deprecation warning to the stdlib dig function.
2016-07-01Fix load_module_metadata and loadjson tests to pass with fully deployed moduleDavid Schmitt
When replacing the lib/ and manifests/ symlinks in the fixtures with a proper top-level symlink, puppet 4 starts loading the metadata.json before loading functions, which confuses these tests. Added more specific expectations, and provide data for that call.
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.
2016-05-13Add a delete_regex functionJoseph Yaworski
To maintain backwards compatibility, add a delete_regex function instead of modifying delete itself.
2016-05-12Merge pull request #600 from dmitryilyin/masterBryan Jen
Add the default value to the "loadyaml" function
2016-05-05Merge pull request #601 from petems/MODULES-1439-any2bool_addedBryan Jen
(MODULES-1439) Adds any2bool function
2016-05-04Use reject instead of delete_ifJoseph Yaworski
2016-05-03Merge pull request #603 from puppetlabs/4.12.xBryan Jen
Mergeback 4.12.x
2016-05-02(MODULES-1439) Adds any2bool functionPeter Souter
* Basically a combination of `string2bool` and `num2bool`
2016-04-28Expose the functions of ruby's built-in Shellwords module (#580)Joris
* Add shell_escape function, shell_join function & shell_split function
2016-04-26Add the default value to the "loadyaml" functionDmitry Ilyin
This value will be returned if the is no file to load or a file could not be parsed. It's similar to the "parseyaml" function's default value. Add the "loadjson" function too
2016-04-25Remove todo for delete() and update specHunter Haugen
This spec should verify that substring matches are not removed in the future
2016-04-25Revert "Add support for regular expressions to delete"Hunter Haugen
This reverts commit 0d46515b57cea60d4d5f1e4d81a75a448a7a73a8. It introduced backwards-incompatible functionality.
2016-04-12Add support for regular expressions to deleteJoseph Yaworski
2016-04-11Merge pull request #590 from alext/fix_concat_with_hashHunter Haugen
(MODULES-3246) Fix concat with Hash arguments.
2016-04-11Merge pull request #583 from jyaworski/validate_email_addressTP Honey
Add validate_email_address function
2016-04-10Add validate_email_address functionJoseph Yaworski
2016-04-08(MODULES-3246) Fix concat with Hash arguments.Alex Tomlins
85d5ead Updated the concat function so that it wouldn't modify the original array. A side-effect of this change is that it now always calls `Array()` on the second argument. If thit is a Hash, this results in `to_a` being called on the hash, which converts it to an array or tuples. This is undesired. Update the behaviour so that it doesn't (indirectly) call `to_a` on anything, instead test for the type of the argument, wrapping it in an array if it's not already an array.
2016-04-07(maint) remove failing testDavid Schmitt
This removes the failing test special casing for puppet 4.
2016-03-22improve suffix function to support the same feature set as prefixReinhard Vicinus
2016-02-18Extend Base64() function supportguessi
2016-02-16Add dig() functionMaksym Melnychok
Deprecates #try_get_value()
2016-01-16Add test for basename on path with schemeAlec Henninger
2016-01-08Merge pull request #552 from mattbostock/add_x509_rsa_key_pairDavid Schmitt
Add a function to validate an x509 RSA key pair
2016-01-08Change order of tests to be more logicalMatt Bostock
Put the tests using a valid certificate fixture together and put tests using a valid key fixture together.
2016-01-08Test certificate and key with a truncated middleMatt Bostock
Test a valid certificate and valid key that have had 48 characters removed from their middle, to simulate a malformed certificate and key. Suggested by @DavidS in https://github.com/puppetlabs/puppetlabs-stdlib/pull/552
2016-01-08Add a function to validate an x509 RSA key pairMatt Bostock
Add a function to validate an x509 RSA certificate and key pair, as commonly used for TLS certificates. The rationale behind this is that we store our TLS certificates and private keys in Hiera YAML files, and poor indentation or formatting in the YAML file could cause a valid certificate to be considered invalid. Will cause the Puppet run to fail if: - an invalid certificate is detected - an invalid RSA key is detected - the certificate does not match the key, i.e. the certificate has not been signed by the supplied key The test certificates I've used in the spec tests were generated using the Go standard library: $ go run $GOROOT/src/crypto/tls/generate_cert.go -host localhost Example output: ==> cache-1.router: Error: Not a valid RSA key: Neither PUB key nor PRIV key:: nested asn1 error at /var/govuk/puppet/modules/nginx/manifests/config/ssl.pp:30 on node cache-1.router.dev.gov.uk