Skip to content

Commit 03b3df3

Browse files
committed
Add test on postgresql::python.
1 parent bd9bcf4 commit 03b3df3

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

manifests/params.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@
167167
$datadir = pick($custom_datadir, "/var/lib/postgresql/${version}/main")
168168
$confdir = pick($custom_confdir, "/etc/postgresql/${version}/main")
169169
$service_status = "/etc/init.d/${service_name} status | /bin/egrep -q 'Running clusters: .+|online'"
170+
$python_package_name = "python-psycopg2"
170171
}
171172

172173
default: {
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
require 'spec_helper'
2+
3+
describe 'postgresql::python', :type => :class do
4+
5+
describe 'on a redhat based os' do
6+
let :facts do {
7+
:osfamily => 'RedHat',
8+
:postgres_default_version => 'foo',
9+
}
10+
end
11+
it { should contain_package('python-psycopg2').with(
12+
:name => 'python-psycopg2',
13+
:ensure => 'present'
14+
)}
15+
end
16+
17+
describe 'on a debian based os' do
18+
let :facts do {
19+
:osfamily => 'Debian',
20+
:postgres_default_version => 'foo',
21+
}
22+
end
23+
it { should contain_package('python-psycopg2').with(
24+
:name => 'python-psycopg2',
25+
:ensure => 'present'
26+
)}
27+
end
28+
29+
describe 'on any other os' do
30+
let :facts do {
31+
:osfamily => 'foo',
32+
:postgres_default_version => 'foo',
33+
}
34+
end
35+
36+
it 'should fail' do
37+
expect { subject }.to raise_error(/Unsupported osfamily: foo/)
38+
end
39+
end
40+
41+
end

0 commit comments

Comments
 (0)