File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed
integration/ident/controls Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 3636 notifies :reload , 'postgresql_service[postgresql]' , :delayed
3737end
3838
39+ # Test the fix for issue #787 - multiple mappings per map name
40+ postgresql_ident 'someuser to postgres mapping' do
41+ map_name 'someuser_postgres'
42+ system_username 'someuser'
43+ database_username 'postgres'
44+ comment 'Test mapping for issue #787'
45+
46+ notifies :reload , 'postgresql_service[postgresql]' , :delayed
47+ end
48+
49+ # Make sure that the postgres keeps its own identity
50+ # Without this, the cookbook would previously fail to run
51+ postgresql_ident 'postgres to postgres mapping' do
52+ map_name 'someuser_postgres'
53+ system_username 'postgres'
54+ database_username 'postgres'
55+ comment 'Second mapping with same map_name for issue #787'
56+
57+ notifies :reload , 'postgresql_service[postgresql]' , :delayed
58+ end
59+
3960postgresql_ident 'shef remove mapping' do
4061 map_name 'testmap3'
4162 system_username 'shef_remove'
Original file line number Diff line number Diff line change 1+ control 'postgresql-ident-map' do
2+ impact 1.0
3+ desc 'This test ensures postgres configures ident access correctly'
4+
5+ describe command ( "sudo -u shef bash -c \" psql -U sous_chef -d postgres -c 'SELECT 1;'\" " ) do
6+ its ( 'exit_status' ) { should eq 0 }
7+ end
8+ end
9+
10+ control 'postgresql-ident-multiple-mappings' do
11+ impact 1.0
12+ desc 'This test ensures multiple mappings per map name work correctly (issue #787)'
13+
14+ # Use a command to find and check the pg_ident.conf file
15+ describe command ( "find /etc /var -name 'pg_ident.conf' 2>/dev/null | head -1 | xargs cat" ) do
16+ its ( 'stdout' ) { should match ( /^someuser_postgres\s +someuser\s +postgres/ ) }
17+ its ( 'stdout' ) { should match ( /^someuser_postgres\s +postgres\s +postgres/ ) }
18+ end
19+ end
20+
21+ control 'shef and postgres roles should exist' do
22+ impact 1.0
23+ desc 'The shef & postgres database user role should exist'
24+
25+ postgres_access = postgres_session ( 'postgres' , '12345' , '127.0.0.1' )
26+
27+ describe postgres_access . query ( 'SELECT rolname FROM pg_roles;' ) do
28+ its ( 'output' ) { should include 'postgres' }
29+ its ( 'output' ) { should include 'sous_chef' }
30+ end
31+ end
You can’t perform that action at this time.
0 commit comments