Skip to content

Commit f29abaa

Browse files
committed
Repair failing add_replica tests after additions
Changes to add_replica which enable new features made tests invalid, commit makes them valid again.
1 parent def175c commit f29abaa

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

.vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"python.linting.pylintEnabled": true,
3-
"python.linting.enabled": true
3+
"python.linting.enabled": true,
4+
"git.ignoreLimitWarning": true
45
}

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ group :development do
2626
gem "puppet-module-win-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw]
2727
gem "puppet-debugger", '>= 0.18.0', require: false
2828
gem "bolt", '>= 3.17.0', require: false
29-
gem "github_changelog_generator", require: false
29+
gem "github_changelog_generator", '>= 1.16.4', require: false
3030
gem "octokit", '4.21.0', require: false
3131
end
3232
group :system_tests do

spec/plans/add_replica_spec.rb

+15-9
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,39 @@ def allow_standard_non_returning_calls
1111

1212
describe 'basic functionality' do
1313
let(:params) { { 'primary_host' => 'primary', 'replica_host' => 'replica' } }
14-
let(:certdata) { { 'certname' => 'primary', 'extensions' => { '1.3.6.1.4.1.34380.1.1.9813' => 'A' } } }
14+
let(:certdata) { { 'certname' => 'primary', 'extensions' => { '1.3.6.1.4.1.34380.1.1.9813' => 'A' }, 'dns-alt-names' => [] } }
15+
let(:cfg) { { 'params' => { 'primary_host' => 'primary' } } }
1516

16-
it 'runs successfully when the primary doesn\'t have alt-names' do
17+
it 'runs successfully when the primary does not have alt-names' do
1718
allow_standard_non_returning_calls
18-
expect_task('peadm::cert_data').always_return(certdata)
19+
expect_task('peadm::get_peadm_config').always_return(cfg)
20+
expect_task('peadm::cert_data').always_return(certdata).be_called_times(3)
21+
expect_task('package').always_return({ 'status' => 'uninstalled' })
1922
expect_task('peadm::agent_install')
2023
.with_params({ 'server' => 'primary',
2124
'install_flags' => [
25+
'main:dns_alt_names=replica',
2226
'--puppet-service-ensure', 'stopped',
23-
'main:certname=replica',
24-
'main:dns_alt_names=replica'
27+
'main:certname=replica'
2528
] })
2629

30+
expect_out_message.with_params('Classification to be updated using the following hash...')
2731
expect(run_plan('peadm::add_replica', params)).to be_ok
2832
end
2933

3034
it 'runs successfully when the primary has alt-names' do
3135
allow_standard_non_returning_calls
32-
expect_task('peadm::cert_data').always_return(certdata.merge({ 'dns-alt-names' => ['primary', 'alt'] }))
36+
expect_task('peadm::get_peadm_config').always_return(cfg)
37+
expect_task('peadm::cert_data').always_return(certdata.merge({ 'dns-alt-names' => ['primary', 'alt'] })).be_called_times(3)
38+
expect_task('package').always_return({ 'status' => 'uninstalled' })
3339
expect_task('peadm::agent_install')
3440
.with_params({ 'server' => 'primary',
3541
'install_flags' => [
42+
'main:dns_alt_names=replica,alt',
3643
'--puppet-service-ensure', 'stopped',
37-
'main:certname=replica',
38-
'main:dns_alt_names=replica,alt'
44+
'main:certname=replica'
3945
] })
40-
46+
expect_out_message.with_params('Classification to be updated using the following hash...')
4147
expect(run_plan('peadm::add_replica', params)).to be_ok
4248
end
4349
end

0 commit comments

Comments
 (0)