summaryrefslogtreecommitdiff
path: root/spec/unit/face
AgeCommit message (Collapse)AuthorFilesLines
2014-08-01(maint) Add tests and fix up dump actionAndrew Parker1-32/+70
There were a few formatting problems with the dump action. This fixes those up and adds tests around the dump functionality.
2014-07-24(maint) Remove pending face specsAdrien Thebo6-42/+0
The certificate_request, certificate_revocation_list, key, report, resource, and resource_type faces were added years ago and the tests have always been pending. Since we've been ignoring those pending tests up to this point the warnings are clearly not adding value; let's just get rid of them.
2014-07-22Merge branch 'stable'Adrien Thebo1-8/+8
2014-07-21(maint) Cleanup specs for the `module` Face’s `install` action.Pieter van de Bruggen1-8/+8
Prior to this change, the specs relied on a fragile chain of stubbed expectations, which changes elsewhere in the application have rendered incorrect and non-operational. This change aims to improve these specs by stubbing less and making more robust assertions about the data.
2014-07-17Merge pull request #2874 from adrienthebo/maint/master/update-rspecAndrew Parker1-1/+1
Maint/master/update rspec
2014-07-15(maint) Always pass an arg to shared behavior blockAdrien Thebo1-1/+1
2014-07-11(PUP-2918) Clarify missing Modulefile errorBrandon High1-2/+2
Prior to this commit, when building a module without a Modulefile or metadata.json, the builder would blow up with a cryptic 'Unable to find module root at DIRECTORY' It's not entirely clear what that means to an end user. This commit clarifies that metadata.json or a Modulefile are what need to be found at the module root. Also removes some duplicated logic for checking module root.
2014-05-16(PUP-2519) Create fallback environment only for default productionJosh Partlow2-1/+4
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-09(PUP-2014) Make module use current_environmentHenrik Lindberg1-5/+3
Module now uses current environment instead of configured environment when being asked for a module and not supplying an explicit environment name. It used to lookup to configured environment giving invoking logic no chance to modify the default without modifying the setting.
2014-04-25(maint) Remove FS redefined constant warnings in spec runsJosh Partlow1-0/+2
We define FS as an alias for Puppet::FileSystem in three separate specs. Unfortunately, describe blocks do not provide any namespacing in rspec, and this were colliding, issuing two separate warnings for a redefined constant. Wrapping each spec in its own module provides separation and elliminates the warnings.
2014-04-23Merge pull request #2504 from ↵Pieter van de Bruggen4-190/+144
pvande/feature/master/pup2093_migrate_pmt_to_v3_api Migrate PMT to the /v3 API.
2014-04-21Merge remote-tracking branch 'upstream/master' into PE-3182Pieter van de Bruggen2-7/+7
Conflicts: spec/unit/face/module/install_spec.rb spec/unit/face/module/list_spec.rb spec/unit/face/module/uninstall_spec.rb spec/unit/module_tool/applications/installer_spec.rb spec/unit/module_tool/applications/uninstaller_spec.rb spec/unit/module_tool_spec.rb
2014-04-21(PUP-2213) Expand paths for face/config spec on windowsJosh Partlow1-13/+13
2014-04-18(PUP-2213) Read environment settings from other sections in config printJosh Partlow1-11/+109
Puppet's config print functionality has a --section option to allow you to read the configuration as it would be seen in other run modes such as master or agent. But the environment loaders are provided an environmentpath and basemodulepath setting prior to Puppet evaluating the user's --section setting, and will only provide environments as configured in [main]. So if you have environmentpath set in master, a `puppet config print modulepath --section master --environment production` would show you the modulepath for the production environment as loaded from [main] not [master]. To fix this, when handling a config print call, we are now overriding the environment loaders with settings obtained from the user selected section. This means that the interpolated settings can now find an environment from an environmentpath specified in any section of puppet.conf. The static environment loader get_conf() method is also changed to return a simple configuration that just returns the statically declared environment's settings. This ensures that `puppet config print --environment doesnotexist` will correctly print the 'no_manifest' and empty modulepath setting that reflect the private statically configured environment settings for a non-existent directory environment.
2014-04-09Merge remote-tracking branch 'upstream/stable'Andrew Parker4-6/+6
* upstream/stable: (PUP-2158) Unlist configured environment (PUP-2158) Test dynamic environments with an empty environmentpath (PUP-2158) Fix integration apply application spec (PUP-2129) Fix issues with false interpolation start (no-such-method) (PUP-2158) Report 404 for missing environment (PUP-2158) Default a missing manifest to no_manifest (PUP-2158) Hide dir envs behind a feature flag Conflicts: lib/puppet/node/environment.rb spec/unit/environments_spec.rb
2014-04-07(PUP-2158) Default a missing manifest to no_manifestAndrew Parker4-6/+6
The tests were often creating environments that didn't need to have manifests. Since we didn't have a way of specifying that when they were written, we used '' to fill in the blank. This actually caused a large number of tests to try to find code to load in the PWD, which caused tests to break if a developer had parse errors in manifests being used for testing in the root directory of their puppet project. This changes the manifest to be optional and removes '' from those tests. The tests no longer fail if a bad manifest is in the PWD :D
2014-04-04(PUP-2093) Migrate PMT to /v3 API.Pieter van de Bruggen4-190/+144
Prior to this commit, the PMT managed all communication with the Forge via the (now legacy) /v1 API. That API has been deprecated (primarily due to scalability concerns), which is less of an issue since it was never officially a public API. This commit migrates all communication to the Forge to the new /v3 API, which is expected to be launched as our official public API "soon". This commit also integrates a standalone dependency resolver, as the /v3 API contains no implicit dependency resolution (as the /v1 API did); consequently, large portions of the PMT code have been changed, and others have become unreachable. This commit also changes the default host that the PMT communicates with, from https://forge.puppetlabs.com to https://forgeapi.puppetlabs.com (the natural URL for the Forge API service). Since the tool now expects to communicate with a completely different service, it will be unable to communicate with services that do not implement the same /v3 API.
2014-03-31(PUP-1433) Remove use of manifest settingAndrew Parker1-2/+5
2014-03-07(maint) Add rake task for parallelizing specs.Peter Huene1-0/+1
Adding a 'parallel:spec' task that will group specs and then run those groups in a parallel set of processes. By default, parallel:spec will bunch the specs into groups of approximately 1000 and concurrently run each group up to the number of processors reported by facter. The task takes two parameters: process_count and group_size. Running with a process_count of 1 (parallel:spec[1]) will behave like the existing 'spec' task, except it will still group the tests and recycle the spec running process between groups. This has the added benefit of limiting the spec running process' working set, at the cost of being a little slower.
2014-02-19(PUP-1584) Expand some modulepath settings for windowsJosh Partlow1-1/+1
A couple of module_tool specs modified for PUP-1584 were not being expanded such that they would work properly on Windows or POSIX.
2014-02-18(PUP-1584) module_tool uses current_environment with target_dir overridesJosh Partlow2-129/+39
The module tool was relying on the implicit creation and caching of legacy environments based on puppet settings for environment and modulepath. But this does not work for the new directory style of environments. So we are being explicit about using the current environment from the context, and overriding modulepath to prepend a target_dir if given, and then directly inserting the environment to be used into the options rather than expecting the module_tool applications to retrieve the correct environment from any other loaders. Testing is now simpler, but because we are now comparing different but equal environments, I added equality and hash to node/environment to facilitate this. This in turn broke tests, because of Puppet::Node::Environment#known_resource_types which caches using the global $known_resource_types. Previously this would always clear itself when called if $known_resource_types.environment != self, but with the new node equality, state was now leaking between tests. The test_helper now sets $known_resource_types nil after each test.
2014-02-11(maint) Fix regexp with unescaped { causing warning when running testsHenrik Lindberg1-1/+1
2014-02-06(PUP-1574) Environment setting does not override apply/parser manifestJosh Partlow1-23/+39
Both `puppet apply` and `puppet parser validate` were relying on the legacy environment behavior to implicit draw in the setting of Puppet[:manifest]. But the new directory environments do not pay attention to Puppet[:manifest] and thus a call such as `puppet apply foo.pp --environment dir_env` would not apply foo.pp if dir_env was in the $environmentpath. This change explicitly creates a new environment based off the currently configured environment and overrides with the manifest this to be applied or validated.
2014-01-29(PUP-1118) Stop using Environment.newAndrew Parker1-8/+10
Instead of creating environments directly, we need to go through the configured environment loaders, otherwise environments can't come from other places.
2014-01-17(PUP-1118) Move global context methods to PuppetAndrew Parker1-2/+2
This moves the global context handling out of the Puppet::Context class and onto the Puppet module, which allows Puppet::Context to be a more generic, overridable context system. It also allows references to context information to be a little bit shorter. This doesn't tackle making settings information available in the context, and so there might be a little confusion between Puppet[] and Puppet.lookup.
2014-01-16(PUP-1118) Introduce "create" to make specific environmentsAndrew Parker1-28/+42
Environments are more than just a name, they are also a modulepath and a manifest. This commit makes a "create" method for setting up environments with specific modulepaths and manifests rather than relying on the Puppet Settings at the time that methods are called. In order to control environments for module installation they now take advantage of this in order to control the modulepath that things will be installed into.
2013-12-17(#23373) Restore 'all' functionalityAndrew Parker1-0/+6
The "puppet config print" command used to take a special "all" parameter, but it was lost at some point during the refactoring of the implementation. This restores the ability to print "all" settings.
2013-12-12(#23373) Add section control to the config print actionAndrew Parker1-16/+25
This exposes the lookup facilities that are used inside the settings infrastructure in a manner that allows looking up values from the perspective of individual sections. This functionality is then exposed to the end user as the --section option on the `config print` subcommand.
2013-09-30(Maint) Create spec coverage for parser faceAndrew Parker1-0/+54
The parser face had no spec test coverage. This creates some coverage around the code. This coverage replaces what is currently being done in an acceptance test.
2013-07-11(maint) Fix rspec warningsPatrick Carlisle1-2/+2
Running specs with rspec 2.13 caused a lot of warnings. Many of them actually exposed preexisting bugs, the most common being a syntax error when expecting an Exception. These are worth fixing even if we don't bump to rspec 2.13.
2012-12-07(#7316) Refactor listing and requiring of applicationsJosh Cooper1-7/+5
Previously, the logic for listing and requiring applications was in two places, CommandLine and Application, respectively. The CommandLine contained logic, basically duplicated from the Autoloader, to walk a search path and generate a list unique applications relative to 'puppet/application'. The Application contained logic for requiring the application from 'puppet/application', duplicating the logic from CommandLine. This commit moves the logic for listing available applications to the Application class, which delegates to its autoloader. Note the autoloader already takes gem and module paths into account, so no change in functionality there. This commit also deprecates the CommandLine available_subcomands instance and class methods.
2012-10-04Revert "Merge pull request #1190 from ↵Jeff McCune18-47/+30
jeffmccune/fix/master/7316_load_faces_from_modulepath_try4" This reverts commit bdda511d06ed6f89b58343e815585957a33db94e, reversing changes made to 8f9699cee0d1028d538b0a26aa5bc885751b6d46. Conflicts: lib/puppet/settings/config_file.rb
2012-09-26Revert "Revert "Merge branch 'fix/3.x/7316_load_faces_from_modulepath_try3' ↵Jeff McCune18-30/+47
into 3.x"" This reverts commit ef3fe695fd0be5ff2b5aeb563f34f62a0f503831.
2012-09-26(Maint) Remove rspec from shebang lineJeff McCune18-18/+18
Without this patch Ruby 1.9 is still complaining loudly about trying to parse the spec files. The previous attempt to clean up this problem in edc3ddf works for Ruby 1.8 but not 1.9. I'd prefer to remove the shebang lines entirely, but doing so will cause encoding errors in Ruby 1.9. This patch strives for a happy middle ground of convincing Ruby it is actually working with Ruby while not confusing it to think it should exec() to rspec. This patch is the result of the following command run against the source tree: find spec -type f -print0 | \ xargs -0 perl -pl -i -e 's,^\#\!\s?/(.*)rspec,\#! /usr/bin/env ruby,'
2012-09-25Revert "Merge branch 'fix/3.x/7316_load_faces_from_modulepath_try3' into 3.x"Andrew Parker18-47/+30
This reverts commit b277bb3874ecd50e1cd6e600bf6d36e3240d5510, reversing changes made to bdf193640701e9a107b1c6f6661499b31fdefb4d. These changes are being backed out because they referenced a undefined methods (`default_global_config_dir` and `default_global_var_dir`). After fixing that locally, there was still a problem with `puppet help` printing out a large number of warnings because it could not load face code correctly. I think we need to step back from this, re-evaluate what is happening, and try a new approach.
2012-09-24Revert "Merge branch 'revert/3.x/faces_from_modulepath' into 3.x"Jeff McCune18-30/+47
This is a "revert-the-revert" commit. This reverts commit 87ea7a8849f90a232f2bb683fb8a2ce1573a21db, reversing changes made to 8dff14b9c5a3cdd99ede63dbcbb2dbe00b457926.
2012-09-21Revert "Merge branch 'fix/3.x/fix_puppet_face_failures' into 3.x"Jeff McCune10-30/+10
This reverts commit 8dff14b9c5a3cdd99ede63dbcbb2dbe00b457926, reversing changes made to 8b059a9a9e7c765d3050163ca59abeffe3e297b5. Revert the modulepath face loader change set for the following reason: This change set is intended to load faces from the module path. It works great... _if_ you explicitly set --confdir on the command line like I do with my zsh puppet() function. If you don't, then it blows up because the global for the confdir is set by defaults at a different enough point in the code for us to overlook the issue. If we invest in removing global state, specifically Puppet.settings, I think we'll see a very quick return. The confdir setting should be "available" for use at the same point, regardless of where it comes from; defaults, puppet.conf, CLI, or (hopefully) the environment.
2012-09-21Revert "Merge branch 'fix/3.x/7316_load_faces_from_modulepath' into 3.x"Jeff McCune8-17/+20
Revert the modulepath face loader change set for the following reason: This change set is intended to load faces from the module path. It works great... _if_ you explicitly set --confdir on the command line like I do with my zsh puppet() function. If you don't, then it blows up because the global for the confdir is set by defaults at a different enough point in the code for us to overlook the issue. If we invest in removing global state, specifically Puppet.settings, I think we'll see a very quick return. The confdir setting should be "available" for use at the same point, regardless of where it comes from; defaults, puppet.conf, CLI, or (hopefully) the environment. This reverts commit 8b059a9a9e7c765d3050163ca59abeffe3e297b5, reversing changes made to 7c3b620182602012b191a5b5ade7b1df5cbc8b19.
2012-09-20(Maint) Fix spec failures with Puppet::Face[]Jeff McCune10-10/+30
Without this patch the describe blocks are being executed before the spec helper before hooks. This is problem because the Puppet::Face.find method now searches the modulepath. The modulepath setting is not yet initialized when the subject of the describe block is evaluated. This patch fixes the problem by explicitly setting the subject inside the example groups. Doing so delays evaluation of the find method until after settings have initialized. I suppose all of this could be summed up as, "Load faces after settings have been initialized by the spec helper, not before." Paired-with: Andrew Parker <andy@puppetlabs.com>
2012-09-20(#7316) Load applications from the modulepathJeff McCune8-20/+17
Without this patch Puppet does not search the modulepath lib subdirectories for application subcommands. This is a problem because face applications that aren't affected by #3947 should work. This patch fixes the problem by searching through the modules along the modulepath to find available subcommands in addition to those available along the Ruby $LOAD_PATH and RubyGems $GEM_PATH. Both legacy application files and modern face applications are loaded from the modulepath with this patch. This patch does _not_ add the module's `lib/` subdirectory to the $LOAD_PATH, so issue #3947 will still affect face applications that attempt to use `require` with library files inside the module.
2012-09-14(#16189) Make --run_mode a global option and not a settingHenrik Lindberg1-1/+1
In #16189 the problem is described as config print and --configprint disagree. That problem was caused by the option --mode RUNMODE defined in FaceBase not having any effect thus making 'user' be the only runmode available to any Face. Rather than implementing another way of modifying the run_mode (as attempted in FaceBase), this commit makes the previously 'read-only' global setting --run_mode settable from the command line and promotes it from being a setting to a special case around the loading of settings. In order to make this global run_mode the default, the Application class now picks up the default from Settings (where run_mode is handled), and thus the default becomes either the runmode set from the command line, or 'user' which Settings has a fallback (default default). Applications (such as Master) can still set run_mode as part of application initialization - it works as before. Unused/non working code relating to this is removed. Documentation referring to --mode updated.
2012-08-13Merge branch 'ticket/3.x/11870-other-package-types' of ↵Hailee Kenney1-34/+29
https://github.com/joshcooper/puppet into 3.x
2012-08-08Merge branch '2.7.x' into 3.xPatrick Carlisle2-0/+0
* 2.7.x: Add Puppet::Parser::Functions::clear for specs Clear Environment.current when calling Environment.clear Check that function loading worked correctly. Avoid stubbing Thread::new due to issues in newer mocha Rename specs to end in _spec.rb Don't require mocha in spec_helper Fix stubbing on nil in some specs (#14515) Tests fail with mocha 0.11.4 Conflicts: spec/unit/network/http/webrick_spec.rb spec/unit/parser/functions/require_spec.rb spec/unit/parser/functions/template_spec.rb
2012-08-08Rename specs to end in _spec.rbPatrick Carlisle3-0/+0
2012-07-31(Maint): Re-enable tests on WindowsJosh Cooper1-34/+29
These tests now pass on Windows. Removed the `pending` block and re-indented, no code changes.
2012-07-24Use rspec 2.11 compatible block syntaxPatrick Carlisle3-26/+27
In rspec 2.11, expectations on a block must take the form of expect...to or lambda...should. Other combinations of those are no longer accepted. This commit converts all mixed cases to use expect...to, as it seems to be the preferred syntax now.
2012-07-24Merge branch '2.7.x' into 3.xPatrick Carlisle2-12/+14
* 2.7.x: Use rspec 2.11 compatible block syntax Conflicts: spec/integration/faces/ca_spec.rb spec/integration/network/server/mongrel_spec.rb spec/unit/application_spec.rb spec/unit/face/help_spec.rb spec/unit/network/handler/fileserver_spec.rb spec/unit/parser/functions/create_resources_spec.rb spec/unit/provider/nameservice/directoryservice_spec.rb spec/unit/type/file_spec.rb spec/unit/type_spec.rb
2012-07-23Use rspec 2.11 compatible block syntaxPatrick Carlisle3-26/+27
In rspec 2.11, expectations on a block must take the form of expect...to or lambda...should. Other combinations of those are no longer accepted. This commit converts all mixed cases to use expect...to, as it seems to be the preferred syntax now.
2012-07-23Reduce stubs and expectations on settingsPatrick Carlisle1-1/+1
Many tests set stubs or expectations on configuration values. This is unnecessary, as settings are reset before each test. Because creating a stub stubs out the entire value method on settings, stubbing any individual setting interferes with retrieving any other setting. This makes for weird errors and fragile tests. This commit changes most cases to just set each setting directly. Expectations on settings were often used to verify that a setting is used. This is not a good way of testing this, since it checks that the value is accessed but not that it is actually used correctly. Most expecations on settings are better expressed by changing the setting and then verifying a returned value.
2012-07-16(#15533) Change puppet module build to build the module in cwd (or parents)Ken Barber1-0/+68
Previously 'puppet module build' required a full path to build a module. This change will add the ability to run the command from within a module itself and have the package built correctly. Through changes to find_module_root it will also support running the command is a sub-directory of the module as well. Due to some lack of system and unit testing, I've added that as well as part of this patch and included tests for the new behaviour.