Age | Commit message (Collapse) | Author | Files | Lines |
|
Without this patch the spec tests are configuring sqlite in a manner
that writes the database to a file named ':memory'. This is a problem
because filesystem databases are slower than in-memory databases and the
tests are not cleaning up this file after completing.
The change in 60e78b2d36f23877dc7b50e72578ad123d62c1f0 caused this
change in behavior, likely by accident, because the database connection
string was ':memory:' and the patch changed the string to ':memory'
likely because this looks like a Ruby symbol.
This patch addresses the problem by restoring the original connection
string of ':memory:'
|
|
The activerecord based tests would setup activerecord and rails in a
manner that included stubbing. This made some things behave as you might
want, but caused some manner of getting them to behave the wrong way. By
removing the stubbing, the test cases all work from a clean database.
Another issue occured when one of the tests assumed that no other code
that used its indirection had been run prior to it. The test itself was
very questionable and ended up breaking when the tests were run in a
particular order. The test in question tried to assert that the code
would setup activerecord when it was initialized. Since all of the other
tests relied on this, and that particular behavior did not appear to be
important to the external contract of the class, the test has been
removed.
|
|
This reverts commit 751efa9174adfe1bc0a5707855e6ba16ff2aed43, reversing
changes made to 023cffdbb9b30945fbf4dcaded4f63428ce54ea7.
Conflicts:
lib/puppet/dsl/context.rb
spec/unit/dsl/context_spec.rb
|
|
This adds new Ruby DSL features by Mateusz Lenik.
This was developed as a Google Summer of Code project.
This commit contains all of the new Ruby DSL work in one single commit.
|
|
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.
|
|
* upstream/2.7.x:
(#16208): Correct spec test to match new failed parameter message
Maint: Fix inconsistent expect-should usage
Maint: Fix leaked tempfile handle
Conflicts:
spec/unit/util_spec.rb
|
|
This test failed on Windows because we were creating a tempfile, but not
closing the underlying file descriptor. So later attempts to cleanup fail
on Windows (unlike POSIX).
This commit modifies the `.tmpfile` and `#tmpfile` methods on the
PuppetSpec::Files module to accept an optional directory in which to
create the temp file.
|
|
For a bunch of local caching and retrieval, Puppet uses a YAML backed local
file terminus to store, retrieve, and search content. This is great, but the
YAML encoder is super-slow and painfully odd across Ruby versions.
Our PSON support is much more reliable, as well as substantially faster, and
is pretty much as capable. There isn't much reason, other than migration
cost, to prefer YAML to PSON encoding of data transfer documents.
Having a JSON terminus allows the user to configure, manually, the use of JSON
everywhere that we previously used YAML. While this doesn't bring the
benefits out of the box, it allows users to select this while we flush out any
lingering bugs left in the support code and system.
Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
|
|
* 2.7.x: (26 commits)
Extract host validation in store report processor
Use cross-platform absolute paths in file_serving tests
(#15221) Create /etc/puppet/modules directory for puppet module tool
(Maint:) Fix bad doc strings for two settings ("wether")
Try again to avoid circular dependency in file indirections
Remove useless tests for Envelope
Clear deprecation warnings between tests
Avoid circular requirement in FileMetadata indirection
(Maint) Document common Windows issues
Update CHANGELOG lib/puppet.rb conf/redhat/puppet.spec for 2.7.18
Maint: Note in docs that the file type's "replace" attribute defaults to true
Reject directory traversal in store report processor
Tighten permissions on classfile, resourcefile, lastrunfile, and lastrunreport.
Use "inspect" when listing certificates
Don't allow the creation of SSL objects with invalid certnames
Validate CSR CN and provided certname before signing
Add specs for selector terminuses of file_{content,metadata}
Fix whitespace inside parentheses
Use head method to determine if file is in file bucket
Always use the local file_bucket on master
...
Conflicts:
CHANGELOG
conf/redhat/puppet.spec
lib/puppet.rb
lib/puppet/application/master.rb
lib/puppet/defaults.rb
lib/puppet/file_serving/terminus_selector.rb
lib/puppet/reports/store.rb
lib/puppet/test/test_helper.rb
spec/integration/file_serving/content_spec.rb
spec/integration/file_serving/metadata_spec.rb
spec/shared_behaviours/file_serving.rb
spec/unit/file_serving/terminus_selector_spec.rb
spec/unit/network/handler/ca_spec.rb
test/ral/manager/attributes.rb
|
|
The file_serving tests were failing on windows because they used unix style
paths. This makes them absolute on both posix and windows.
|
|
|
|
|
|
|
|
|
|
The DSL for matchers doesn't actually work terribly well with the
`have_printed` matcher - rewrite it to a class to be a little smoother.
Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
|
|
This reverts commit 7ce9e17cf1077604accc1a5cfe90ad7b1bb99a55.
The change to using Pathname in fixtures is not compatible with Windows.
|
|
We used to return absolute paths to fixtures, rather than relative paths.
This made the test output uglier than it needed to be; we may as well do the
extra work to make them relative.
Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
|
|
Scoping for classes included by an ENC follow some rules that are not
immediately obvious. These tests should nail down and clarify that
behaviour
|
|
On Unix, we stored the Rails log from our StoreConfigs scratch database in
`/dev/null`, which is reasonable enough - we don't generally care for them,
and that works.
On Windows this is harder because their NUL device is magic, and it is hard to
configure the Rails logs to actually go there. The system loves to interpret
it as a random file relative to the current directory and do the wrong thing
in various test scenarios.
Ultimately, it doesn't matter if we write the logs to physical disk, and we
already had a scratch directory for the physical database - so we can throw
the logs there too.
Just another reason to use a tmpfs to back /tmp, I guess.
Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
|
|
We have some test helpers, and they allow us to create scratch files and
directories that will be politely destroyed at the end of the run.
We also have some tests that result in permissions on files being changed; we
still want those destroyed, and turning on "force" mode for the delete
operation gives us what we need with no real cost - we have plenty of other
safety factors in place.
Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
|
|
This reverts commit 6d399e087372b77566dd3737d4b444aca2e61050.
|
|
This reverts commit 7a430815424e053d6e6c5925eef711ca5edd8373, reversing
changes made to 32172d5d8de35f5cdbc31bce327b3567e078bb83.
|
|
* upstream/2.7.x: (22 commits)
Removed duplication of compiling a catalog
Cleaner test for create_resources doing nothing
Fixing problem caused by activerecord
Put back require 'puppet' in Puppet::Util
(#13299) Fix error message when agent is disabled
Update puppet.spec for rpm packaging
Fixed old log test to match new autoflush behavior
Make sure the log file writable
Default autoflushing of log files to true
Created test that shows enc warning problem
(Maint) Fix order-dependent test failure
(Maint) Don't assume eventlog gem is installed on Windows
options[:ca_location] is a string not a symbol. Safer to pull Puppet::SSL::Host.ca_location since it is already set correctly.
(#13204) Don't ignore missing PATH.augnew files
(#13640) Only agents should use next_agent_run
Increased test coverage of scoping rules
Use more descriptive terms for the differing scopes
Make new scoping look through inherited scopes
Add tests for mixed inheritence/inclusion
Remove dynamic option for lookupvar
...
Conflicts:
lib/puppet/defaults.rb
lib/puppet/parser/scope.rb
spec/unit/parser/functions/create_resources_spec.rb
spec/unit/parser/scope_spec.rb
spec/unit/resource/type_spec.rb
test/util/log.rb
|
|
Created a PuppetSpec::Compiler module for helping out testing things
that want to compile some code to a catalog
|
|
master
|
|
|
|
Major changes include:
* support multiple config files (/etc/puppet, ~/.puppet). we no longer
use "run_mode" to determine the location of the config file.
* remove all references to application run_mode/state from defaults
* make the typing of settings a little more strict
* create a new setting type for directories, to make us a little less vulnerable to the terrible matching algorithm in FileSetting
|
|
daniel-pittman/bug/2.7.x/active-record-test-failures-with-3.2.1
Bug/2.7.x/active record test failures with 3.2.1
|
|
Being able to figure out what other modules depend on a module is useful
for resolving contraints when installing and preventing uninstalls of
modules that are still required. And being able to tell if a module has
local changes is useful to prevent accidentally losing those changes
when upgrading or uninstalling a module.
|
|
Before this patch Face actions do not have the ability to set specific
exit codes. The only way to set a non-zero exit code is to raise an
exception, which sets the exit code to 1.
This patch provides the ability for Face actions to set specific exit
codes by simply calling `Kernel::exit`.
Example:
exit(2)
Calling `Kernel::exit` raises a SystemExit exception which we rescue in
the `Puppet::Application::FaceBase` class -- the base class of all
Faces, which updates the status variable used to set the exit code later
on.
This patch also includes updated specs related to this change.
|
|
Now that we have a pile of places all trying to do the same setup and
exclusion for SQLite in their tests, it pays to push all that into a central
location and make it uniformly available to all the tests.
This provides a nice, global method that can be invoked by any test suite to
configure the database, and then uses that everywhere that was doing scratch
database setup.
Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
|
|
Previously you could only access the `tmpfile` and `tmpdir` helpers by mixing
the module in somewhere, despite them exclusively mutating global state.
This became inconvenient when trying to centralize the database setup, so I
moved them to module functions and made the helpers that mix in defer to the
module level methods.
Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
|
|
Previously, when managing owner, group, and/or mode on a file whose
volume does not support ACLs, Puppet would raise an error when trying
to get/set the ACL.
This commit allows a file provider to optionally perform validation of
the resource. On Windows, the provider ensures that if owner, group,
and/or mode are being managed, but the underlying volume does not
support ACLs, then we fail early with an appropriate error message.
This is a noop for the POSIX file provider as no validation is
required.
File.expand_path uses the current working directory to generate
absolute paths. This was causing failures when running the specs from
a mapped network drive, e.g. HGFS, since the volume does not support
ACLs. This commit changes these tests to use make_absolute method
instead, and changes that method to always use the local 'C:\' volume.
Paired-with: Nick Lewis <nick@puppetlabs.com>
|
|
A Puppet::Parameter::Path's value is valid if it is fully qualified (or
in the case of an array, if each of its elements is fully qualified).
This class was previously using its own method to validate whether a
path was fully qualified, which was different from the rules applied by
absolute_path?. Now that we have a dedicated method for this,
it is used here for consistency.
|
|
Previously, we were always using string comparisons, and hard-coded
paths to temp locations on non-Windows platforms. This was
problematic for a few reasons. We had to maintain a list of temp
locations for the various platforms, and the string comparisons were
unreliable on Windows, since paths have two string representations
(the "short" name containing a ~ followed by a number, and the "full"
name).
By getting the current temp location using Dir.tempdir (the same
mechanism our temp creation code uses), we no longer need to maintain
the list of temp locations. Also, rather than doing string
comparisons on file paths, we can use a combination of
Pathname#ascend, and File.identical? to determine if the path
registered as a temp file for deletion was actually created in the
temp location.
With this refactoring, the same code now works for both Windows, and
non-Windows platforms.
Reviewed-by: Nick Lewis <nick@puppetlabs.com>
(cherry picked from commit 3aec02ba0e4bda8ba4e9fffbc6defaae4e4e2ba1)
|
|
Absolute paths on Unix, e.g. /foo/bar, are not absolute on Windows,
which breaks many test cases. This commit adds a method to
PuppetSpec::Files.make_absolute that makes the path absolute in
test cases.
On Unix (Puppet.features.posix?) it is a no-op. On Windows,
(Puppet.features.microsoft_windows?) the drive from the current
working directory is prepended.
Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
(cherry picked from commit 462a95e3d077b1915a919399b846068816c84583)
Conflicts:
spec/unit/parser/functions/extlookup_spec.rb
|
|
Ruby 1.8.7 is fairly lax about various bits of introspection, including that
we can't tell much about what arguments a block takes. Ruby 1.9.2 makes it
possible to do this, though.
Meanwhile, the Faces system uses this to make sure that scripts and actions
take the right set of arguments, to avoid surprises: failing early and
explicitly is better than failing at runtime.
Which, in final turn, exposes that I forgot to accept the right arguments in a
couple of my testing actions for Faces, but didn't notice because 1.8.7
doesn't check that, and I didn't test on 1.9.2.
|
|
When we define an action on an older version of a Face, we must be sure to
directly load the core of that version, not just define it with the external
Action(s) that it had.
Otherwise we break our contract, which is that any core Actions for a specific
version will be available to your external Action for as long as we support
that core version.
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
|
|
When we first touch a Face, we load all the available Actions from disk.
Given they define themselves against a specific version of a Face, they are
automatically available tied to the correct version; this makes it trivially
possible to locate those on demand and return them.
Now, we have the ability to find and, consequently, invoke Actions on older
versions of Faces. We don't load enough context, though: the older face will
only have external Actions defined, not anything core.
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
|
|
We were emitting a bunch of unhelpful failure messages, surrounding invalid
actions and especially default actions interacting with the command-line.
This cleans those up, to give a helpful, informative, and correct message in
all cases. Notably, we no longer report that there is no "default" action
when you specify an unknown action on a face.
This change revealed some other weaknesses in our unit tests, now correctly,
that result in slightly more robust code.
|
|
Ruby 1.9 is stricter about arity for for arguments passed as a block. A
test case just hadn't been updated to take this into account for Face
scripts (a simpler form of action), which isn't surprising since script
isn't used anywhere in the code, which makes it a prime candidate for
removal as far as I'm concerned, but apparently Luke wants it in there.
Reviewed-by: Pieter van de Bruggen <pieter@puppetlabs.com>
|
|
We refer to rendering formats pretty consistently as `json`, `yaml`, `s`, and
so forth; unqualified names.
On the other hand, we refer to the rendering hooks *mostly* as `to_*`, except
the `:for_humans` and `:json` formats. Which is kind of confusing because of
the internal inconsistency, and because it doesn't match the public name.
Fix the code to resolve both, so the `to_*` format still works, but we mostly
expect to use the `*` version, to match public expectation.
|
|
We used to let actions be declared without the `when_invoked` block, which was
usually a sign of either someone writing their method code direct in action
declaration, or someone forgetting to add their code at all.
This was just let silently by: the error only showed up when you finally tried
to invoke the action, and a NoMethod error was raised by the face.
...except for our own testing. We took advantage of this a whole pile of
times in there; fixing the original UI issue means fixing all those too.
Reviewed-By: Nick Lewis <nick@puppetlabs.com>
|
|
You can now write expectations along the lines of:
expect { ... }.to print /whatever/
This will do the expected thing, which is to require that we print something
matching that regular expression during the block. The output itself is
suppressed during operation of the matcher.
Paired-With: Max Martin <max@puppetlabs.com>
|
|
We now run all the faces, and their actions, as well as global help through
the wringer in this test: this way we can be confident that we have, at least,
the ability to generate the help without a user-visible failure.
We also check that we have set copyright and license terms in our own faces.
Theoretically this might fail if the end user has extra faces on LOAD_PATH,
but my hope is that we won't hit that...
|
|
When a face or action fails we should exit non-zero on the CLI to signal this
to our caller. "Fails" is defined as "raises an exception"; we don't treat
any return value as a significant failure.
Reviewed-By: Jesse Wolf <jesse@puppetlabs.com>
|
|
'remotes/lak/tickets/next/7118-summaries_for_all_faces' into 2.7.x
Fix conflicts due to version drift in:
lib/puppet/face/certificate.rb
lib/puppet/face/facts.rb
lib/puppet/face/node.rb
lib/puppet/face/secret_agent.rb
spec/lib/puppet/face/basetest.rb
spec/unit/face/help_spec.rb
Reviewed-By: Markus Roberts <markus@puppetlabs.com>
|
|
"Invisible glob", or "prefix", version matching means that when you specify a
version string to use you can specify as little as one version number out of
the semantic versioning spec.
Matching is done on the prefix; an omitted number is treated as "anything" in
that slot, and we return the highest matching versioned face by that spec.
For example, given the set of versions: 1.0.0, 1.0.1, 1.1.0, 1.1.1, 2.0.0
The following would be matched:
input matched
1 1.1.1
1.0 1.0.1
1.0.1 1.0.1
1.0.2 fail - no match
1.1 1.1.1
1.1.1 1.1.1
1.2 fail - no match
|
|
'feature/2.7.x/6978-face-and-action-options-should-have-hooks-for-various-actions' into 2.7.x
|
|
Options can now add before_action and after_action blocks; these are invoked
before or after any action is invoked on the face. This allows these options
to declare common behaviour and have it automatically applied to the actions
invoked.
Option hooks have no defined order of invocation: they will run in a
completely random order. Where there are dependencies they should be on the
value of the options hash passed to the invocation, not on side-effects of the
other invocations.
You are not able to influence the arguments, options, or calling of the action
body in a before or after decorator. This is by design.
The invocation passes to the hook:
1. The action object representing this action.
2. The arguments to the action, as an array.
3. The options for the action, as a hash.
Paired-With: Max Martin <max@puppetlabs.com>
|