From fafb72f48866ed8c15a199111860eaadbed72aab Mon Sep 17 00:00:00 2001 From: Sofer Athlan-Guyot Date: Wed, 7 Nov 2018 17:44:24 +0100 Subject: [PATCH] Skip some tests for Ubuntu 18.04 and puppet 4.8. We already had an issue and we fixed it with an hack[1]. Puppet would assign runit service provider for Ubuntu. runit being the fallback when nothing else match. As a matter of fact puppet doesn't properly detect Ubuntu 18.04 systemd usage before puppet 5. For instance here the code for the 4.x branch[2]: defaultfor :operatingsystem => :ubuntu, :operatingsystemmajrelease => ["15.04","15.10","16.04","16.10","17.04","17.10"] So let's get rid of those tests for 4.8 and Ubuntu 18.04. I only test < 5 as the first maintained branch is 5.3 and has the support for Ubuntu 18.04 services. [1] https://bugs.launchpad.net/puppet-pacemaker/+bug/1783302 [2] https://github.com/puppetlabs/puppet/blob/4.10.x/lib/puppet/provider/service/systemd.rb#L28 Change-Id: I9828b9a837c652fdc87131a84c73591c4e84d387 Closes-Bug: #1802140 --- spec/classes/pacemaker_service_spec.rb | 63 ++++++++++++++------------ spec/classes/pacemaker_spec.rb | 44 +++++++++--------- 2 files changed, 56 insertions(+), 51 deletions(-) diff --git a/spec/classes/pacemaker_service_spec.rb b/spec/classes/pacemaker_service_spec.rb index 32c9ba99..7b2d58ce 100644 --- a/spec/classes/pacemaker_service_spec.rb +++ b/spec/classes/pacemaker_service_spec.rb @@ -3,48 +3,51 @@ require 'spec_helper' describe 'pacemaker::new::service', type: :class do on_supported_os.each do |os, facts| context "on #{os}" do - # Work around a puppet-spec issue - # https://github.com/rodjek/rspec-puppet/issues/629 - let(:facts) do - facts.merge({initsystem: 'systemd'}) - end + let(:facts) { facts } + if facts[:operatingsystem] == 'Ubuntu' \ + and facts[:operatingsystemmajrelease] == '18.04' \ + and facts[:puppetversion].split('.')[0].to_i < 5 + it "is unsuported" do + skip "Puppet service provider supports Ubuntu 18.04 from version >=5 (got #{facts[:puppetversion]})" + end + else + context 'with default parameters' do + it { is_expected.to compile.with_all_deps } - context 'with default parameters' do - it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_class('pacemaker::new::params') } - it { is_expected.to contain_class('pacemaker::new::params') } + it { is_expected.to contain_class('pacemaker::new::service') } - it { is_expected.to contain_class('pacemaker::new::service') } + it { is_expected.to contain_service('corosync') } - it { is_expected.to contain_service('corosync') } + it { is_expected.to contain_service('pacemaker') } - it { is_expected.to contain_service('pacemaker') } + it { is_expected.to contain_service('pcsd') } + end - it { is_expected.to contain_service('pcsd') } - end - - context 'with service manage disabled' do - let(:params) do - { + context 'with service manage disabled' do + let(:params) do + { :corosync_manage => false, :pacemaker_manage => false, :pcsd_manage => false, - } + } + end + + it { is_expected.to compile.with_all_deps } + + it { is_expected.to contain_class('pacemaker::new::params') } + + it { is_expected.to contain_class('pacemaker::new::service') } + + it { is_expected.not_to contain_service('corosync') } + + it { is_expected.not_to contain_service('pacemaker') } + + it { is_expected.not_to contain_service('pcsd') } end - it { is_expected.to compile.with_all_deps } - - it { is_expected.to contain_class('pacemaker::new::params') } - - it { is_expected.to contain_class('pacemaker::new::service') } - - it { is_expected.not_to contain_service('corosync') } - - it { is_expected.not_to contain_service('pacemaker') } - - it { is_expected.not_to contain_service('pcsd') } end - end end end diff --git a/spec/classes/pacemaker_spec.rb b/spec/classes/pacemaker_spec.rb index 43a9b011..81523602 100644 --- a/spec/classes/pacemaker_spec.rb +++ b/spec/classes/pacemaker_spec.rb @@ -3,28 +3,30 @@ require 'spec_helper' describe 'pacemaker::new', type: :class do on_supported_os.each do |os, facts| context "on #{os}" do - # Work around a puppet-spec issue - # https://github.com/rodjek/rspec-puppet/issues/629 - let(:facts) do - facts.merge({initsystem: 'systemd'}) + let(:facts) { facts } + if facts[:operatingsystem] == 'Ubuntu' and \ + facts[:operatingsystemmajrelease] == '18.04' and \ + facts[:puppetversion].split('.')[0].to_i < 5 + it "is unsuported" do + skip "Puppet service provider supports Ubuntu 18.04 from version >=5 (got #{facts[:puppetversion]})" + end + else + context 'with default parameters' do + it { is_expected.to compile.with_all_deps } + + it { is_expected.to contain_class('pacemaker::new::params') } + + it { is_expected.to contain_class('pacemaker::new') } + + it { is_expected.to contain_class('pacemaker::new::firewall') } + + it { is_expected.to contain_class('pacemaker::new::install') } + + it { is_expected.to contain_class('pacemaker::new::setup') } + + it { is_expected.to contain_class('pacemaker::new::service') } + end end - - context 'with default parameters' do - it { is_expected.to compile.with_all_deps } - - it { is_expected.to contain_class('pacemaker::new::params') } - - it { is_expected.to contain_class('pacemaker::new') } - - it { is_expected.to contain_class('pacemaker::new::firewall') } - - it { is_expected.to contain_class('pacemaker::new::install') } - - it { is_expected.to contain_class('pacemaker::new::setup') } - - it { is_expected.to contain_class('pacemaker::new::service') } - end - end end end