Hashar has uploaded a new change for review. https://gerrit.wikimedia.org/r/297315
Change subject: nrpe: fix spec to use hiera ...................................................................... nrpe: fix spec to use hiera The nrpe class spec has been written with hardcoded values, namely the labs IP has changed since they have been written. Use a hiera fixture with a hierarchy varying on the 'realm' fact. Fill in two easily recognizable and different IP for each realm. Adjust the couple specs to lookup for those IPs. Eg it is no more an integration tests against the prod/labs hiera data but I do not think it was the original intent. Bug: T78342 Change-Id: Iad535adc8967a2380a1f07ec683f099ee5d7fd51 --- M modules/nrpe/spec/classes/nrpe_spec.rb A modules/nrpe/spec/fixtures/hiera.yaml A modules/nrpe/spec/fixtures/hieradata/labs.yaml A modules/nrpe/spec/fixtures/hieradata/production.yaml M modules/nrpe/spec/spec_helper.rb 5 files changed, 11 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/15/297315/1 diff --git a/modules/nrpe/spec/classes/nrpe_spec.rb b/modules/nrpe/spec/classes/nrpe_spec.rb index ab0e859..9688e31 100644 --- a/modules/nrpe/spec/classes/nrpe_spec.rb +++ b/modules/nrpe/spec/classes/nrpe_spec.rb @@ -14,14 +14,14 @@ let(:facts) { { :realm => 'production' } } it 'should generate valid content for nrpe_local.cfg in production' do - should contain_file('/etc/nagios/nrpe_local.cfg').with_content(/allowed_hosts=127.0.0.1/) + should contain_file('/etc/nagios/nrpe_local.cfg').with_content(/allowed_hosts=127.0.42.42/) end end describe 'nrpe', :type => :class do let(:facts) { { :realm => 'labs' } } it 'should generate valid content for nrpe_local.cfg in labs' do - should contain_file('/etc/nagios/nrpe_local.cfg').with_content(/allowed_hosts=10.4.1.88/) + should contain_file('/etc/nagios/nrpe_local.cfg').with_content(/allowed_hosts=10.68.42.42/) end end diff --git a/modules/nrpe/spec/fixtures/hiera.yaml b/modules/nrpe/spec/fixtures/hiera.yaml new file mode 100644 index 0000000..6aac931 --- /dev/null +++ b/modules/nrpe/spec/fixtures/hiera.yaml @@ -0,0 +1,6 @@ +:backends: + - yaml +:yaml: + :datadir: 'spec/fixtures/hieradata' +:hierarchy: + - "%{realm}" diff --git a/modules/nrpe/spec/fixtures/hieradata/labs.yaml b/modules/nrpe/spec/fixtures/hieradata/labs.yaml new file mode 100644 index 0000000..542bb32 --- /dev/null +++ b/modules/nrpe/spec/fixtures/hieradata/labs.yaml @@ -0,0 +1 @@ +nrpe::allowed_hosts: '10.68.42.42' diff --git a/modules/nrpe/spec/fixtures/hieradata/production.yaml b/modules/nrpe/spec/fixtures/hieradata/production.yaml new file mode 100644 index 0000000..a7ca017 --- /dev/null +++ b/modules/nrpe/spec/fixtures/hieradata/production.yaml @@ -0,0 +1 @@ +nrpe::allowed_hosts: '127.0.42.42' diff --git a/modules/nrpe/spec/spec_helper.rb b/modules/nrpe/spec/spec_helper.rb index d3923f8..066c259 100644 --- a/modules/nrpe/spec/spec_helper.rb +++ b/modules/nrpe/spec/spec_helper.rb @@ -5,4 +5,5 @@ RSpec.configure do |c| c.module_path = File.join(fixture_path, 'modules') c.manifest_dir = File.join(fixture_path, 'manifests') + c.hiera_config = File.join(fixture_path, 'hiera.yaml') end -- To view, visit https://gerrit.wikimedia.org/r/297315 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iad535adc8967a2380a1f07ec683f099ee5d7fd51 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Hashar <has...@free.fr> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits