summaryrefslogtreecommitdiff
path: root/spec/unit/face/node_spec.rb
AgeCommit message (Collapse)AuthorFilesLines
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-10-04Revert "Merge pull request #1190 from ↵Jeff McCune1-3/+1
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 McCune1-1/+3
into 3.x"" This reverts commit ef3fe695fd0be5ff2b5aeb563f34f62a0f503831.
2012-09-26(Maint) Remove rspec from shebang lineJeff McCune1-1/+1
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 Parker1-3/+1
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 McCune1-1/+3
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 McCune1-3/+1
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-20(Maint) Fix spec failures with Puppet::Face[]Jeff McCune1-1/+3
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-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-07-24Merge branch '2.7.x' into 3.xPatrick Carlisle1-6/+7
* 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 Carlisle1-6/+7
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-02(maint) Standardize on /usr/bin/env ruby -S rspecJeff McCune1-1/+1
Without this patch some spec files are using `ruby -S rspec` and others are using `rspec`. We should standardize on a single form of the interpreter used for spec files. `ruby -S rspec` is the best choice because it correctly informs editors such as Vim with Syntastic that the file is a Ruby file rather than an Rspec file.
2012-03-22(#7749) doc / tests cleanupcprice1-2/+0
2012-03-20(#7749) get rid of $puppet_application_name and $puppet_application_mode globalscprice1-1/+3
This state is now handled via instance variables in the Settings class.
2011-09-05Fix tests for #1886 with ActiveRecord 3.xPeter Meier1-1/+1
We didn't properly call the method to test, which lead to a failing test. However, this couldn't be properly displayed on ruby installations with an ActiveRecord 3.x installed, as the inspect in the `after test` part, tried to examine the table, which (obviuosly) raised a NotConnected exception. By calling the method the right way, we fix the test and hence also fix the failing inspection.
2011-09-05Revert "(Maint.) Disable cleaning of storeconfigs."Peter Meier1-111/+111
This reverts commit 38801ddbd3036b45d35e48e444d1e7d566b5db47.
2011-08-30Save and restore indirector configuration around all tests.Daniel Pittman1-1/+1
One of the most persistent and troublesome parts of the Puppet codebase, in terms of testing, is the indirector. It has significant global state in the terminus and cache configuration, and that state was not being preserved between tests. Given that the runtime performance cost of doing this, other than the very ugly code it engenders, is approximately zero (less than 0.5 percent runtime), and it substantially improves correctness of testing... Now we save and restore that state around every test. Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
2011-08-17maint: Fix order dependent test failureJosh Cooper1-0/+4
The spec tests failed when running spec/unit/face/node_spec.rb followed by spec/unit/ssl/certificate_request_spec.rb, because the clean action for the node face was leaving Puppet::SSL::Host.ca_location set to :local instead of its default :none state. This commit resets the ca_location back to :none in the top-level after :all block.
2011-07-28(Maint.) Disable cleaning of storeconfigs.Pieter van de Bruggen1-111/+111
This feature (and the corresponding tests) were causing intermittent failures which we were unable to trace. We will reintroduce this behavior when we can do so without test fragility. Reviewed-By: Matt Robinson
2011-07-28(#1886) Clean up `node clean` for merge.Pieter van de Bruggen1-64/+68
This includes various style changes, and assorted fixes to testing. Paired-With: Matt Robinson
2011-07-27Fix #1886 - Add node cleanup capabilityPeter Meier1-0/+256
Here is a changeset that adds a new action to the puppet node face. This application removes all traces of a node on the puppetmaster (including certs, cached facts and nodes, reports, and storedconfig entries). Furthermore it is capable of unexporting exported resources of a host so that consumers of these resources can remove the exported resources and we will safely remove the node from our infrastructure. Usage: puppet node clean [--unexport] <host> [<host2> ...] To achieve this we add different destroy methods to the different parts of the indirector. So for example for yaml indirections we already offer read access for the yaml, this changeset adds the destroy handler which only removes the yaml file for a request. This can be used to remove cached entries. This work is based on the initial work of Brice Figureau <brice-puppet@daysofwonder.com>
2011-04-22maint: clean up test headers on face spec files.Daniel Pittman1-0/+1
A whole pile of spec files for faces were not pulling in the regular spec_helper, or the puppet/face library before they used it. This worked fine by coincidence when they ran together, but blew up if run separately. Reviewed-By: Jesse Wolf <jesse@puppetlabs.com>
2011-04-19(#7013) Strip out old face-wide rendering defaults.Daniel Pittman1-3/+1
Now we want to support action-based rendering, it is super-hard to define the semantics around defaulting where things are unspecified: the execution context (CLI, HTTP, etc) vs the face, vs the action all have different semantics. Without solving the problem of how we express all that context and those semantics down in the action, especially one written by a third party, this just becomes a box of counter-intuitive and annoying semantics and edge-cases. Reviewed-By: Max Martin <max@puppetlabs.com>
2011-04-13maint: clean up the spec test headers in bulk.Daniel Pittman1-2/+1
We now use a shebang of: #!/usr/bin/env rspec This enables the direct execution of spec tests again, which was lost earlier during the transition to more directly using the rspec2 runtime environment.
2011-04-13(#7056) Use 'face' rather than 'faces' in the production code.Daniel Pittman1-0/+9
After some discussion we decided that most uses of the Puppet Face infrastructure were about single faces on their own, not about the collection, and so we were better referring to Puppet::Face[...] in code. This implements that by translating names and references in the Ruby code to the new, s-less, name.