Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PE-38816 Tests added for add_replica to cover replica_postgresql_host parameter #473

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions spec/plans/add_replica_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,37 @@ def allow_standard_non_returning_calls
expect_out_verbose.with_params('Updating classification to...')
expect(run_plan('peadm::add_replica', params)).to be_ok
end

it 'handles the replica_postgresql_host parameter correctly' do
allow_standard_non_returning_calls
params_with_postgresql = params.merge({ 'replica_postgresql_host' => 'replica_pg' })

expect_task('peadm::get_peadm_config').always_return(cfg)
expect_task('peadm::cert_data').always_return(certdata).be_called_times(4)
expect_task('peadm::cert_valid_status').always_return(certstatus)
expect_task('package').always_return({ 'status' => 'uninstalled' })

expect_task('peadm::get_psql_version')
.with_targets(['replica_pg'])
.always_return({ 'version' => '11' })

allow_apply

expect_command('systemctl reload pe-postgresql.service')
.with_targets(['replica_pg'])

expect_task('peadm::agent_install')
.with_params({ 'server' => 'primary',
'install_flags' => [
'main:dns_alt_names=replica',
'--puppet-service-ensure', 'stopped',
'main:certname=replica'
] })
expect_plan('peadm::util::copy_file').be_called_times(5)

expect_out_verbose.with_params('Current config is...')
expect_out_verbose.with_params('Updating classification to...')
expect(run_plan('peadm::add_replica', params_with_postgresql)).to be_ok
end
end
end
Loading