3 describe 'postgresql::pg_hba_rule', :type => :define do
6 :postgres_default_version => '8.4',
8 :concat_basedir => tmpfilename('pg_hba'),
15 tmpfilename('pg_hba_rule')
18 context 'test template 1' do
24 :address => '1.1.1.1/24',
25 :auth_method => 'md5',
30 content = param('concat::fragment', 'pg_hba_rule_test', 'content')
31 content.should =~ /host\s+all\s+all\s+1\.1\.1\.1\/24\s+md5/
35 context 'test template 2' do
41 :auth_method => 'ident',
46 content = param('concat::fragment', 'pg_hba_rule_test', 'content')
47 content.should =~ /local\s+all\s+all\s+ident/
51 context 'test template 3' do
57 :address => '0.0.0.0/0',
58 :auth_method => 'ldap',
59 :auth_option => 'foo=bar',
64 content = param('concat::fragment', 'pg_hba_rule_test', 'content')
65 content.should =~ /host\s+all\s+all\s+0\.0\.0\.0\/0\s+ldap\s+foo=bar/
69 context 'validation' do
70 context 'validate type test 1' do
76 :address => '0.0.0.0/0',
77 :auth_method => 'ldap',
81 it 'should fail parsing when type is not valid' do
82 expect {subject}.to raise_error(Puppet::Error,
83 /The type you specified \[invalid\] must be one of/)
87 context 'validate auth_method' do
93 :address => '0.0.0.0/0',
94 :auth_method => 'invalid',
98 it 'should fail parsing when auth_method is not valid' do
99 expect {subject}.to raise_error(Puppet::Error,
100 /The auth_method you specified \[invalid\] must be one of/)