1
0
mirror of https://github.com/krislamo/puppet-fluentd synced 2024-11-09 20:50:34 +00:00

use rspec-puppet-facts for fluentd_repo_apt_spec

This commit is contained in:
Max Wilhelm 2017-08-14 17:56:20 +02:00
parent e8cdc9a9e0
commit d7f6d91a11

View File

@ -1,34 +1,81 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd::repo::apt', :type => :class do describe 'fluentd::repo::apt', :type => :class do
let(:facts) { on_supported_os.each do |os, facts|
{ context "on #{os}" do
:osfamily => 'Debian', let :facts do
:lsbdistid => 'Ubuntu', facts
:operatingsystem => 'Ubuntu', end
:lsbdistcodename => 'precise',
:architecture => 'amd64',
}
}
describe 'when called with no parameters on Ubuntu' do case facts[:osfamily]
it { when 'Debian'
should contain_class('apt') it {
should contain_apt__source('treasure-data').with({ should contain_class('apt')
'ensure' => 'present', should contain_apt__source('treasure-data').with({
'location' => 'http://packages.treasuredata.com/2/ubuntu/precise', 'ensure' => 'present',
'release' => 'precise', 'repos' => 'contrib',
'repos' => 'contrib', 'architecture' => 'amd64',
'architecture' => 'amd64', 'key' => {
'key' => { 'id' => 'BEE682289B2217F45AF4CC3F901F9177AB97ACBE',
'id' => 'BEE682289B2217F45AF4CC3F901F9177AB97ACBE', 'source' => 'http://packages.treasuredata.com/GPG-KEY-td-agent'
'source' => 'http://packages.treasuredata.com/GPG-KEY-td-agent' },
}, 'include' => {
'include' => { 'src' => false,
'src' => false, 'deb' => true
'deb' => true }
})
} }
}) case facts[:operatingsystem]
} when 'Ubuntu'
case facts[:lsbdistcodename]
when 'precise'
it {
should contain_apt__source('treasure-data').with({
'location' => 'http://packages.treasuredata.com/2/ubuntu/precise',
'release' => 'precise'
})
}
when 'trusty'
it {
should contain_apt__source('treasure-data').with({
'location' => 'http://packages.treasuredata.com/2/ubuntu/trusty',
'release' => 'trusty'
})
}
when 'xenial'
it {
should contain_apt__source('treasure-data').with({
'location' => 'http://packages.treasuredata.com/2/ubuntu/xenial',
'release' => 'xenial'
})
}
end
when 'Debian'
case facts[:lsbdistcodename]
when 'jessie'
it {
should contain_apt__source('treasure-data').with({
'location' => 'http://packages.treasuredata.com/2/debian/jessie',
'release' => 'jessie'
})
}
when 'squeeze'
it {
should contain_apt__source('treasure-data').with({
'location' => 'http://packages.treasuredata.com/2/debian/squeeze',
'release' => 'squeeze'
})
}
when 'wheezy'
it {
should contain_apt__source('treasure-data').with({
'location' => 'http://packages.treasuredata.com/2/debian/wheezy',
'release' => 'wheezy'
})
}
end
end
end
end
end end
end end