From 66f1850e15e1843ba06e8fcc7245eaabe146a6ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis-Philippe=20V=C3=A9ronneau?= Date: Thu, 22 Jun 2017 18:15:38 -0400 Subject: puppet 4 compat: mark integer as string --- manifests/reboot_required_notify.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/reboot_required_notify.pp b/manifests/reboot_required_notify.pp index 3463bb4..a538c9a 100644 --- a/manifests/reboot_required_notify.pp +++ b/manifests/reboot_required_notify.pp @@ -1,6 +1,6 @@ class apt::reboot_required_notify { - if versioncmp($::operatingsystemmajrelease, 8) >= 0 { + if versioncmp($::operatingsystemmajrelease, '8') >= 0 { class { 'apt::reboot_required_notify::jessie': } # Clean up systems that were upgraded from Wheezy or earlier: class { 'apt::reboot_required_notify::wheezy': ensure => absent } -- cgit v1.2.3 From 16e62f85e11113ff88512456a73faf2d27940893 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Sat, 24 Jun 2017 19:31:50 -0400 Subject: test: move release targets for debian In commit 8b45a8a, the release names were moved forward in order to follow the new Debian release. However, I didn't change the tests accordingly and thus the tests have been failing since then. --- spec/unit/custom_facts_spec.rb | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/spec/unit/custom_facts_spec.rb b/spec/unit/custom_facts_spec.rb index 9a28d92..c24b376 100644 --- a/spec/unit/custom_facts_spec.rb +++ b/spec/unit/custom_facts_spec.rb @@ -14,8 +14,8 @@ describe "Facter::Util::Fact" do Facter.fact(:lsbdistcodename).stubs(:value).returns("wheezy") end - it "debian_release = oldstable" do - expect(Facter.fact(:debian_release).value).to eq('oldstable') + it "debian_release = oldoldstable" do + expect(Facter.fact(:debian_release).value).to eq('oldoldstable') end it "debian_codename = wheezy" do @@ -26,8 +26,8 @@ describe "Facter::Util::Fact" do expect(Facter.fact(:debian_nextcodename).value).to eq('jessie') end - it "debian_nextrelease = stable" do - expect(Facter.fact(:debian_nextrelease).value).to eq('stable') + it "debian_nextrelease = oldstable" do + expect(Facter.fact(:debian_nextrelease).value).to eq('oldstable') end end @@ -38,8 +38,8 @@ describe "Facter::Util::Fact" do Facter.fact(:lsbdistcodename).stubs(:value).returns("jessie") end - it "debian_release = stable" do - expect(Facter.fact(:debian_release).value).to eq('stable') + it "debian_release = oldstable" do + expect(Facter.fact(:debian_release).value).to eq('oldstable') end it "debian_codename = jessie" do @@ -50,7 +50,31 @@ describe "Facter::Util::Fact" do expect(Facter.fact(:debian_nextcodename).value).to eq('stretch') end - it "debian_nextrelease = testing" do + it "debian_nextrelease = stable" do + expect(Facter.fact(:debian_nextrelease).value).to eq('stable') + end + end + + context 'Debian 9' do + before do + Facter.fact(:operatingsystem).stubs(:value).returns("Debian") + Facter.fact(:operatingsystemrelease).stubs(:value).returns("9.0") + Facter.fact(:lsbdistcodename).stubs(:value).returns("stretch") + end + + it "debian_release = stable" do + expect(Facter.fact(:debian_release).value).to eq('stable') + end + + it "debian_codename = stretch" do + expect(Facter.fact(:debian_codename).value).to eq('stretch') + end + + it "debian_nextcodename = stretch" do + expect(Facter.fact(:debian_nextcodename).value).to eq('buster') + end + + it "debian_nextrelease = stable" do expect(Facter.fact(:debian_nextrelease).value).to eq('testing') end end -- cgit v1.2.3 From 5f9ed88471a2aff0db4a90ba4dd7902c07e6a058 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Sat, 24 Jun 2017 23:44:01 -0400 Subject: specs: manually define debian_nextcodename when expected to be used with puppet 4.x when you don't define the debian_nextcodename, compilation fails saying that the variable is unknown. since we have unit tests specifically for this fact's behaviour, we want to stub out the fact's value in other tests so that we can verify the logic of manifests is actually good. --- spec/classes/init_spec.rb | 17 +++++++++-------- spec/defines/conf_spec.rb | 17 +++++++++-------- spec/defines/preferences_snippet_spec.rb | 17 +++++++++-------- 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 9ba554f..a3f19a0 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -5,14 +5,15 @@ describe 'apt', :type => :class do 'class { "apt": }' end let(:facts) { { - :lsbdistid => 'Debian', - :osfamily => 'Debian', - :operatingsystem => 'Debian', - :debian_release => 'jessie', - :debian_codename => 'jessie', - :lsbdistcodename => 'jessie', - :virtual => 'physical', - :puppetversion => Puppet.version, } } + :lsbdistid => 'Debian', + :osfamily => 'Debian', + :operatingsystem => 'Debian', + :debian_release => 'jessie', + :debian_codename => 'jessie', + :lsbdistcodename => 'jessie', + :debian_nextcodename => 'stretch', + :virtual => 'physical', + :puppetversion => Puppet.version, } } #it { is_expected.to compile.with_all_deps } it { is_expected.to compile } end diff --git a/spec/defines/conf_spec.rb b/spec/defines/conf_spec.rb index cc4fb1f..167b249 100644 --- a/spec/defines/conf_spec.rb +++ b/spec/defines/conf_spec.rb @@ -4,14 +4,15 @@ describe 'apt::apt_conf', :type => :define do 'class { "apt": }' end let(:facts) { { - :lsbdistid => 'Debian', - :osfamily => 'Debian', - :operatingsystem => 'Debian', - :debian_release => 'jessie', - :debian_codename => 'jessie', - :lsbdistcodename => 'jessie', - :virtual => 'physical', - :puppetversion => Puppet.version, } } + :lsbdistid => 'Debian', + :osfamily => 'Debian', + :operatingsystem => 'Debian', + :debian_release => 'jessie', + :debian_codename => 'jessie', + :lsbdistcodename => 'jessie', + :debian_nextcodename => 'stretch', + :virtual => 'physical', + :puppetversion => Puppet.version, } } let :title do 'norecommends' end diff --git a/spec/defines/preferences_snippet_spec.rb b/spec/defines/preferences_snippet_spec.rb index 012a5f6..6b1a23f 100644 --- a/spec/defines/preferences_snippet_spec.rb +++ b/spec/defines/preferences_snippet_spec.rb @@ -4,14 +4,15 @@ describe 'apt::preferences_snippet', :type => :define do 'class { "apt": }' end let(:facts) { { - :lsbdistid => 'Debian', - :osfamily => 'Debian', - :operatingsystem => 'Debian', - :debian_release => 'jessie', - :debian_codename => 'jessie', - :lsbdistcodename => 'jessie', - :virtual => 'physical', - :puppetversion => Puppet.version, } } + :lsbdistid => 'Debian', + :osfamily => 'Debian', + :operatingsystem => 'Debian', + :debian_release => 'jessie', + :debian_codename => 'jessie', + :lsbdistcodename => 'jessie', + :debian_nextcodename => 'stretch', + :virtual => 'physical', + :puppetversion => Puppet.version, } } let :title do 'test' end -- cgit v1.2.3