Граф коммитов

15 Коммитов

Автор SHA1 Сообщение Дата
Colleen Murphy c1744f25fc Update Gemfile for .travis.yml defaults 2014-06-30 10:58:43 -07:00
Colleen Murphy c63a7ba857 Sync files 2014-06-25 17:23:35 -07:00
Dominic Cleal b7cbe60d4b (MODULES-775) Fix refresh/unless parameter interactions
Interactions between resource refreshes and the 'unless' parameter have been
fixed to follow the behaviour of the 'exec' type.

The 'unless' parameter is now always taken into account, whether in ordinary
operation, during a refresh, or when refreshonly is set to true.  The resource
will not run the SQL command when the 'unless' clause matches a row.

Previously a refresh on a resource would ignore the 'unless' parameter if set
which could cause a failure re-running a command, such as attempting to create
a role that already exists.

The following examples have been fixed:

  * should not run SQL when refreshed and the unless query returns rows
  * with refreshonly should not run SQL when the unless query returns no rows
  * with refreshonly should not run SQL when refreshed and the unless query
    returns rows

This is done by moving the logic for refreshonly and whether to run the SQL
command from the provider into the type, and consolidating it in the
should_run_sql method which is called during 'command' property retrieval
(instead of sync) and during refresh.
2014-06-03 10:25:13 +01:00
Ashley Penney bd1eec24d0 Merge branch '3.3.x' into merge33x 2014-05-13 21:08:41 +02:00
Igor Galić 5b386f1d49 Fixed travis by updating Gemfile to pin Rake to 10.1.1
The latest Rake update requires Ruby >= 1.9. This update
fixes the failing 1.8.7 tests by pinning Rake to the last
supported version on ruby 1.8.7.

This patch is borrowed from @blkperl
2014-03-27 21:29:17 +01:00
Mickaël Canévet 67cd6f73f4 Fix unit tests with rspec-puppet 1.0 2014-03-21 13:58:26 +01:00
Hunter Haugen ea537281d7 Add class apt for manage_package_repo => true 2014-02-28 17:41:00 -08:00
Hunter Haugen 969cc8b7f1 Allow custom gemsource 2014-02-11 16:38:16 -08:00
Ashley Penney a353e8e16d Convert rspec-system tests over to beaker.
This work converts all the tests over to beaker.  Some things are
done slightly different in beaker, we rely much more heavily on
catch_failures rather than explicitly laying out the exit codes we
want but I have attempted to preserve the spirit of all tests.
2014-01-23 19:07:04 -05:00
Joshua Hoblitt c152cd40e7 peg rspec-puppet gem version < 1
rspec-puppet >= 1.0 removed the catalogue method which breaks the param
method in `spec/spec_helper.rb`.  Hopefully, this method will be re-added
in a subsequent release.
2014-01-07 15:13:45 -07:00
Ken Barber 809003d0f9 serverspec + some cleanup
Signed-off-by: Ken Barber <ken@bob.sh>
2013-09-19 16:30:15 +01:00
Ken Barber 9c2dab95aa (GH-216) Alter role call not idempotent with cleartext passwords
The postgresql::role defined type was not idempotent when passed cleartext
passwords. This is because we were comparing it with its md5 equivalent in
the db.

This patch converts any cleartext passwords to md5 before comparison, but
only if they are cleartext (ie. not starting with md5).

I also bumped the version of rspec-system-puppet to get use of the refresh
method, plus did some cleanup because the old tests were a bit dusty, again
taking advantage of refresh plus changing some matchers for clarity.

Signed-off-by: Ken Barber <ken@bob.sh>
2013-08-01 03:18:46 +01:00
Ken Barber 80c85e8f2b Convert system tests to use rspec-system
This patch ports all of the existing system tests to use rspec-system instead.

To assist with this conversion some patches were made to fix OS compatibility
where necessary. We also added an ensure parameter to the postgresql::server
class to assist with removing PostgreSQL configuration to aid with testing
cleanups.

The documentation has been updated to indicate test usage with rspec-system,
we've also renamed the 'tests' directory to 'examples'.

Signed-off-by: Ken Barber <ken@bob.sh>
2013-06-04 15:36:24 +01:00
Ken Barber 794ef22934 Fix versions for travis-ci
This fixes some mistakes in the .travis.yml file:

* Corrects matches so the minor gem revisions get rounded, this means 2.6.0
  for example is used.
* Adds Ruby 2.0.0 tests
* Allows 2.6.0 to fail for now, as it doesn't have create_resources.
* Removes trailing commas and arrays in functions for 2.6.0.

Signed-off-by: Ken Barber <ken@bob.sh>
2013-02-26 14:32:25 +00:00
Ken Barber e9370fee7b Add unit tests and travis-ci support
This patch includes some very basic and initial unit testing using rspec-puppet
and for the case of facts, just normal rspec.

I've taken a very light approach here as rspec-puppet can be quite combinatorial
when one gets carried away. For now I've just added basic compile failure
detection effectively for classes and defined resources. As we continue to work
on the code and find regressions this work can be expanded.

For facts and functions I've also taken a basic approach for now.

One little thing I did change, was the strange string that the fact returns
when the default version is undefined. Instead of an error message I've just
returned the string 'unknown' which is more in line with other facts I've seen
in the wild, and to be quite honest 'unknown' is fairly self-explantory. Since
a fact isn't an error reporting message this seemed more appropriate, and looked
nicer in the rspec test.

As far as travis-ci support, I've added the same configuration that @jmmcune
came up with for stdlib which is pretty light and reasonable standard now we
propogated that to 4 or so other modules in the puppetlabs/ namespace. It should
work out of the box.

Signed-off-by: Ken Barber <ken@bob.sh>
2013-02-05 15:15:03 +00:00