|
178 | 178 | end
|
179 | 179 |
|
180 | 180 | context 'without including postgresql::server' do
|
| 181 | + |
| 182 | + let :pre_condition do |
| 183 | + "class {'postgresql::server':}" |
| 184 | + end |
| 185 | + |
181 | 186 | it {
|
182 | 187 | is_expected.to contain_postgresql_psql('postgres: CREATE EXTENSION "pg_repack"')
|
183 | 188 | .with(db: 'postgres', command: 'CREATE EXTENSION "pg_repack"')
|
184 | 189 | }
|
185 | 190 | end
|
| 191 | + |
| 192 | + context 'default port' do |
| 193 | + let :params do |
| 194 | + { |
| 195 | + database: 'postgres', |
| 196 | + extension: 'pg_repack', |
| 197 | + } |
| 198 | + end |
| 199 | + |
| 200 | + let :pre_condition do |
| 201 | + "class {'postgresql::server':}" |
| 202 | + end |
| 203 | + |
| 204 | + it { is_expected.to compile.with_all_deps } |
| 205 | + it { is_expected.to contain_postgresql_psql('postgres: CREATE EXTENSION "pg_repack"').with_port('5432') } |
| 206 | + end |
| 207 | + |
| 208 | + context 'port overriden by explicit parameter' do |
| 209 | + let :params do |
| 210 | + { |
| 211 | + database: 'postgres', |
| 212 | + extension: 'pg_repack', |
| 213 | + port: 1234, |
| 214 | + } |
| 215 | + end |
| 216 | + |
| 217 | + let :pre_condition do |
| 218 | + "class {'postgresql::server':}" |
| 219 | + end |
| 220 | + |
| 221 | + it { is_expected.to compile.with_all_deps } |
| 222 | + it { is_expected.to contain_postgresql_psql('postgres: CREATE EXTENSION "pg_repack"').with_port('1234') } |
| 223 | + end |
| 224 | + |
| 225 | + context 'with specific db connection settings' do |
| 226 | + let :params do |
| 227 | + { |
| 228 | + database: 'postgres', |
| 229 | + extension: 'pg_repack', |
| 230 | + connect_settings: { 'PGHOST' => 'postgres-db-server', |
| 231 | + 'DBVERSION' => '9.1', |
| 232 | + 'PGPORT' => '1234' }, |
| 233 | + } |
| 234 | + end |
| 235 | + |
| 236 | + let :pre_condition do |
| 237 | + "class {'postgresql::server':}" |
| 238 | + end |
| 239 | + |
| 240 | + it { is_expected.to compile.with_all_deps } |
| 241 | + it { is_expected.to contain_postgresql_psql('postgres: CREATE EXTENSION "pg_repack"').with_connect_settings('PGHOST' => 'postgres-db-server', 'DBVERSION' => '9.1', 'PGPORT' => '1234').with_port(nil) } |
| 242 | + end |
| 243 | + |
| 244 | + context 'with specific db connection settings - port overriden by explicit parameter' do |
| 245 | + let :params do |
| 246 | + { |
| 247 | + database: 'postgres', |
| 248 | + extension: 'pg_repack', |
| 249 | + connect_settings: { 'PGHOST' => 'postgres-db-server', |
| 250 | + 'DBVERSION' => '9.1', |
| 251 | + 'PGPORT' => '1234' }, |
| 252 | + port: 5678, |
| 253 | + } |
| 254 | + end |
| 255 | + |
| 256 | + let :pre_condition do |
| 257 | + "class {'postgresql::server':}" |
| 258 | + end |
| 259 | + |
| 260 | + it { is_expected.to compile.with_all_deps } |
| 261 | + it { is_expected.to contain_postgresql_psql('postgres: CREATE EXTENSION "pg_repack"').with_connect_settings('PGHOST' => 'postgres-db-server', 'DBVERSION' => '9.1', 'PGPORT' => '1234').with_port('5678') } |
| 262 | + end |
186 | 263 | end
|
0 commit comments