|
24 | 24 |
|
25 | 25 | it 'has create role for "test" user with password as ****' do |
26 | 26 | expect(subject).to contain_postgresql_psql('CREATE ROLE test ENCRYPTED PASSWORD ****') |
27 | | - .with('command' => 'Sensitive [value redacted]', |
| 27 | + .with('command' => sensitive(%(CREATE ROLE "test" ENCRYPTED PASSWORD 'new-pa$s' LOGIN NOCREATEROLE NOCREATEDB NOSUPERUSER CONNECTION LIMIT -1)), |
28 | 28 | 'sensitive' => 'true', |
29 | 29 | 'unless' => "SELECT 1 FROM pg_roles WHERE rolname = 'test'", |
30 | 30 | 'port' => '5432') |
31 | 31 | end |
32 | 32 |
|
33 | 33 | it 'has alter role for "test" user with password as ****' do |
34 | 34 | expect(subject).to contain_postgresql_psql('ALTER ROLE test ENCRYPTED PASSWORD ****') |
35 | | - .with('command' => 'Sensitive [value redacted]', |
| 35 | + .with('command' => sensitive(%(ALTER ROLE "test" ENCRYPTED PASSWORD 'md5b6f7fcbbabb4befde4588a26c1cfd2fa')), |
36 | 36 | 'sensitive' => 'true', |
37 | | - 'unless' => 'Sensitive [value redacted]', |
| 37 | + 'unless' => sensitive(%(SELECT 1 FROM pg_shadow WHERE usename = 'test' AND passwd = 'md5b6f7fcbbabb4befde4588a26c1cfd2fa')), |
38 | 38 | 'port' => '5432') |
39 | 39 | end |
40 | 40 | end |
|
50 | 50 |
|
51 | 51 | it 'has create role for "test" user with password as ****' do |
52 | 52 | expect(subject).to contain_postgresql_psql('CREATE ROLE test ENCRYPTED PASSWORD ****') |
53 | | - .with('command' => 'Sensitive [value redacted]', |
| 53 | + .with('command' => sensitive(%(CREATE ROLE "test" ENCRYPTED PASSWORD 'new-pa$s' LOGIN NOCREATEROLE NOCREATEDB NOSUPERUSER CONNECTION LIMIT -1)), |
54 | 54 | 'sensitive' => 'true', |
55 | 55 | 'unless' => "SELECT 1 FROM pg_roles WHERE rolname = 'test'", |
56 | 56 | 'port' => '5432') |
57 | 57 | end |
58 | 58 |
|
59 | 59 | it 'has alter role for "test" user with password as ****' do |
60 | 60 | expect(subject).to contain_postgresql_psql('ALTER ROLE test ENCRYPTED PASSWORD ****') |
61 | | - .with('command' => 'Sensitive [value redacted]', |
| 61 | + .with('command' => sensitive(%(ALTER ROLE "test" ENCRYPTED PASSWORD 'Sensitive [value redacted]')), |
| 62 | + # FIXME: This is obviously wrong ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
62 | 63 | 'sensitive' => 'true', |
63 | | - 'unless' => 'Sensitive [value redacted]', |
| 64 | + 'unless' => sensitive(%(SELECT 1 FROM pg_shadow WHERE usename = 'test' AND passwd = 'Sensitive [value redacted]')), |
| 65 | + # FIXME: This is obviously wrong ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
64 | 66 | 'port' => '5432') |
65 | 67 | end |
66 | 68 | end |
|
84 | 86 |
|
85 | 87 | it 'has create role for "test" user with password as ****' do |
86 | 88 | expect(subject).to contain_postgresql_psql('CREATE ROLE test ENCRYPTED PASSWORD ****') |
87 | | - .with_command('Sensitive [value redacted]') |
| 89 | + .with_command(sensitive(%(CREATE ROLE "test" ENCRYPTED PASSWORD 'new-pa$s' LOGIN NOCREATEROLE NOCREATEDB NOSUPERUSER CONNECTION LIMIT -1))) |
88 | 90 | .with_sensitive('true') |
89 | 91 | .with_unless("SELECT 1 FROM pg_roles WHERE rolname = 'test'") |
90 | 92 | .with_port(5432) |
|
94 | 96 |
|
95 | 97 | it 'has alter role for "test" user with password as ****' do |
96 | 98 | expect(subject).to contain_postgresql_psql('ALTER ROLE test ENCRYPTED PASSWORD ****') |
97 | | - .with('command' => 'Sensitive [value redacted]', 'sensitive' => 'true', |
98 | | - 'unless' => 'Sensitive [value redacted]', 'port' => '5432', |
| 99 | + .with('command' => sensitive(%(ALTER ROLE "test" ENCRYPTED PASSWORD 'md5b6f7fcbbabb4befde4588a26c1cfd2fa')), 'sensitive' => 'true', |
| 100 | + 'unless' => sensitive(%(SELECT 1 FROM pg_shadow WHERE usename = 'test' AND passwd = 'md5b6f7fcbbabb4befde4588a26c1cfd2fa')), 'port' => '5432', |
99 | 101 | 'connect_settings' => { 'PGHOST' => 'postgres-db-server', 'DBVERSION' => '9.1', |
100 | 102 | 'PGUSER' => 'login-user', 'PGPASSWORD' => 'login-pass' }) |
101 | 103 | end |
|
121 | 123 |
|
122 | 124 | it 'has create role for "test" user with password as ****' do |
123 | 125 | expect(subject).to contain_postgresql_psql('CREATE ROLE test ENCRYPTED PASSWORD ****') |
124 | | - .with('command' => 'Sensitive [value redacted]', |
| 126 | + .with('command' => sensitive(%(CREATE ROLE "test" ENCRYPTED PASSWORD 'new-pa$s' LOGIN NOCREATEROLE NOCREATEDB NOSUPERUSER CONNECTION LIMIT -1)), |
125 | 127 | 'sensitive' => 'true', 'unless' => "SELECT 1 FROM pg_roles WHERE rolname = 'test'", |
126 | 128 | 'connect_settings' => { 'PGHOST' => 'postgres-db-server', 'DBVERSION' => '9.1', |
127 | 129 | 'PGPORT' => '1234', 'PGUSER' => 'login-user', 'PGPASSWORD' => 'login-pass' }) |
128 | 130 | end |
129 | 131 |
|
130 | 132 | it 'has alter role for "test" user with password as ****' do |
131 | 133 | expect(subject).to contain_postgresql_psql('ALTER ROLE test ENCRYPTED PASSWORD ****') |
132 | | - .with('command' => 'Sensitive [value redacted]', 'sensitive' => 'true', |
133 | | - 'unless' => 'Sensitive [value redacted]', |
| 134 | + .with('command' => sensitive(%(ALTER ROLE "test" ENCRYPTED PASSWORD 'md5b6f7fcbbabb4befde4588a26c1cfd2fa')), 'sensitive' => 'true', |
| 135 | + 'unless' => sensitive(%(SELECT 1 FROM pg_shadow WHERE usename = 'test' AND passwd = 'md5b6f7fcbbabb4befde4588a26c1cfd2fa')), |
134 | 136 | 'connect_settings' => { 'PGHOST' => 'postgres-db-server', 'DBVERSION' => '9.1', |
135 | 137 | 'PGPORT' => '1234', 'PGUSER' => 'login-user', 'PGPASSWORD' => 'login-pass' }) |
136 | 138 | end |
|
0 commit comments