summaryrefslogtreecommitdiffstats
path: root/spec
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | Fix #4339 - Save a last run report summary to $statedir/last_run_summary.yamlBrice Figureau2010-11-133-7/+97
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Once a configuration run is done, puppetd will save on the node a yaml summary report roughly akin to: --- time: notify: 0.001025 last_run: 1289561427 schedule: 0.00071 config_retrieval: 0.039518 filebucket: 0.000126 resources: changed: 1 total: 8 out_of_sync: 1 events: total: 1 success: 1 changes: total: 1 This is almost an hash version of the current --summarize output, with the notable exception that the time section includes the last run unix timestamp. The whole idea is to be able to monitor locally if a puppetd does its job. For instance this could be used in a nagios check or to send an SNMP trap. The last_run information might help detect staleness, and this summary can also be used for performance monitoring (ie time section). The resource section can also show the number of failed resources. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | | | Maint: Switched spec tests to use a class rather than Array as the log ↵Paul Berry2010-11-182-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | destination. Using an Array as a log destination is unreliable because Puppet's log mechanism stores log destinations in a hash whose key is the destination itself. Since arrays can change their hash when they are modified, this was causing the log destination hash to become corrupted, producing sporadic spec test failures.
* | | | Maint: Improved spec testsPaul Berry2010-11-182-15/+12
| | | | | | | | | | | | | | | | | | | | | | | | In configurer_spec.rb, replaced some mock classes with actual Puppet::Transaction::Report objects. In log_spec.rb, stopped using the Array type as a log destination, since doing so was unreliable.
* | | | maint: Fix intermittent parser spec failuresNick Lewis2010-11-171-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | The variable 'ast' was being used as shorthand for Puppet::Parser::AST, but a test was also trying to use it as a local variable, causing problems.
* | | | Merge branch 'ticket/next/5274' into nextNick Lewis2010-11-172-0/+279
|\ \ \ \
| * | | | (#5274) New tests for new hosttype/parsedproviderStefan Schulte2010-11-172-3/+45
| | | | | | | | | | | | | | | | | | | | | | | | | Just a few additional tests for the new property "comment" of the host type.
| * | | | (#5274) Tests for hostprovider removes commentsStefan Schulte2010-11-172-0/+237
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I noticed that the hostprovider will remove all inline comments from the /etc/hosts file, when puppet updates at least one entry. Puppet will also remove comments from entries, the user doesnt want to manage with puppet. To split up changes a bit this commit will only introduce tests for the host type and the hostprovider. A few will fail, indicating the bug: The hostprovider parses all entries and builds a hash. When building the recordhash all comments are discarded. When puppet has to update at least one entry it uses the to_line function to convert the record hash back to a file. Because the comments are not stored in the hash, they cannot be written back to the file.
* | | | Merge commit '2.6.3' into nextPaul Berry2010-11-1723-169/+339
|\| | | | | | | | | | | | | | | | | | | | | | | Resolved conflicts manually: spec/integration/indirector/bucket_file/rest_spec.rb spec/integration/indirector/certificate_revocation_list/rest_spec.rb
| * | | [#5322] (#5322) Remove spec file that adds little value and causes failuresMatt Robinson2010-11-161-533/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | spec/integration/indirector/rest_spec.rb has been deleted in puppet’s next branch because it was found that the things being tested were already covered in spec/unit/network/http/*. Also, the tests being deleted were so overly mocked they weren’t testing much, and firing up webrick as part of the tests was slow and causes intermittent failures on Hudson. This was discussed on the dev mailing list in the really long thread "No puppet developer patches to the puppet-dev list". Reviewed-by: Jesse Wolfe <jesse@puppetlabs.com>
| * | | Fix for #4279 -- mount detection on HP-UXMarkus Roberts2010-11-161-1/+8
| | | | | | | | | | | | | | | | | | | | This is based on the discussion on ticket, simplified slightly and with test adjustment.
| * | | Fix for #5298 -- Collections need to do type lookupMarkus Roberts2010-11-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the responsibility for type-name resolution was moved to the AST nodes in commit 449315a2c705df2396852462a1d1e14774b9f117, at least one instance was missed: the space ship operator Myclass <<| tag == foo |>> fails unless Myclass has been previously loaded. This commit adds the lookup to AST::Collection nodes in the same way it was added to the other node types. Note that I haven't audited the other note types for similar cases.
| * | | Fixed #5296 - test warnings messagesJames Turnbull2010-11-165-14/+14
| | | |
| * | | (#5297) Fix schedule tests that were missing stubs for Time.nowMatt Robinson2010-11-161-0/+4
| | | | | | | | | | | | | | | | Reviewed-by: Jesse Wolfe <jesse@puppetlabs.com>
| * | | Fix #5289 -- Bad copy/paste changes message on test failureMarkus Roberts2010-11-133-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In my fix for #4894 (commit a097b939ab52bafb681cf7c5dcaf11717add07e6) I made and tested the fix in one case and then copied most of it (all but a variable initialization, Doh!) to two other locations. This caused tests that would have failed with a socket-in-use error to fail with a different error rather than retrying. Also fixed the spelling of "simultaneous."
| * | | Fix for #4299 -- Don't require whichMarkus Roberts2010-11-123-18/+9
| | | | | | | | | | | | | | | | | | | | | | | | We already had an internal implementation of which hiding under an assumed name (Puppet::Util.binary); this commit calls it out of hiding and uses it consisantly.
| * | | Fix #5020 - Prefer finding node name from REST uri over certnameBrice Figureau2010-11-121-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a behavior change. Before this patch, we always used the currently connected node's certname to compile the catalog, despite the value of the catalog URI REST request. With this patch we now use the URI as the compiled node name. This is safe because the default auth.conf (and default inserted rules when no auth.conf is present) only allow the given connected node to compile its own catalog. But this also allows for greater flexibility with auth.conf. For instance it can be used by a monitoring system to check multiple nodes catalogs with only one certificate: path ~ ^/catalog/([^/]+)$ method find allow $1 allow monitoring-station.domain.com Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * | | Fix for #4894 -- retry tests if port is in useMarkus Roberts2010-11-123-6/+28
| | | | | | | | | | | | | | | | | | | | | | | | If multiple processes are running the spec tests they may conflict trying to listen on a port. If this happens the test waits 0.1 seconds and retries for up to 100 times before marking the test pending due to too many conflicts.
| * | | Fix for #4955 -- Race condition & memory leak in Puppet::UtilMarkus Roberts2010-11-123-39/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Puppet::Util.sync method was not thread safe and also leaked memory. I'm not certain, but I believe the first is ironic and the second is merely a bug. This patch addresses the problem by 1) refactoring so the sync objects are never returned (and thus no one can cache a reference to one) 2) adding reference counting 3) deleting them when they are no longer needed 4) doing the thread safty dance. It wasn't the first (or even second) solution considered, but it's the one that I was able to make work in a way that I'm convinced is correct. Its main advantage is that it puts all the tricky bits in one place.
| * | | Fix #4921 - race condition in Parser Functions creationBrice Figureau2010-11-121-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The autoloading is not thread safe, which means two threads could both autoload the same function at the same time. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * | | Fix #5252 - line number mis-attribution during parsingBrice Figureau2010-11-111-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is a resurgence of #2366 that appeared because of the commit 8971d8. Before this commit, for associating documentation comments, we were preferring line numbers coming from the parser currently reducing rule, instead of the current lexer line number (which can be in advance of several tokens due to the nature of LALR parsers). We now merge the ast line number before fetching the comment from the lexer. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * | | Fix for #2568 -- Add a dbconnections option to set AR pool sizeMarkus Roberts2010-11-101-0/+74
| | | | | | | | | | | | | | | | | | | | The dbconnection option, if set to a positive integer, will be passed to active record as the connection pool size (pool).
| * | | Maint. Removing code for which no CLA has been signedMarkus Roberts2010-11-101-22/+8
| | | | | | | | | | | | | | | | | | | | Multiple attemps were made to contact the author of this code in order to obtain a Contributor Licence Agreement, but we were unable to do so.
| * | | Fix #4923 - close process race when truncating existing fileBrice Figureau2010-11-102-15/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using File.open(file, "w") calls open(2) with O_CREAT|O_TRUNC which means when the file exists it is immediately truncated. But the file is not locked yet, so another process can either write or read to the file, leading to file corruption. The fix is to truncate only when the file is exclusively locked. This can be done on some operating system with O_EXLOCK open(2) flag. I chose the more portable option of: * open * flock * truncate * write * close It might also be good to flush and fsync the file after writing it, otherwise in case of crash an incomplete file can stay on disk. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * | | (#4573) FreeBSD service provider now supports versions <7 and >8Nick Lewis2010-11-101-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Running "/etc/rc.d/SERVICE rcvar" outputs different formats for different versions of FreeBSD. This patch adds support for those formats, as well as tests. Based on patches from: o Joost van Beurden o Russell Jackson Paired-With: Matt Robinson
| * | | Fix #3808 - puppetdoc should use --force-update only if RDoc supports itBrice Figureau2010-11-101-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | This should allow to run puppetdoc on ruby 1.8.5. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * | | Fix #5127 - error when accessing array elementsBrice Figureau2010-11-101-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Accesing an array with an integer index (ie $array[1]) is producing a ruby error: can't convert String into Integer This is because the array index is not properly converted to an number before the array element lookup is performed. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * | | (#5242) Fix schedule specs that fail near daylight savingsMatt Robinson2010-11-101-43/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I fixed a few of these in a previous patch, but Hudson found more. I replaced the pattern of using Time.now and then doing date math to calculate intervals with the pattern of hard setting the intervals using utc times for the test. Reviewed-by: Paul Berry <paul@puppetlabs.com>
| * | | [#5225] Fix spec failure that depended on time changeMatt Robinson2010-11-081-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Turns out that: zero = Time.now # Reset the current time to X:00:00 current = zero - (zero.hour * 3600) - (zero.min * 60) - zero.sec current is actually 1am on a day where the time falls back (Nov 7th), not midnight as the test expected. Reviewed-by: Paul Berry <paul@puppetlabs.com>
| * | | (#5233) Randomize tmp dir pathsMatt Robinson2010-11-084-10/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Standardize how we create tmpdirs by using the puppet function instead of Dir.tmpdir. Paired-with: Paul Berry <paul@puppetlabs.com>
* | | | Merge branch 'ticket/next/4590' into nextMarkus Roberts2010-11-174-24/+257
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: lib/puppet/util/monkey_patches.rb -- two unrelated additions had been made, kept them both.
| * | | | [#4590] SimpleGraph is slowPaul Berry2010-10-074-24/+257
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrote SimpleGraph to use a more efficient internal representation. To preserve compatibility with older clients, graphs are still serialized to YAML using the format used by Puppet 2.6. However, a newer, more compact format can be enabled by setting "use_new_yaml_format" to true. Deserialization from YAML accepts either the old 2.6 format or the newer format. In a later release, once we no longer need to be compatible with 2.6, we will be able to switch to the new format. To make deserialization accept multiple formats, it was necessary to use the yaml_initialize method. This method is not supported in versions of Ruby prior to 1.8.3, so a monkey patch is included to add support for it to Ruby 1.8.1 and 1.8.2. Thanks to Markus Roberts for the SimpleGraph rewrite. Thanks to Jesse Wolfe for figuring out how to write the yaml_initialize monkey patch.
* | | | | Merge branch 'feature/next/3747' into nextNick Lewis2010-11-111-0/+50
|\ \ \ \ \
| * | | | | (#3747) Add specs for upstart providerNick Lewis2010-11-111-0/+50
| | |_|/ / | |/| | | | | | | | | | | | | Paired-With: Matt Robinson
* / | | | Fix #4904 Mounts shouldn't remount unless they are ensure=>mountedJesse Wolfe2010-11-111-5/+27
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After we fixed issue #2730, it is now possible to manage an fstab entry without asking puppet to try to call mount or unmount on that device. That fix failed to address the "refresh" behavior of mounts. We have changed "refresh" to only remount devices that are set to "mounted", so users can truly manage fstab entries without having puppet try to remount them. Paired-With: Paul Berry <paul@puppetlabs.com>
* | | | Merge branch 'feature/master/5198' into nextPaul Berry2010-11-091-1/+2
|\ \ \ \
| * | | | (#5198) Added a spec test for new TB unitPaul Berry2010-11-091-1/+2
| | | | |
* | | | | Merge remote branch 'jamtur01/tickets/2.6.x/5108' into nextPaul Berry2010-11-091-0/+4
|\ \ \ \ \
| * | | | | Fixed to #5108 - Change default of service hasstatus property to trueJames Turnbull2010-10-271-0/+4
| | | | | |
* | | | | | Merge commit '2.6.3rc2' into nextPaul Berry2010-11-094-117/+164
|\ \ \ \ \ \ | | |_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | Manually resolved conflicts: lib/puppet/parser/ast/resource.rb spec/unit/parser/ast/resource_spec.rb
| * | | | | (#4534/#4778) -- Normalize parameterized classesPaul Berry2010-10-273-109/+154
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a reconciliation/melding of Paul's (#4534) Class inheritance with parameterized classes is no longer ignored and Markus's Fix for #4778 -- evaluate parameterized classes when they are instantiated Extracted the code from Resource::Type#mk_plain_resource that evaluates parents and tags the catalog, and moved that into a new method called instantiate_resource. Instantiate_resource is now also called from Parser::Ast::Resource#evaluate, so that the notation "class { classname: }" now executes this code too. Likewise adds class evaluation so that it behaves the same (with regard to lazy / strict evaluation) as include classname
| * / / / Fix for #5022 -- Escaped newlines should be elidedMarkus Roberts2010-10-181-0/+1
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was a regression, not covered by a test; previously the string "foo\ bar" would be interpreded as "foobar" but this was changed to "foo\\\nbar" in 2.6.x with my string interpolation refactor. This change restores the behaviour.
* | | | Maint: remove unnecessary stubbing from agent_specPaul Berry2010-11-091-20/+21
| | | | | | | | | | | | | | | | | | | | | | | | The agent spec tests were stubbing out all methods related to Puppet settings, making it difficult to keep these tests maintained. The tests now function by setting the settings in question.
* | | | Maint: Remove Indirector::Request objects from HTTP Handler and API V1Jesse Wolfe2010-11-0210-1072/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a maintenance refactor to reduce the dependencies between the rest API and the implementation of the Indirector. The HTTP Handler code was creating temporary Request objects that were not actually being passed to the Indirector.
* | | | (#5166) Inventory service is now searchable by timestamp.Paul Berry2010-11-011-0/+103
| | | | | | | | | | | | | | | | | | | | It is now possible to specify queries in the form “meta.timestamp.xx” where xx is eq,ne,gt,lt,ge,le when searching the inventory service.
* | | | Refactored Puppet::Node::Inventory::Yaml tests in preparation for adding ↵Paul Berry2010-11-011-21/+9
| | | | | | | | | | | | | | | | freshness check
* | | | Fix #5164 Change Facts timestamp when they are received by the masterJesse Wolfe2010-11-011-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch causes the puppet master to re-timestamp facts when they are received by the catalog compiler terminus. This makes the timestamps more trustworthy, as it means that they are all based upon the same clock's time. Paired-With: Paul Berry <paul@puppetlabs.com>
* | | | Maint: Don't use a stub for a Facts object in the compiler specsJesse Wolfe2010-11-011-1/+2
| | | | | | | | | | | | | | | | | | | | The catalog compiler spec was overstubbing the Node::Facts object, making it hard to test the interaction between those two systems.
* | | | Maint: spec/unit/indirector/catalog/compiler_spec.rb wouldn't run by itselfJesse Wolfe2010-11-011-0/+1
| | | | | | | | | | | | | | | | Require puppet/rails so we can run this test alone.
* | | | [#4894] Randomize port on webrick testsMatt Robinson2010-10-282-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This isn't a great test fix, but it should be enough for now to stop the sporadic test failures in Hudson where webrick isn't releasing it's port which causes other tests to fail. I created ticket #5098 as a reminder to refactor these tests later. Reviewed-by: Paul Berry
* | | | (#5132) Provide a query REST interface for inventoryMatt Robinson2010-10-285-7/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This REST interface returns a list of nodes that match a fact query. Fact queries can use (in)equality testing as a string comparison, and >, <, >=, <= numerical comparisons. Multiple tests can be done as AND comparisons, not OR. The fact queries need to be prefixed by facts, and the comparisons other than equality are specified with a .comparison_type after the fact name. This will be better explained in the REST documentation on the website. Searches that don't match anything now return empty array instead of a 404 error.