Commit graph

74 commits

Author SHA1 Message Date
Ken Barber
c8d3ecde14 Various cleanups
Signed-off-by: Ken Barber <ken@bob.sh>
2013-09-18 22:25:51 +01:00
Ken Barber
1fbc9c6ece Add switch for service_name that works for centos
Signed-off-by: Ken Barber <ken@bob.sh>
2013-09-18 17:08:46 +01:00
Ken Barber
31e9b62a51 Correct some more failing tests
Signed-off-by: Ken Barber <ken@bob.sh>
2013-09-18 15:06:35 +01:00
Ken Barber
5370fbeb10 Fix selinux permissions for fedora tests
Signed-off-by: Ken Barber <ken@bob.sh>
2013-09-18 13:40:15 +01:00
Ken Barber
a8f86f9df1 Skip firewall tests for Fedora
Signed-off-by: Ken Barber <ken@bob.sh>
2013-09-18 01:32:00 +01:00
Ken Barber
cd2bc50cdf Fix repo removal for testing purposes
Signed-off-by: Ken Barber <ken@bob.sh>
2013-09-17 22:19:01 +01:00
Ken Barber
ce94eb348a Modify tests for postgresql::server to test for purged state
Since we are now forcing ensure => purged in places, some unit tests need to
be reworked to accept that.

Signed-off-by: Ken Barber <ken@bob.sh>
2013-09-14 06:39:17 +01:00
Ken Barber
27c5cc0304 Provide package removal fixes for Debian tests
This patch provides fixes to help tests pass on Debian. The failures were in
relation to the lack of proper removal of the server and contrib parts. Setting
the ensure => purged parameter for removal seems to have solved a lot of this.

Also, the ordering for contrib being (un)installed needed some work.

I've also made sure we use 'purged' a lot more in tests to make sure we clean
up after ourselves properly.

Signed-off-by: Ken Barber <ken@bob.sh>
2013-09-14 06:39:17 +01:00
Ken Barber
402a6b9608 Include firewall class in firewall based test
Signed-off-by: Ken Barber <ken@bob.sh>
2013-09-14 06:39:17 +01:00
Ken Barber
59c1cbfbf8 Major rewrite to solve order dependencies and unclear public API
This is a very very large change to the module. It started out as a fix to add
postgresl::server::config_entry, and quickly became a rewrite to fix a lot of
ordering issues inherent in the API.

Since this changes the Public API it is considered a backwards compatible
change.

See the upgrading guide in README.md for more details as to what has been
modified in this patch.

Signed-off-by: Ken Barber <ken@bob.sh>
2013-09-14 06:39:15 +01:00
Rahul Gopinath
1dce6454c8 Pulling in pgconf module from camptocamp/puppet-pgconf
This includes the following changes:
  - Hooking up pgconf module to postgresql to manage postgresql.conf
   - pgconf includes a type and provider for postgresql.conf the provider
     is a simple parsed file following basic ini parsing.
  - Add config_entry.pp which wraps the pgconf module.
  - Replace file_line resources by postgresql::config_entry in beforeservice.pp
  - Adding unit tests for the newly introduced functionality
2013-09-14 06:38:53 +01:00
Hunter Haugen
b85a118b57 Add specs for psql Type and Provider 2013-08-13 16:18:02 -07:00
Hunter Haugen
b2b9b13df8 Merge pull request #218 from fiddyspence/set_postgres_postgrespw
Alter escaping in postgresql::config::afterservice
2013-08-13 16:13:18 -07: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
fiddyspence
eadfe3bf00 modified tests 2013-07-23 15:13:15 +01:00
fiddyspence
2eb03efc29 Alter escaping in postgresql::config::afterservice
This allows non-standard users (pe-postgres) to change passwords. Also
added a function to do escaping of the password, added system tests
and rspec tests for the function.
2013-07-23 13:04:46 +01:00
Hunter Haugen
847f54ce6c Merge pull request #204 from mcanevet/set_istemplate
Add support for istemplate parameter where creating db
2013-07-19 12:55:16 -07:00
Hunter Haugen
95452ceb90 Merge pull request #205 from mcanevet/plperl
Add support for installing PL/Perl
2013-07-19 12:49:21 -07:00
Hunter Haugen
6890a56eb7 Reindent postgresql::database_grant spec 2013-07-16 14:31:28 -07:00
Hunter Haugen
a37eaa053b Split database_grant up
The code to grant permissions databases and their objects has been
abstracted to `postgresql::grant` and is used by both
`postgresql::database_grant` and `postgresql::table_grant`
2013-07-16 14:31:28 -07:00
Mickaël Canévet
5ff47cf1b8 Test plperl only on non standard installation as it does not work on redhat5 2013-07-16 16:06:12 +02:00
Mickaël Canévet
5065246512 Add support for installing PL/Perl 2013-07-10 15:20:57 +02:00
Mickaël Canévet
bbb3aa4d5c Fix rspec-system 2013-07-10 14:49:56 +02:00
Mickaël Canévet
c86fec994a Add support for istemplate parameter where creating db 2013-07-10 14:44:58 +02:00
Mickaël Canévet
abf8f64ab5 Alter superuser, createdb, createrole, login, replication status and the connection limit of a role that already exists
Previously we only created a new user, any updates to the defined resource
would not update the role. This patch adds extra logic to modify a role
whenever a parameter is changed.

System tests have also been added to support this.
2013-07-03 14:11:54 +01:00
Ken Barber
2676904608 Fix the non-defaults test failing to use UTF8
The non-default tests try to set UTF8 when UTF8 is not installed on the en_US
machine. These are non-default settings anyway, but one should presume the
correct locale should be set before this is attempted, this patch includes
that step.

In an ideal world we would use a locale module to do this.

This patch also fixes an Ubuntu 10.04 issue where you need to be absolute about
the locale and encoding as well.

Signed-off-by: Ken Barber <ken@bob.sh>
2013-06-14 23:14:47 +01:00
Ken Barber
c377370be9 Include location in postgresql::tablespace test
Signed-off-by: Ken Barber <ken@bob.sh>
2013-06-12 14:21:06 +01:00
Matthias Viehweger
bed601256b Rename tablespace_spec.pp to tablespace_spec.rb 2013-06-12 15:40:24 +03:00
Matthias Viehweger
14fbf9f0fe Rename role_spec.pp to role_spec.rb 2013-06-12 15:40:07 +03:00
Ken Barber
f6fb18a5b3 Fix up and add some tests for unknown OS patch
This patch just adds some new tests for the unknown OS patch, and cleans up
some existing tests to look for the new warning message.

Also, change the warning message for $osfamily and manage_package_repo to
reflect the parameter at fault.

Signed-off-by: Ken Barber <ken@bob.sh>
2013-06-06 20:53:36 +01:00
Chris Price
6bd2befa98 Add support for other operating systems besides Redhat/Debian
Prior to this commit, if you attempted to use the module to
manage postgres on any OS other than Redhat/Debian, there
was an explicit check for that, and a call to `fail`.

In reality, the OS family is only used to build up defaults
for various path and package names, which are all exposed
as parameters.  If the user is willing to explicitly pass
in all of those parameters, there's no reason we should
fail based on OS family.

This commit adds checks to the 'default' osfamily case
such that we now only fail if they're on a non-Redhat-or-Debian
system *and* they haven't explicitly passed in values for
all of the required parameters.
2013-06-06 12:23:30 -07: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
Dan Prince
03b3df3ab9 Add test on postgresql::python. 2013-04-22 11:30:07 -04:00
Kamil Szymanski
82ce5d0480 Add documentation, rspec test and support for global overriding contrib package name 2013-03-02 10:49:57 +01:00
Chris Price
8df74b92da Merge pull request #137 from kbarber/maint/master/create_sudoers_for_centos5
Create dependent directory for sudoers so tests work on Centos 5
2013-02-25 10:02:02 -08:00
Ken Barber
501289394a Cleaned up and added unit tests
Signed-off-by: Ken Barber <ken@bob.sh>
2013-02-25 17:50:53 +00:00
Ken Barber
abc63627d5 Create dependent directory for sudoers so tests work on Centos 5
Signed-off-by: Ken Barber <ken@bob.sh>
2013-02-25 16:51:20 +00:00
Ken Barber
0a76406e23 (GH-130) Amend system tests for Centos 5
Skip tests that don't apply to Centos 5, and make sure the parent directory
for tablespace correction has the correct SELinux settings for tablespace
management.

Signed-off-by: Ken Barber <ken@bob.sh>
2013-02-21 21:23:56 +00:00
Ken Barber
4d70c188e8 (GH-130) Fix 'include' parameter for Postgresql 8.1
This removes the 'include' parameter for PostgreSQL 8.1 as it was failing on
Centos 5.

Also added Centos 5 system tests using our new Vagrant boxes.

Signed-off-by: Ken Barber <ken@bob.sh>
2013-02-21 19:17:04 +00:00
Ken Barber
39f30eb886 Fix module file, remove extra README.md and fix some docs
The module file had the wrong revision in it for starters. And there was some
missing items from the .gitignore.

The extra README.md in spec/system was getting extracted as the main README
on the forge so I remove it, moving the content that was not duplicated
already into README.md.

I took the opportunity also to finish the documentation in the Reference
section of the README to make sure all classes and defined resources are
documented.

Signed-off-by: Ken Barber <ken@bob.sh>
2013-02-20 13:47:10 +00:00
Ken Barber
86a0453f2f Provide new defined resources for managing pg_hba.conf
This patch provides a more advanced way of managing pg_hba rules, by providing a
defined resource to manage a pg_hba file, and a defined resource for managing
rules within such a file (pg_hba_rule).

These new resources are wrappers around ripinaar-concat, and utilise file
assemblies instead of a template to compose the pg_hba.conf file.

I've provided a function that interprets the old ip4|6acl arrays and converts
them to this new format for backwards compatibility as well.

I slightly reformatted our documentation to allow for better documentation of
defined resources in 'Usage' as well, and provided examples of how to use this
new resource.

This hopefully should go a long way to solving the PR's related to lack of full
functionality for pg_hba.conf.

Signed-off-by: Ken Barber <ken@bob.sh>
2013-02-12 00:34:42 +00:00
Ken Barber
39862106b2 Merge pull request #117 from fhrbek/coding_style
Coding style fixes
2013-02-06 14:32:39 -08:00
fhrbek
10cb81468e Coding style fixes 2013-02-06 18:51:58 +01:00
Michael Arnold
bbe92fbc1b Clean up java.pp manifest documentation.
Also clarify postgresql::java rspec test.
2013-02-05 23:22:27 -07:00
Michael Arnold
d013c16902 Add rspec test for Class['postgresql::java'].
This test conforms to the rspec-puppet and puppetlabs_spec_helper
standards.
2013-02-05 23:22:27 -07:00
Ken Barber
2114333539 Add locale parameter support
This adds the parameter 'locale' to the 'postgresql' class so we have a global
default, and adds it two the defined resources 'postgresql::db' and
'postgresql::database'. This allows users to either:

* Defined a global default for the cluster
* Define a per-database default

As a side-effect I had to make sure 'charset' was also exposed in a similar
manner as some locales need a particular charset to work.

Tests were added to test both the 'createdb' case and 'initdb' case for Redhat,
and some refactoring was done to make the existing non_default test area use
heredocs so my manifests and test code was kept close together. As apposed to
entirely different files and places in the directory structure.

I cleaned up the related execs a little bit, adding logoutput => on_failure
where needed so we can debug failures. Beforehand execs just 'failed', but
now we should be able to get better feedback from failed execs helping support.

I also add intention comments in parts of the Puppet code that I touched where
it made sense.

Signed-off-by: Ken Barber <ken@bob.sh>
2013-02-05 17:23:52 +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
Karel Brezina
236ce4783a Added info about the advanced configuration file 2013-02-01 12:46:59 +01:00
Karel Brezina
b16c1e0d64 Improved test result matching for the advanced PGS configuration test. 2013-01-31 16:27:47 +01:00
Karel Brezina
ed29a9931d RSpec tests were fixed to work properly with included postgresql_puppet_extras.conf 2013-01-31 15:56:50 +01:00