summaryrefslogtreecommitdiff
path: root/spec/integration
AgeCommit message (Collapse)AuthorFilesLines
2014-06-12(maint) Fix typos and remove dead codeAndrew Parker1-2/+2
2014-06-12(PUP-514) Only check lambda args onceAndrew Parker1-1/+9
The previous implementation checked the argument types twice against the signature. This reduces it to a single check. The error for a missing argument is now caught in a place that used to be unreachable and so the error has been converted into an issue, which also provides the information about where the failure occurred.
2014-06-12(PUP-514) Error when required args follow optionalAndrew Parker1-2/+2
This adds a check when the signature for a closure is being calculated to catch invalid parameter specifications where required arguments are placed after optional onces. Allowing that would mean that the argument range information would be incorrect.
2014-06-12(PUP-514) Enforce types on lambda parametersAndrew Parker1-10/+20
This updates Closure code to implement type checking for the parameter values.
2014-06-12(PUP-514) Add tests for lambdasAndrew Parker1-0/+171
The work so far has not been able to deal with type checking lambdas. This adds tests for the conditions that will need to be handled for lambdas to properly type check their arguments. Currently none of these new tests pass.
2014-06-12(PUP-514) Improve/add tests for typed parameters define/classHenrik Lindberg1-0/+98
2014-06-12(PUP-514) Change warning to debug, and add validation of type exprHenrik Lindberg1-5/+0
This changes the warning issued on the code path when a resource type is required in order to do deserialization (apply phase). When this happens on the server side (or during apply), the full source is available, and the type in "known resource types" is loaded code that may have typed parameters. This second time, no validation can and will not take place because it is happening where there is no top scope available. (This is fine, and should use result in a debug output). This also fixes a couple of typos.
2014-06-12(maint) Improve comment and formatting in test.Henrik Lindberg1-4/+6
2014-06-12(PUP-514) Add support for opt-in typing of define/class parametersHenrik Lindberg1-3/+6
This makes define and class parameters support optionally typed parameters when using the future parser. The type expressions are evaluated by the Pops Bridge when parameters are transformed t 3x. The 3x parameters are not aware of type information (they are encoded as arrays), and changes to all the logic that deals with parameters turned on to not be a good design. The resource type and resource is instead made aware of the opt-in types via a separate param-name to type map that it applies in the validation step that was already performed.
2014-06-12(PUP-2756) Fix test of future parser evaluation of empty stringJosh Partlow1-0/+117
An empty string is no longer undef when parser is future, and will evaluate as true in a conditional test. This commit fixes a test that was failing this check for the future parser. This, and several like it, was an acceptance test which was just compiling a simple manifest with some conditional logic to test evaluation of conditionals. Since acceptance tests are expensive, I've pulled them back into the integration specs. The actual test being fixed is acceptance/tests/apply/conditionals/should_evaluate_empty.rb which is now the two 'evaluates empty string as <false|true>' specs in the new spec/integration/parser/conditionals_spec.rb
2014-06-12(maint) Refactor shared example from parser/compiler_specJosh Partlow1-397/+385
Previously this spec's tests were a shared_example that had been shared between runs with parser=current and parser=future. The future compiler tests were moved out into spec/integration/parser/future_compiler_spec.rb in 7a6a7d8. This maint fix just removes the unused rspec construction of shared_examples_for from around the specs in parser/compiler_spec, since they are only being run against the current parser now.
2014-06-11Merge pull request #2660 from hlindberg/PUP-121_remove-relative-name-spacingJosh Partlow1-4/+8
(PUP-121) remove relative name spacing
2014-06-11Merge branch 'pr/2704'Andrew Parker1-0/+26
* pr/2704: (maint) Untangle fetching of serial numbers (PUP-2569) Revoke all certificate matching a given name
2014-06-11Merge remote-tracking branch 'upstream/stable'Andrew Parker1-2/+2
* upstream/stable: (maint) stop enforcing the random prioritizer for evaluation in spectests (PUP-2683) Fix fact terminus to load facts without '.' on the load path. (packaging) Update PUPPETVERSION to 3.6.2 (PUP-2533) Insert SSLCARevocationCheck on upgrade (maint) extract initial Passenger configuration (PUP-2533) Apache 2.4 requires explicit CRL configuration (PUP-2478) Remove current directory from Ruby load path.
2014-06-11(PUP-121) Change transformation of CatalogEntryType to not be absoluteHenrik Lindberg1-4/+4
The attempt to make all catalogEntryTypes absolute did not work out so great as the lower level APIs in 3x expect non :: prefixed names to be absolute. This changes the transformation made in the evaluator to always use "relative" names.
2014-06-11(PUP-121) Ensure classes are absolute when transforming to ResourceHenrik Lindberg1-4/+8
When the 3x to 4x calls take place, resource references in the form of a PCatalogEntryType are transformed to Puppet::Resource. Depending on where these (reference) Puppet::Resource instances are used they need to either be absolute, or not (yes, 3x is inconsistent). Since future parser in 3.7 (and later 4.0) will not support dynamic name scoping, the PCatalogEntryType's should in general be absolute. This commit changes the transformation to make the created Puppet::Resource (references) absolute (when it is possible). This also adds more tests
2014-06-11(PUP-1177) make sure ssh_known_hosts is not created with mode 0600Felix Frank1-0/+22
The default mode for files that a ParsedFile provider newly creates is 0600. This makes no sense for the ssh_known_hosts file, because it contains public information that adds to security for all users.
2014-06-11(maint) move the file mode tests to the files spec moduleFelix Frank1-11/+3
It is helpful to have a simple helper method to match desired file modes from spec tests.
2014-06-06Merge branch 'stable'Rob Reynolds1-0/+31
* stable: (PUP-2364) Correct host variable reference (PUP-2364) Fix usage of puppet vardir setting Win2003 (PUP-2635) Skip this test on windows (PUP-2635) integration test for the purging of authorized ssh keys (PUP-2635) use generate instead of eval_generate to purge ssh keys (maint) Use same prioritizer throughout catalog
2014-06-06(maint) stop enforcing the random prioritizer for evaluation in spectestsFelix Frank1-2/+2
Before 95ddc530 the integration tests for Type::User purging authorized SSH keys did not work when using the SequentialPrioritizer that is actually the default in the transaction runner methods defined in PuppetSpec::Compiler. Since the cause has been removed, so should we do with the workaround. The tests should rely on the defaults and not impose a (random) preference unnecessarily.
2014-06-04(PUP-2635) Skip this test on windowsKylo Ginsberg1-1/+1
2014-06-05(PUP-2635) integration test for the purging of authorized ssh keysFelix Frank1-0/+31
Compile manifests that purge keys from a specific file and verify their effect. Adds a test that detects the eval_generate problem fixed in this branch.
2014-06-04(PUP-2569) Revoke all certificate matching a given nameBrice Figureau1-0/+26
puppet cert revoke <name> was revoking only the first certificate when the certificate file wasn't present on the system. This patch makes sure all issued certificate matching a given name are now revoked. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
2014-06-03Merge remote-tracking branch 'upstream/stable'Andrew Parker2-0/+57
* upstream/stable: (maint) Remove failure for empty generated tags (maint) Update test to use resource matcher (maint) Add sitemoduledir to env env tests (PUP-2689) Make AST Resource check tags against "inherited" tags (maint) Remove unused Puppet::Parser::AST::Tag class
2014-06-03(maint) Update test to use resource matcherAndrew Parker1-2/+2
The other test added for checking the tagging behavior used the resource matcher but the current compiler spec didn't. This updates it to be consistent with the future compiler spec and use the matcher.
2014-06-03(maint) Remove unnecessary setting of modulepath from face help specJosh Partlow1-4/+0
The integration spec checking help output for the faces was setting modulepath directly in the body of an RSpec context block. This caused modulepath to be set on test file load. Normally, this is not an issue, since most specs are not sensitive to the Puppet modulepath setting, and the test_helper clears all settings in its after_each_test hook. However, a recent run of specs on Solaris master just happened to run with the very first spec being sensitive to modulepath (spec/integration/directory_environments_spec.rb) which then failed. Fortunately, the current version of puppet no longer requires this early setting of modulepath for the documentation spec to run, so I'm just removing it here.
2014-05-30(PUP-2689) Make AST Resource check tags against "inherited" tagsHenrik Lindberg2-0/+57
This overrides the tagged? method in AST Resource to also search for tags in its containing resource. These tags will be set when the resource is finalized (just before serialization on transformation to external format). If this is not done, resources will have a different tag set when a search is made for the node itself (exported or virtual) vs. searching external resources. This also correct minor problems with passing an array (which could result in an array being set as a tag). It was also possible for empty tags to be set if a string tag contained multiple :: in sequence, or if ending with ::. Now an error is raised for these conditions (just like for empty segments generated by using a sequence of commas (which was on a different code path).
2014-05-28Merge branch 'pr/2549'Josh Cooper2-0/+19
* pr/2549: (PUP-2298) Use resource specific log_exception (PUP-2298) protect transaction spec test against new exceptions (PUP-2298) add resource lifecycle method Puppet::Type#pre_run_check Closes GH-2549
2014-05-23Merge branch 'ticket/master/PUP-838-FFI_Windows_Process'Ethan J. Brown1-0/+11
* ticket/master/PUP-838-FFI_Windows_Process: (PUP-838) Use FFI helpers read_handle / read_dword (PUP-838) Process uses LookupPrivilegeValueW (PUP-838) GetExitCodeProcess checks FFI::WIN32_FALSE (PUP-838) FFI Puppet::Util::Windows::Process module (PUP-838) Move FFI code to bottom of process.rb
2014-05-23(PUP-838) Process uses LookupPrivilegeValueWEthan J. Brown1-0/+11
- Switch from LookupPrivilegeValueA to LookupPrivilegeValueW - In reality, this doesn't absolutely need to be done, but for the sake of consistency with other API calls, we use W suffixed functions - Add 2 tests that confirm that our usage of the Win32 API call is correct
2014-05-23Merge pull request #2668 from hlindberg/PUP-867_remove-dynamic-defaultsJosh Partlow1-0/+32
(PUP-867) Remove support for dynamic defaults for future parser
2014-05-23(PUP-2382) FFI typedef for win32_bool / fix UserEthan J. Brown1-0/+7
- Previously check_token_membership was failing in 2003 spec tests due to 2 issues - FFI::Pointer::NULL cannot be used in place of our :handle typedef, and therefore we must add a new constant of 0 to be used for NULL handles - FFI defines a :bool as variable width "(?? 1 byte in C++)", while Win32 defines a BOOL as int, and is fixed to 4 bytes on x86 and x64 - Fortunately the bool issue really only bit us in the one spot where we were using a pointer to a bool, but by adding a new typedef for :win32_bool, all call sites comparing the return value needed to be updated for correctness to compare against FFI::WIN32_FALSE - A test was added to ensure these APIs are called during spec tests on all Windows platforms, and not just 2003
2014-05-22(PUP-2544) Util::ADSI -> Util::Windows::ADSIEthan J. Brown1-6/+4
- Move Windows ADSI code out of puppet/util and into puppet/util/windows - Update namespace from Puppet::Util::ADSI to Puppet::Util::Windows::ADSI - Add module / class definitions for ADSI to util/windows.rb to prevent tests from blowing up on non-Windows - Moving Puppet.features.microsoft_windows? checks to top of user and group provider tests for ADSI - Update all dependent code, remove unnecessary references
2014-05-22(PUP-836) Remove Win32::Security.elevated_securityEthan J. Brown1-9/+9
- Refactor Puppet::Util::Windows::Process to implement new method elevated_security? that was in win32-security gem - Refactor get_token_information to return an FFI::MemoryPointer buffer instead of a parsed structure, since GetTokenInformation is a generic call that can return many structure types, including TOKEN_ELEVATION. - Remove any reliance on win32-security gem from user.rb - Adjust tests accordingly
2014-05-22(PUP-836) FFI Puppet::Util::Windows::UserEthan J. Brown1-0/+33
- LogonUserW, LoadUserProfile, UnloadUserProfile and PROFILEINFO have been converted from manually packing params with Win32API.new to automatically managed with FFI definitions. - Use MemoryPointer where appropriate. - Note that wide character LogonUserW is used rather than platform varying LogonUser as FFI is unable to use that. The pointer widths of PROFILEINFO vary depending on platform, which is handled by using :pointer. With LogonUserW the string pointed to is always wide character, which is properly handled by using wide_string. - Add FFI::MemoryPointer helper read_handle - Add FFI::MemoryPointer.from_wide_string and corresponding tests that ensure that a properly terminated UTF-16LE string is passed in - Add FFI::MemoryPointer#read_wide_string that reads a wide string buffer into a Ruby string with Encoding.default_external and corresponding tests - Add additional tests around User methods that make native Win32 API calls that will intentionally fail - Fix wide_string helper to return nil when given nil so that can be passed directly to Win32 as a null pointer
2014-05-19(PUP-867) Remove support for dynamic defaults for future parserHenrik Lindberg1-0/+32
WHen future parser is in effect, the lookup of default values will now not look in "parent scopes" (i.e. scopes that *contain* the resource). Instead it now only looks in inherited and enclosing scopes + itself. This removes the confusion that occurs when a class may be included from different locations, and the location that wins manages to impose the defaults from its scope. This removal goes hand in hand with dynamic scoping being removed everywhere else.
2014-05-16(PUP-2519) Create fallback environment only for default productionJosh Partlow1-2/+2
The goal here was to only produce a fallback environment for the default 'production' environment which would only be found if the production directory environment did not exist. All other cases would raise an error during application start up if the environment did not exist. Except for applications in agent mode which currently need the concept of the environment they will be requesting, but should not have to create or verify the existence of a locally matching environment in their environmentpath. A few other changes are made to further narrow the scope of code making open requests for the configured environment: * indirection request - looks up current environment now, relying on this having been set by whatever application is making the request. * puppet apply - instead of creating a new loader with a single static environment, it overrides current_environment instead. * puppet util commandline - does not attempt to look for additional plugins if there is no environment to search in. It relies on application to raise an error instead, if necessary.
2014-05-14(PUP-2298) protect transaction spec test against new exceptionsFelix Frank1-0/+3
The new perform_pre_run_checks method in the transaction loops over all resources in the catalog. This is prone to failures if any nil references end up in the catalog. This can happen during the addition of resources to the catalog under test conditions, because the mock resources are not sufficiently contained. To work around this effect, stub the very #container_of method in the mock catalog so that all resources will have an apparent container.
2014-05-14(PUP-2298) add resource lifecycle method Puppet::Type#pre_run_checkFelix Frank1-0/+16
In order to deprecate the builtin defined function (which is often abused to work around resource duplication among modules) it is desirable to add resource constraints to the language. An easy approach to allowing such constraints to work is to add them as a special resource type that does not take effect during the transaction, but fails the whole catalog in case of validation failure. To make this possible, add a new method #pre_run_check to the Type base class for overriding in appropriate resource types (such as constraint). The semantics is simply - raise nothing if the pre-run check is succesful - raise a Puppet::Error otherwise The check is performed during evaluation of the transaction, just before the catalog is applied. The generating of additional resources should be complete when this is done (because the hook is meant to be able to check the whole catalog for consistency).
2014-05-13Merge pull request #2631 from ↵Josh Partlow2-3/+11
hlindberg/pup-2214_change-env-lookup-to-current-env (PUP-2214) change env lookup to current env
2014-05-12(PUP-2214) Fix spec failures under 1.8.7Josh Partlow1-3/+4
Fixes some rdoc1 spec issues by providing explicit envs in the specs.
2014-05-12(PUP-1028) Remove pending tests that aren't neededAndrew Parker1-14/+20
The new parser has been updated to be able to handle nodes with numeric names and so the test for that case now passes for both the current and future parser. The only remaining case is when the name is an invalid number. The future parser won't ever parse this correctly and so the test has been changed to assert the desired behavior, in which the parser fails. The new changes to the parser also allows it to handle dotted names and so a new test has been added for that.
2014-05-12(PUP-1028) Specify various ways of matching nodesAndrew Parker1-0/+161
There were no tests that tried to specify how node statements are selected. This adds coverage for various ways in which a node statements can match a given node object and varifies that the future evaluator and the current evaluator produce the same results. There are 2 cases where the future evaluator isn't able to handle the same node statements: using numbers. One case, where a name begins with a number, seems completely reasonable. The other case, where the name is a valid number, seems like an arbitrary restriction and so we need to discuss.
2014-05-09(PUP-2214) Make util rdoc and related parser use :current_environmentHenrik Lindberg1-0/+7
2014-04-29Merge pull request #2537 from ↵Andrew Parker1-72/+74
adrienthebo/feature/master/pup-1840-tunable-digest-algorithm Feature/master/pup 1840 tunable digest algorithm
2014-04-29(maint) Fix plugin spec to work with facter 1.7.5Josh Partlow1-6/+14
Puppet does not consider Facter 1.7.5 to provide external_facts, so the pluginfacts step was being skipped when specs were run with Facter 1.7.5. Altered the plugin spec to work with the application rather than the face so that we can check the rendered output, and to generate lib and facts.d dirs to normalize the output (otherwise the downloader reports the creation of the base plugin target directories, something which normally would be handled by Puppet's Settings catalog). As part of this, I noticed that the plugin face would return different results. If external facts were supported, it would return the list of any external facts pluginsynced. Otherwise it would return the list of any plugins pluginsynced. Changed this to accumlate and list both sets of changes.
2014-04-28(maint) Provide a namespace around two specs using Memory indirectorsJosh Partlow1-0/+2
Two specs were using the same constant names to track classes that they were generating Memory indirector classes for. Because specs share the same module namespace, they were overwriting one another on load and causing spec order failures. Guarding the specs within a namespace module should keep them isolated and prevent them for unexpectedly tinkering with one another's test setup.
2014-04-28(maint) replace `using_checksums_describe` with `with_digest_algorithms`Adrien Thebo1-72/+74
2014-04-28(PUP-1699) Add remote environment to plugin downloader callsJosh Partlow1-0/+52
Puppet::Configurer::Downloader is also called by the plugin face, but we were not submitting an environment there. On Ruby 1.9.3 this nil environment was being interned as :'' and would produce a failure server side when a request with an empty environment was parsed. On Ruby 1.8.7, nil raises an error when interned and it was failing much sooner on the agent side. To resolve this, we're passing in a reference to the configured environment. Also added an integration test for the plugin face, because we weren't seeing any failure in our test suite.
2014-04-28(PUP-1699) Tie resource environment to catalogAndrew Parker4-6/+5
Previously resources would end up "floating away" from the catalog that contained them because they wouldn't use the catalog as their source for an environment. This also extended to catalogs, which lost track of their environment at times. So in order to have resources use the environment of their catalog, the catalog needed to have a guaranteed environment. This adds an environment parameter to the catalog constructor and uses it to drive the environment to use for everything in that catalog. The resource now uses its catalog's environment, if it has a catalog, or it uses the new NONE environment, if it does not have a catalog. When catalogs are deserialized, they also need to have a reference to *some* environment. However, since they only have a name of the environment, there isn't any guarantee that an environment of that name is available locally. To deal with this there is a new "remote" environment constructor to be able to create references to the remote environment of the catalog. This is used as the environment of a deserialized catalog. We (Joshua Partlow and Andrew Parker) tried to have the environment a required parameter of catalog construction, but it appears that creating catalogs is public API and so cannot be changed (we verified this by checking stdlib tests).