summaryrefslogtreecommitdiffstats
path: root/spec/unit
Commit message (Collapse)AuthorAgeFilesLines
...
* | | (#5375) Rework puppet apply to use configurer.runPaul Berry2010-12-162-11/+11
| | | | | | | | | | | | | | | | | | | | | Puppet apply used to contain code that duplicated the functionality of configurer.run. Refactored to share code. Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
* | | Merge branch 'ticket/2.6.4/5566' into 2.6.nextJesse Wolfe2010-12-161-1/+9
|\ \ \ | |_|/ |/| |
| * | Fix #5566 none, mtime, and ctime checksum types can write file contentsJesse Wolfe2010-12-161-1/+9
| |/ | | | | | | | | | | | | The #write method in lib/puppet/type/file/content.rb relies on the block passed to #sum_stream getting executed. "none", "mtime", and "ctime" aren't real checksums, so they violated that assumption and just returned empty results. This patch causes that block to get executed.
* | maint: Fix ActiveRecord confine issueMatt Robinson2010-12-161-12/+15
| | | | | | | | | | | | | | | | | | We made a class that inherited from ActiveRecord, but did so outside a block so the confine wasn't skipping it when ActiveRecord wasn't installed. Moving that class inside a before block caused the confine to work properly. Paired-with: Nick Lewis
* | maint: Fix a test that was missing a requireMatt Robinson2010-12-162-0/+2
| | | | | | | | Paired-with: Nick Lewis
* | maint: Fix tests that don't run on their ownMatt Robinson2010-12-1611-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From the spec directory I found all the specs that fail when run on their own. for TEST in `find . -name "*.rb" -type f`; do spec $TEST > /dev/null 2>&1 if [[ $? != 0 ]]; then echo $TEST fi done All of them were cases of missing requires. Paired-with: Nick Lewis <nick@puppetlabs.com>
* | Merge branch 'ticket/2.6.next/4487' into 2.6.nextNick Lewis2010-12-131-11/+26
|\ \
| * | (#4487) Fix environment column in hosts tableNick Lewis2010-12-131-11/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An entire environment object was being stored in a string field, causing the ZAML form of the environment to be stored. This was over-ridden to return just the ZAML serialized version of the name. Since the hosts model didn't know how to interpret a serialized value, it just returned the ZAML string as the environment. This patch stringifies the environment before putting it in the hosts table, which stores it properly. This patch also introduces a new method of testing using Tableless ActiveRecord models, which emulate their database schema. This helps to eliminate some stubbing, but it is still impossible to fully and accurately test all ActiveRecord interactions without a real database. Paired-With: Matt Robinson
* | | maint: restore plugin handler safetyJesse Wolfe2010-12-131-0/+4
| | | | | | | | | | | | | | | | | | | | | The previous maintenance patch for this file didn't provide as strong of a guarantee of loading plugins as the code it replaced. This patch restores the extremely broad exception catching, but prevents mocha exceptions from being silently ignored.
* | | (#5408) Attributes can be both audited and managedJesse Wolfe2010-12-102-71/+197
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes it possible to both audit and manage an attribute. It introduces a new field on Event objects "historical_value", which is the value from state.yaml. The value from the RAL is written to state.yaml, and then the RAL is updated with the desired value. Paired-With: Nick Lewis <nick@puppetlabs.com> Paired-With: Matt Robinson <matt@puppetlabs.com>
* | | maint: missing stubJesse Wolfe2010-12-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This missing stub was raising an exception that, in versions of Mocha less than 0.9.10, was coincidentally causing the method under test to behave as expected. Paired-With: Nick Lewis <nick@puppetlabs.com>
* | | maint: missing stubJesse Wolfe2010-12-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This missing stub was raising an exception that, in versions of Mocha less than 0.9.10, was mistaken for the exception that was being tested for. Paired-With: Nick Lewis <nick@puppetlabs.com>
* | | maint: missing line and filename stubsJesse Wolfe2010-12-101-1/+1
| | | | | | | | | | | | Another missing stub exposed by Mocha 0.9.10
* | | maint: Fully stub partially stubbed test.Jesse Wolfe2010-12-101-0/+2
| | | | | | | | | | | | | | | | | | This test was succeeding in versions of Mocha before 0.9.10, because the Mocha expectation exceptions were being incorrectly interpreted as if they were File Not Found exceptions.
* | | maint: remove Puppet.settings stubsJesse Wolfe2010-12-101-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | This test was stubbing Puppet.settings, instead of setting the values directly. Exceptions thrown by trying to read other settings were getting swallowed when running a version of Mocha older than 0.9.10. Paired-With: Nick Lewis <nick@puppetlabs.com>
* | | maint: test was expecting Catalog.find too few timesJesse Wolfe2010-12-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Our code calls Catalog.find multiple times, but this stub did not allow that. The resulting error was silently ignored on versions of Mocha before 0.9.10 Paired-With: Nick Lewis <nick@puppetlabs.com>
* | | maint: broken test not failing due to over-eager exception catchingJesse Wolfe2010-12-101-1/+1
| | | | | | | | | | | | | | | | | | | | | A test was not testing what it claimed, but the failure exception was getting swallowed by an unnecessarily broad rescue match. Paired-With: Nick Lewis <nick@puppetlabs.com>
* | | Fix #1757 Change file mode representation to octalJesse Wolfe2010-12-082-5/+5
|/ / | | | | | | | | | | This patch changes the internal representation of a file's mode to a string instead of an integer. This simplifies the problem of displaying the value consistently throughout all of puppet.
* | Merge branch 'ticket/2.6.next/4943' into 2.6.nextNick Lewis2010-12-022-0/+87
|\ \
| * | (#4943) Add puppet inspect applicationNick Lewis2010-12-022-0/+87
| |/ | | | | | | | | | | | | | | | | "puppet inspect" will load the locally stored YAML catalog and record the current state of the audited properties in the catalog. It uses settings specified in the [agent] configuration section, and will send its inspect report to the specified server. Paired-With: Jesse Wolfe
* | (#5261) Fix #5261 Don't escape Unicode characters in PSONJesse Wolfe2010-12-021-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the escaping of valid UTF-8 sequences as "\uXXXX". This code was unreliable, as it relied on Iconv's ability to convert those codepoints between UTF-8 and UTF-16, but some versions of Iconv barf on some valid codepoints. Invalid UTF-8 sequences are still passed through unchanged. We believe that this is fine; if you are concerned about complience with the JSON standard, what we are doing is equivalent to: * interpreting binary files as Latin-1 encoded character sequences * JSON-encoding those characters according to RFC 4627 * outputting the JSON as Latin-1 This allows all raw binary files to be transmitted losslessly. Paired-With: Paul Berry <paul@puppetlabs.com>
* | [#5081] Revert "Fix #4349 - Parsing with ignoreimport=true was always ↵Matt Robinson2010-12-011-8/+0
|/ | | | | | | | | | | | | | | | | | | | loading site.pp" The fix for #4349 caused --parse-only not to detect syntax errors when --ignore-import was used by adding a return statement that bypassed the initial import: commit 760e418d254a8d2198d2c6eb466d783a5930ef47 def perform_initial_import + return if Puppet.settings[:ignoreimport] The problem that #4349 fixed was more generally fixed in commit 99c1019e1d3402ec8e476dc859d5aaef82ec4f69 for ticket #4798 so the return statement is no longer needed, so reverting the commit for #4349 does not reintroduce the problem of an import loop error when running puppet doc. Paired-with: Jesse Wolfe
* Disable remote ralsh by defaultPaul Berry2010-12-021-1/+0
| | | | | | | Changed the default auth.conf so that accesses to "/resource" are no longer allowed. This means that to use "puppet resource -H" you will need to configure the target machine to enable access to the "/resource" URLs.
* 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-164-13/+13
|
* (#5297) Fix schedule tests that were missing stubs for Time.nowMatt Robinson2010-11-161-0/+4
| | | | Reviewed-by: Jesse Wolfe <jesse@puppetlabs.com>
* Fix for #4299 -- Don't require whichMarkus Roberts2010-11-122-15/+8
| | | | | | 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 #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 #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-101-4/+22
| | | | | | | | | | | | | | | | | | | | | 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-083-9/+5
| | | | | | | Standardize how we create tmpdirs by using the puppet function instead of Dir.tmpdir. Paired-with: Paul Berry <paul@puppetlabs.com>
* (#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.
* Fix for #4832 -- Making PSON handle arbitrary binary dataMarkus Roberts2010-10-131-0/+17
| | | | | | | | | The PSON library needlessly assumed that the data to be transmitted was well- formed unicode. This made Latin-1 users (and anyone who needed to serialize arbitrary binary data) sad. This patch goes some of the way to resolving the issues, by passing through non-unicode data rather than just failing, adds tests, and cleans up a pernicious assumption about escape characters in ruby regular expressions not marked "n" (no-encoding).
* Minimal fix for #4975 -- only call chage when managing password age rulesMarkus Roberts2010-10-131-0/+42
| | | | | This is intended to be a minimal fix, with tests, to prevent chage from running unless needed.
* Fix for #4963 -- Use correct commands for password expiry on solarisMarkus Roberts2010-10-131-1/+1
| | | | | This fixes the command / option issues of #4963 as suggested on the ticket; the setting-expiry when not needed aspects are deferred to #4975.
* Fix for #4896 -- stray newline left over from removed diagnosticMarkus Roberts2010-09-301-1/+2
| | | | | A newline that was part of a diagnostic was left in, and this caused problems with the serialization of strings in "preserve newlines" mode.
* Improvement to #4025: made spec tests work on all platformsPaul Berry2010-09-291-1/+3
| | | | | | The spec test changes for ticket 4025 (binary plist support) failed on non-OSX systems because of a missing stub. Added the missing stub so that the spec tests can now run on all systems.
* Adds #3046 - support for password min/max ageNick Lewis2010-09-293-2/+33
| | | | | | | This adds a new feature to user providers "manages_password_age", along with properties password_min_age and password_max_age to the user type. These represent password min and max age in days. The useradd and user_role_add providers now support these new properties.
* [#4783] (#4783) Fix RRDGraph report generationMatt Robinson2010-09-292-1/+31
| | | | | | | | The code made assumptions about report structure that weren't valid for 2.6.x. The change has been verified to work with 0.25.x and 2.6.x report formats. Paired with: Rein Henrichs
* Add user account expiry to the useradd type and providerDean Wilson2010-09-292-1/+24
|