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

Don't stub puppetversion #521

Merged
merged 1 commit into from
May 6, 2015
Merged
Show file tree
Hide file tree
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
14 changes: 7 additions & 7 deletions spec/classes/apt_backports_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
:lsbdistid => 'Debian',
:osfamily => 'Debian',
:lsbdistcodename => 'wheezy',
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end
it { is_expected.to contain_apt__source('backports').with({
Expand All @@ -28,7 +28,7 @@
:lsbdistid => 'Debian',
:osfamily => 'Debian',
:lsbdistcodename => 'squeeze',
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end
it { is_expected.to contain_apt__source('backports').with({
Expand All @@ -46,7 +46,7 @@
:lsbdistid => 'Ubuntu',
:osfamily => 'Debian',
:lsbdistcodename => 'trusty',
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end
it { is_expected.to contain_apt__source('backports').with({
Expand All @@ -64,7 +64,7 @@
:lsbdistid => 'Ubuntu',
:osfamily => 'Debian',
:lsbdistcodename => 'trusty',
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end
let(:params) do
Expand All @@ -91,7 +91,7 @@
:lsbdistid => 'Ubuntu',
:osfamily => 'Debian',
:lsbdistcodename => 'trusty',
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end
let(:params) do
Expand All @@ -117,7 +117,7 @@
:lsbdistid => 'linuxmint',
:osfamily => 'Debian',
:lsbdistcodename => 'qiana',
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end
context 'sets all the needed things' do
Expand Down Expand Up @@ -201,7 +201,7 @@
:lsbdistid => 'Ubuntu',
:osfamily => 'Debian',
:lsbdistcodename => 'trusty',
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end
context 'invalid location' do
Expand Down
12 changes: 6 additions & 6 deletions spec/classes/apt_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'
describe 'apt' do
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => '3.5.0'} }
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => Puppet.version} }

context 'defaults' do
it { is_expected.to contain_file('sources.list').that_notifies('Exec[apt_update]').only_with({
Expand Down Expand Up @@ -132,7 +132,7 @@
{ :osfamily => 'Debian',
:lsbdistcodename => 'precise',
:lsbdistid => 'Debian',
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end
let(:params) { { :sources => {
Expand Down Expand Up @@ -174,7 +174,7 @@
{ :osfamily => 'Debian',
:lsbdistcodename => 'precise',
:lsbdistid => 'Debian',
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end
let(:params) { { :keys => {
Expand All @@ -200,7 +200,7 @@
{ :osfamily => 'Debian',
:lsbdistcodename => 'precise',
:lsbdistid => 'ubuntu',
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end
let(:params) { { :ppas => {
Expand All @@ -217,7 +217,7 @@
{ :osfamily => 'Debian',
:lsbdistcodename => 'precise',
:lsbdistid => 'Debian',
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end
let(:params) { { :settings => {
Expand Down Expand Up @@ -268,7 +268,7 @@

context 'with unsupported osfamily' do
let :facts do
{ :osfamily => 'Darwin', :puppetversion => '3.5.0',}
{ :osfamily => 'Darwin', :puppetversion => Puppet.version,}
end

it do
Expand Down
14 changes: 7 additions & 7 deletions spec/classes/apt_update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
context "and apt::update['frequency']='always'" do
{ 'a recent run' => Time.now.to_i, 'we are due for a run' => 1406660561,'the update-success-stamp file does not exist' => -1 }.each_pair do |desc, factval|
context "and $::apt_update_last_success indicates #{desc}" do
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :apt_update_last_success => factval, :lsbdistcodename => 'wheezy', :puppetversion => '3.5.0', } }
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :apt_update_last_success => factval, :lsbdistcodename => 'wheezy', :puppetversion => Puppet.version, } }
let (:pre_condition) { "class{'::apt': update => {'frequency' => 'always' },}" }
it 'should trigger an apt-get update run' do
#set the apt_update exec's refreshonly attribute to false
Expand All @@ -14,7 +14,7 @@
end
end
context 'when $::apt_update_last_success is nil' do
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => '3.5.0', } }
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => Puppet.version, } }
let (:pre_condition) { "class{ '::apt': update => {'frequency' => 'always' },}" }
it 'should trigger an apt-get update run' do
#set the apt_update exec\'s refreshonly attribute to false
Expand All @@ -25,7 +25,7 @@
context "and apt::update['frequency']='reluctantly'" do
{'a recent run' => Time.now.to_i, 'we are due for a run' => 1406660561,'the update-success-stamp file does not exist' => -1 }.each_pair do |desc, factval|
context "and $::apt_update_last_success indicates #{desc}" do
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :apt_update_last_success => factval, :lsbdistcodename => 'wheezy', :puppetversion => '3.5.0',} }
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :apt_update_last_success => factval, :lsbdistcodename => 'wheezy', :puppetversion => Puppet.version,} }
let (:pre_condition) { "class{ '::apt': update => {'frequency' => 'reluctantly' },}" }
it 'should not trigger an apt-get update run' do
#don't change the apt_update exec's refreshonly attribute. (it should be true)
Expand All @@ -34,7 +34,7 @@
end
end
context 'when $::apt_update_last_success is nil' do
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => '3.5.0', } }
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => Puppet.version, } }
let (:pre_condition) { "class{ '::apt': update => {'frequency' => 'reluctantly' },}" }
it 'should not trigger an apt-get update run' do
#don't change the apt_update exec's refreshonly attribute. (it should be true)
Expand All @@ -46,7 +46,7 @@
context "and apt::update['frequency'] has the value of #{update_frequency}" do
{ 'we are due for a run' => 1406660561,'the update-success-stamp file does not exist' => -1 }.each_pair do |desc, factval|
context "and $::apt_update_last_success indicates #{desc}" do
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :apt_update_last_success => factval, :lsbdistcodename => 'wheezy', :puppetversion => '3.5.0', } }
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :apt_update_last_success => factval, :lsbdistcodename => 'wheezy', :puppetversion => Puppet.version, } }
let (:pre_condition) { "class{ '::apt': update => {'frequency' => '#{update_frequency}',} }" }
it 'should trigger an apt-get update run' do
#set the apt_update exec\'s refreshonly attribute to false
Expand All @@ -55,15 +55,15 @@
end
end
context 'when the $::apt_update_last_success fact has a recent value' do
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :apt_update_last_success => Time.now.to_i, :puppetversion => '3.5.0', } }
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :apt_update_last_success => Time.now.to_i, :puppetversion => Puppet.version, } }
let (:pre_condition) { "class{ '::apt': update => {'frequency' => '#{update_frequency}',} }" }
it 'should not trigger an apt-get update run' do
#don't change the apt_update exec\'s refreshonly attribute. (it should be true)
is_expected.to contain_exec('apt_update').with({'refreshonly' => true})
end
end
context 'when $::apt_update_last_success is nil' do
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :apt_update_last_success => nil, :puppetversion => '3.5.0', } }
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :apt_update_last_success => nil, :puppetversion => Puppet.version, } }
let (:pre_condition) { "class{ '::apt': update => {'frequency' => '#{update_frequency}',} }" }
it 'should trigger an apt-get update run' do
#set the apt_update exec\'s refreshonly attribute to false
Expand Down
18 changes: 2 additions & 16 deletions spec/classes/params_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'
describe 'apt::params', :type => :class do
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => '3.5.0', } }
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => Puppet.version, } }
let (:title) { 'my_package' }

it { is_expected.to contain_apt__params }
Expand All @@ -13,7 +13,7 @@
end

describe "With lsb-release not installed" do
let(:facts) { { :osfamily => 'Debian', :puppetversion => '3.5.0', } }
let(:facts) { { :osfamily => 'Debian', :puppetversion => Puppet.version, } }
let (:title) { 'my_package' }

it do
Expand All @@ -22,18 +22,4 @@
}.to raise_error(Puppet::Error, /Unable to determine lsbdistid, please install lsb-release first/)
end
end

describe "With old puppet version" do
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :lsbdistrelease => 'foo', :lsbdistdescription => 'bar', :lsbminordistrelease => 'baz', :lsbmajdistrelease => 'foobar', :puppetversion => '3.4.0', } }
let(:title) { 'my_package' }
it { is_expected.to contain_apt__params }

# There are 4 resources in this class currently
# there should not be any more resources because it is a params class
# The resources are class[apt::params], class[main], class[settings], stage[main]
it "Should not contain any resources" do
expect(subject.call.resources.size).to eq(4)
end
end

end
2 changes: 1 addition & 1 deletion spec/defines/conf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
let :pre_condition do
'class { "apt": }'
end
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => '3.5.0', } }
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => Puppet.version, } }
let :title do
'norecommends'
end
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'class { "apt": }'
end

let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => '3.5.0', } }
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => Puppet.version, } }

GPG_KEY_ID = '47B320EB4C7C375AA9DAE1A01054B7A24BD6EC30'

Expand Down
2 changes: 1 addition & 1 deletion spec/defines/pin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
let :pre_condition do
'class { "apt": }'
end
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => '3.5.0', } }
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => Puppet.version, } }
let(:title) { 'my_pin' }

context 'defaults' do
Expand Down
20 changes: 10 additions & 10 deletions spec/defines/ppa_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
:operatingsystem => 'Ubuntu',
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end

Expand Down Expand Up @@ -51,7 +51,7 @@
:operatingsystem => 'Ubuntu',
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end

Expand Down Expand Up @@ -83,7 +83,7 @@
:operatingsystem => 'Ubuntu',
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end
let :params do
Expand Down Expand Up @@ -122,7 +122,7 @@
:operatingsystem => 'Ubuntu',
:lsbdistid => 'Ubuntu',
:osfamily => 'Debian',
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end
let :params do
Expand Down Expand Up @@ -158,7 +158,7 @@
:operatingsystem => 'Ubuntu',
:lsbdistid => 'Ubuntu',
:osfamily => 'Debian',
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end
let :params do
Expand Down Expand Up @@ -192,7 +192,7 @@
:operatingsystem => 'Ubuntu',
:lsbdistid => 'Ubuntu',
:osfamily => 'Debian',
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end
let :params do
Expand Down Expand Up @@ -226,7 +226,7 @@
:operatingsystem => 'Ubuntu',
:lsbdistid => 'Ubuntu',
:osfamily => 'Debian',
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end
let :params do
Expand Down Expand Up @@ -258,7 +258,7 @@
:operatingsystem => 'Ubuntu',
:lsbdistid => 'Ubuntu',
:osfamily => 'Debian',
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end
let(:title) { 'ppa:foo' }
Expand All @@ -282,7 +282,7 @@
:lsbdistid => 'Ubuntu',
:osfamily => 'Debian',
:lsbdistcodeanme => nil,
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end
let(:title) { 'ppa:foo' }
Expand All @@ -301,7 +301,7 @@
:operatingsystem => 'Debian',
:lsbdistid => 'debian',
:osfamily => 'Debian',
:puppetversion => '3.5.0',
:puppetversion => Puppet.version,
}
end
let(:title) { 'ppa:foo' }
Expand Down
4 changes: 2 additions & 2 deletions spec/defines/setting_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe 'apt::setting' do
let(:pre_condition) { 'class { "apt": }' }
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => '3.5.0', } }
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => Puppet.version, } }
let(:title) { 'conf-teddybear' }

let(:default_params) { { :content => 'di' } }
Expand Down Expand Up @@ -61,7 +61,7 @@
apt::setting { "list-teddybear": content => "foo" }
'
end
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => '3.5.0', } }
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => Puppet.version, } }
let(:title) { 'conf-teddybear' }
let(:default_params) { { :content => 'di' } }

Expand Down
Loading