Added modules
This commit is contained in:
parent
c53c931217
commit
59ec520742
646 changed files with 35182 additions and 0 deletions
170
modules/apt/spec/classes/apt_spec.rb
Normal file
170
modules/apt/spec/classes/apt_spec.rb
Normal file
|
@ -0,0 +1,170 @@
|
|||
require 'spec_helper'
|
||||
describe 'apt', :type => :class do
|
||||
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
|
||||
let :default_params do
|
||||
{
|
||||
:disable_keys => :undef,
|
||||
:always_apt_update => false,
|
||||
:purge_sources_list => false,
|
||||
:purge_sources_list_d => false,
|
||||
}
|
||||
end
|
||||
|
||||
[{},
|
||||
{
|
||||
:disable_keys => true,
|
||||
:always_apt_update => true,
|
||||
:proxy_host => true,
|
||||
:proxy_port => '3128',
|
||||
:purge_sources_list => true,
|
||||
:purge_sources_list_d => true,
|
||||
},
|
||||
{
|
||||
:purge_preferences => true,
|
||||
:purge_preferences_d => true,
|
||||
},
|
||||
{
|
||||
:disable_keys => false
|
||||
}
|
||||
].each do |param_set|
|
||||
describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do
|
||||
let :param_hash do
|
||||
default_params.merge(param_set)
|
||||
end
|
||||
|
||||
let :params do
|
||||
param_set
|
||||
end
|
||||
|
||||
let :refresh_only_apt_update do
|
||||
if param_hash[:always_apt_update]
|
||||
false
|
||||
else
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
it { should contain_class("apt::params") }
|
||||
|
||||
it {
|
||||
if param_hash[:purge_sources_list]
|
||||
should contain_file("sources.list").with({
|
||||
'path' => "/etc/apt/sources.list",
|
||||
'ensure' => "present",
|
||||
'owner' => "root",
|
||||
'group' => "root",
|
||||
'mode' => "0644",
|
||||
"content" => "# Repos managed by puppet.\n"
|
||||
})
|
||||
else
|
||||
should contain_file("sources.list").with({
|
||||
'path' => "/etc/apt/sources.list",
|
||||
'ensure' => "present",
|
||||
'owner' => "root",
|
||||
'group' => "root",
|
||||
'mode' => "0644",
|
||||
'content' => nil
|
||||
})
|
||||
end
|
||||
}
|
||||
it {
|
||||
if param_hash[:purge_sources_list_d]
|
||||
should create_file("sources.list.d").with({
|
||||
'path' => "/etc/apt/sources.list.d",
|
||||
'ensure' => "directory",
|
||||
'owner' => "root",
|
||||
'group' => "root",
|
||||
'purge' => true,
|
||||
'recurse' => true,
|
||||
'notify' => 'Exec[apt_update]'
|
||||
})
|
||||
else
|
||||
should create_file("sources.list.d").with({
|
||||
'path' => "/etc/apt/sources.list.d",
|
||||
'ensure' => "directory",
|
||||
'owner' => "root",
|
||||
'group' => "root",
|
||||
'purge' => false,
|
||||
'recurse' => false,
|
||||
'notify' => 'Exec[apt_update]'
|
||||
})
|
||||
end
|
||||
}
|
||||
it {
|
||||
if param_hash[:purge_preferences]
|
||||
should create_file('apt-preferences').with({
|
||||
:ensure => 'absent',
|
||||
:path => '/etc/apt/preferences',
|
||||
})
|
||||
else
|
||||
should_not contain_file('apt-preferences')
|
||||
end
|
||||
}
|
||||
|
||||
it {
|
||||
if param_hash[:purge_preferences_d]
|
||||
should create_file("preferences.d").with({
|
||||
'path' => "/etc/apt/preferences.d",
|
||||
'ensure' => "directory",
|
||||
'owner' => "root",
|
||||
'group' => "root",
|
||||
'purge' => true,
|
||||
'recurse' => true,
|
||||
})
|
||||
else
|
||||
should create_file("preferences.d").with({
|
||||
'path' => "/etc/apt/preferences.d",
|
||||
'ensure' => "directory",
|
||||
'owner' => "root",
|
||||
'group' => "root",
|
||||
'purge' => false,
|
||||
'recurse' => false,
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
it {
|
||||
should contain_exec("apt_update").with({
|
||||
'command' => "/usr/bin/apt-get update",
|
||||
'refreshonly' => refresh_only_apt_update
|
||||
})
|
||||
}
|
||||
|
||||
it {
|
||||
if param_hash[:disable_keys] == true
|
||||
should create_file("99unauth").with({
|
||||
'content' => "APT::Get::AllowUnauthenticated 1;\n",
|
||||
'ensure' => "present",
|
||||
'path' => "/etc/apt/apt.conf.d/99unauth"
|
||||
})
|
||||
elsif param_hash[:disable_keys] == false
|
||||
should create_file("99unauth").with({
|
||||
'ensure' => "absent",
|
||||
'path' => "/etc/apt/apt.conf.d/99unauth"
|
||||
})
|
||||
elsif param_hash[:disable_keys] != :undef
|
||||
should_not create_file("99unauth").with({
|
||||
'path' => "/etc/apt/apt.conf.d/99unauth"
|
||||
})
|
||||
end
|
||||
}
|
||||
describe 'when setting a proxy' do
|
||||
it {
|
||||
if param_hash[:proxy_host]
|
||||
should contain_file('01proxy').with(
|
||||
'path' => '/etc/apt/apt.conf.d/01proxy',
|
||||
'content' => "Acquire::http::Proxy \"http://#{param_hash[:proxy_host]}:#{param_hash[:proxy_port]}\";\n",
|
||||
'notify' => "Exec[apt_update]"
|
||||
)
|
||||
else
|
||||
should contain_file('01proxy').with(
|
||||
'path' => '/etc/apt/apt.conf.d/01proxy',
|
||||
'notify' => 'Exec[apt_update]',
|
||||
'ensure' => 'absent'
|
||||
)
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
101
modules/apt/spec/classes/backports_spec.rb
Normal file
101
modules/apt/spec/classes/backports_spec.rb
Normal file
|
@ -0,0 +1,101 @@
|
|||
require 'spec_helper'
|
||||
describe 'apt::backports', :type => :class do
|
||||
|
||||
describe 'when asigning a custom priority to backports' do
|
||||
let :facts do
|
||||
{
|
||||
'lsbdistcodename' => 'Karmic',
|
||||
'lsbdistid' => 'Ubuntu'
|
||||
}
|
||||
end
|
||||
|
||||
context 'integer priority' do
|
||||
let :params do { :pin_priority => 500 } end
|
||||
|
||||
it { should contain_apt__source('backports').with({
|
||||
'location' => 'http://old-releases.ubuntu.com/ubuntu',
|
||||
'release' => 'karmic-backports',
|
||||
'repos' => 'main universe multiverse restricted',
|
||||
'key' => '437D05B5',
|
||||
'key_server' => 'pgp.mit.edu',
|
||||
'pin' => 500,
|
||||
})
|
||||
}
|
||||
end
|
||||
|
||||
context 'invalid priority' do
|
||||
let :params do { :pin_priority => 'banana' } end
|
||||
it 'should fail' do
|
||||
expect { subject }.to raise_error(/must be an integer/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when turning on backports for ubuntu karmic' do
|
||||
|
||||
let :facts do
|
||||
{
|
||||
'lsbdistcodename' => 'Karmic',
|
||||
'lsbdistid' => 'Ubuntu'
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_apt__source('backports').with({
|
||||
'location' => 'http://old-releases.ubuntu.com/ubuntu',
|
||||
'release' => 'karmic-backports',
|
||||
'repos' => 'main universe multiverse restricted',
|
||||
'key' => '437D05B5',
|
||||
'key_server' => 'pgp.mit.edu',
|
||||
'pin' => 200,
|
||||
})
|
||||
}
|
||||
end
|
||||
|
||||
describe "when turning on backports for debian squeeze" do
|
||||
|
||||
let :facts do
|
||||
{
|
||||
'lsbdistcodename' => 'Squeeze',
|
||||
'lsbdistid' => 'Debian',
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_apt__source('backports').with({
|
||||
'location' => 'http://backports.debian.org/debian-backports',
|
||||
'release' => 'squeeze-backports',
|
||||
'repos' => 'main contrib non-free',
|
||||
'key' => '46925553',
|
||||
'key_server' => 'pgp.mit.edu',
|
||||
'pin' => 200,
|
||||
})
|
||||
}
|
||||
end
|
||||
|
||||
describe "when turning on backports for debian squeeze but using your own mirror" do
|
||||
|
||||
let :facts do
|
||||
{
|
||||
'lsbdistcodename' => 'Squeeze',
|
||||
'lsbdistid' => 'Debian'
|
||||
}
|
||||
end
|
||||
|
||||
let :location do
|
||||
'http://mirrors.example.com/debian-backports'
|
||||
end
|
||||
|
||||
let :params do
|
||||
{ 'location' => location }
|
||||
end
|
||||
|
||||
it { should contain_apt__source('backports').with({
|
||||
'location' => location,
|
||||
'release' => 'squeeze-backports',
|
||||
'repos' => 'main contrib non-free',
|
||||
'key' => '46925553',
|
||||
'key_server' => 'pgp.mit.edu',
|
||||
'pin' => 200,
|
||||
})
|
||||
}
|
||||
end
|
||||
end
|
15
modules/apt/spec/classes/debian_testing_spec.rb
Normal file
15
modules/apt/spec/classes/debian_testing_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
require 'spec_helper'
|
||||
describe 'apt::debian::testing', :type => :class do
|
||||
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
|
||||
it {
|
||||
should contain_apt__source("debian_testing").with({
|
||||
"location" => "http://debian.mirror.iweb.ca/debian/",
|
||||
"release" => "testing",
|
||||
"repos" => "main contrib non-free",
|
||||
"required_packages" => "debian-keyring debian-archive-keyring",
|
||||
"key" => "46925553",
|
||||
"key_server" => "subkeys.pgp.net",
|
||||
"pin" => "-10"
|
||||
})
|
||||
}
|
||||
end
|
15
modules/apt/spec/classes/debian_unstable_spec.rb
Normal file
15
modules/apt/spec/classes/debian_unstable_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
require 'spec_helper'
|
||||
describe 'apt::debian::unstable', :type => :class do
|
||||
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
|
||||
it {
|
||||
should contain_apt__source("debian_unstable").with({
|
||||
"location" => "http://debian.mirror.iweb.ca/debian/",
|
||||
"release" => "unstable",
|
||||
"repos" => "main contrib non-free",
|
||||
"required_packages" => "debian-keyring debian-archive-keyring",
|
||||
"key" => "46925553",
|
||||
"key_server" => "subkeys.pgp.net",
|
||||
"pin" => "-10"
|
||||
})
|
||||
}
|
||||
end
|
57
modules/apt/spec/classes/init_spec.rb
Normal file
57
modules/apt/spec/classes/init_spec.rb
Normal file
|
@ -0,0 +1,57 @@
|
|||
require 'spec_helper'
|
||||
describe 'apt' do
|
||||
context 'with sources defined on valid osfamily' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian',
|
||||
:lsbdistcodename => 'precise',
|
||||
:lsbdistid => 'Debian',
|
||||
}
|
||||
end
|
||||
let(:params) { { :sources => {
|
||||
'debian_unstable' => {
|
||||
'location' => 'http://debian.mirror.iweb.ca/debian/',
|
||||
'release' => 'unstable',
|
||||
'repos' => 'main contrib non-free',
|
||||
'required_packages' => 'debian-keyring debian-archive-keyring',
|
||||
'key' => '55BE302B',
|
||||
'key_server' => 'subkeys.pgp.net',
|
||||
'pin' => '-10',
|
||||
'include_src' => true
|
||||
},
|
||||
'puppetlabs' => {
|
||||
'location' => 'http://apt.puppetlabs.com',
|
||||
'repos' => 'main',
|
||||
'key' => '4BD6EC30',
|
||||
'key_server' => 'pgp.mit.edu',
|
||||
}
|
||||
} } }
|
||||
|
||||
it {
|
||||
should contain_file('debian_unstable.list').with({
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/apt/sources.list.d/debian_unstable.list',
|
||||
'owner' => 'root',
|
||||
'group' => 'root',
|
||||
'mode' => '0644',
|
||||
'notify' => 'Exec[apt_update]',
|
||||
})
|
||||
}
|
||||
|
||||
it { should contain_file('debian_unstable.list').with_content(/^deb http:\/\/debian.mirror.iweb.ca\/debian\/ unstable main contrib non-free$/) }
|
||||
it { should contain_file('debian_unstable.list').with_content(/^deb-src http:\/\/debian.mirror.iweb.ca\/debian\/ unstable main contrib non-free$/) }
|
||||
|
||||
it {
|
||||
should contain_file('puppetlabs.list').with({
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/apt/sources.list.d/puppetlabs.list',
|
||||
'owner' => 'root',
|
||||
'group' => 'root',
|
||||
'mode' => '0644',
|
||||
'notify' => 'Exec[apt_update]',
|
||||
})
|
||||
}
|
||||
|
||||
it { should contain_file('puppetlabs.list').with_content(/^deb http:\/\/apt.puppetlabs.com precise main$/) }
|
||||
it { should contain_file('puppetlabs.list').with_content(/^deb-src http:\/\/apt.puppetlabs.com precise main$/) }
|
||||
end
|
||||
end
|
27
modules/apt/spec/classes/params_spec.rb
Normal file
27
modules/apt/spec/classes/params_spec.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
require 'spec_helper'
|
||||
describe 'apt::params', :type => :class do
|
||||
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
|
||||
let (:title) { 'my_package' }
|
||||
|
||||
it { should 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
|
||||
subject.resources.size.should == 4
|
||||
end
|
||||
|
||||
describe "With unknown lsbdistid" do
|
||||
|
||||
let(:facts) { { :lsbdistid => 'CentOS' } }
|
||||
let (:title) { 'my_package' }
|
||||
|
||||
it do
|
||||
expect {
|
||||
should compile
|
||||
}.to raise_error(Puppet::Error, /Unsupported lsbdistid/)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
23
modules/apt/spec/classes/release_spec.rb
Normal file
23
modules/apt/spec/classes/release_spec.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
require 'spec_helper'
|
||||
describe 'apt::release', :type => :class do
|
||||
let(:facts) { { :lsbdistid => 'Debian' } }
|
||||
let (:title) { 'my_package' }
|
||||
|
||||
let :param_set do
|
||||
{ :release_id => 'precise' }
|
||||
end
|
||||
|
||||
let (:params) { param_set }
|
||||
|
||||
it { should contain_class("apt::params") }
|
||||
|
||||
it {
|
||||
should contain_file("/etc/apt/apt.conf.d/01release").with({
|
||||
"mode" => "0644",
|
||||
"owner" => "root",
|
||||
"group" => "root",
|
||||
"content" => "APT::Default-Release \"#{param_set[:release_id]}\";"
|
||||
})
|
||||
}
|
||||
end
|
||||
|
291
modules/apt/spec/classes/unattended_upgrades_spec.rb
Normal file
291
modules/apt/spec/classes/unattended_upgrades_spec.rb
Normal file
|
@ -0,0 +1,291 @@
|
|||
require 'spec_helper'
|
||||
describe 'apt::unattended_upgrades', :type => :class do
|
||||
let(:file_unattended) { '/etc/apt/apt.conf.d/50unattended-upgrades' }
|
||||
let(:file_periodic) { '/etc/apt/apt.conf.d/10periodic' }
|
||||
let(:facts) { { :lsbdistid => 'Debian' } }
|
||||
|
||||
it { should contain_package("unattended-upgrades") }
|
||||
|
||||
it {
|
||||
should create_file("/etc/apt/apt.conf.d/50unattended-upgrades").with({
|
||||
"owner" => "root",
|
||||
"group" => "root",
|
||||
"mode" => "0644",
|
||||
"require" => "Package[unattended-upgrades]",
|
||||
})
|
||||
}
|
||||
|
||||
it {
|
||||
should create_file("/etc/apt/apt.conf.d/10periodic").with({
|
||||
"owner" => "root",
|
||||
"group" => "root",
|
||||
"mode" => "0644",
|
||||
"require" => "Package[unattended-upgrades]",
|
||||
})
|
||||
}
|
||||
|
||||
describe "origins" do
|
||||
describe 'on Debian' do
|
||||
default_facts = { :lsbdistid => 'Debian' }
|
||||
context 'defaults' do
|
||||
let :facts do default_facts end
|
||||
it {
|
||||
should contain_file(file_unattended).with_content(
|
||||
/^Unattended-Upgrade::Origins-Pattern/
|
||||
).with_content(
|
||||
/"origin=Debian,archive=stable,label=Debian-Security";/
|
||||
)
|
||||
}
|
||||
end
|
||||
context 'defaults with custom origin' do
|
||||
let :facts do default_facts end
|
||||
let :params do { :origins => ['bananana']} end
|
||||
it {
|
||||
should contain_file(file_unattended).with_content(
|
||||
/^Unattended-Upgrade::Origins-Pattern/
|
||||
).with_content(
|
||||
/"bananana";/
|
||||
)
|
||||
}
|
||||
end
|
||||
context 'defaults with invalid origin' do
|
||||
let :facts do default_facts end
|
||||
let :params do { :origins => 'bananana'} end
|
||||
it {
|
||||
expect {subject}.to raise_error(/is not an Array/)
|
||||
}
|
||||
end
|
||||
context 'squeeze' do
|
||||
let :facts do default_facts.merge({:lsbdistcodename => 'squeeze'}) end
|
||||
it {
|
||||
should contain_file(file_unattended).with_content(
|
||||
/^Unattended-Upgrade::Allowed-Origins/
|
||||
).with_content(
|
||||
/"\${distro_id} \${distro_codename}-security";/
|
||||
).with_content(
|
||||
/"\${distro_id} oldstable";/
|
||||
)
|
||||
}
|
||||
end
|
||||
context 'wheezy' do
|
||||
let :facts do default_facts.merge({:lsbdistcodename => 'wheezy'}) end
|
||||
it {
|
||||
should contain_file(file_unattended).with_content(
|
||||
/^Unattended-Upgrade::Origins-Pattern/
|
||||
).with_content(
|
||||
/"origin=Debian,archive=stable,label=Debian-Security";/
|
||||
)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
describe 'on Ubuntu' do
|
||||
default_facts = { :lsbdistid => 'Ubuntu' }
|
||||
context 'default' do
|
||||
let :facts do default_facts end
|
||||
it {
|
||||
should contain_file(file_unattended).with_content(
|
||||
/^Unattended-Upgrade::Allowed-Origins/
|
||||
).with_content(
|
||||
/"\${distro_id}\:\${distro_codename}-security";/
|
||||
)
|
||||
}
|
||||
end
|
||||
context 'lucid' do
|
||||
let :facts do default_facts.merge({:lsbdistcodename => 'lucid'}) end
|
||||
it {
|
||||
should contain_file(file_unattended).with_content(
|
||||
/^Unattended-Upgrade::Allowed-Origins/
|
||||
).with_content(
|
||||
/"\${distro_id} \${distro_codename}-security";/
|
||||
)
|
||||
}
|
||||
end
|
||||
context 'precise' do
|
||||
let :facts do default_facts.merge({:lsbdistcodename => 'precise'}) end
|
||||
it {
|
||||
should contain_file(file_unattended).with_content(
|
||||
/^Unattended-Upgrade::Allowed-Origins/
|
||||
).with_content(
|
||||
/"\${distro_id}\:\${distro_codename}-security";/
|
||||
)
|
||||
}
|
||||
end
|
||||
context 'trusty' do
|
||||
let :facts do default_facts.merge({:lsbdistcodename => 'trusty'}) end
|
||||
it {
|
||||
should contain_file(file_unattended).with_content(
|
||||
/^Unattended-Upgrade::Allowed-Origins/
|
||||
).with_content(
|
||||
/"\${distro_id}\:\${distro_codename}-security";/
|
||||
)
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "blacklist" do
|
||||
describe "with param defaults" do
|
||||
let(:params) {{ }}
|
||||
it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Package-Blacklist \{\n\};$/) }
|
||||
end
|
||||
|
||||
describe "with blacklist => []" do
|
||||
let :params do
|
||||
{ :blacklist => ['libc6', 'libc6-dev'] }
|
||||
end
|
||||
it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Package-Blacklist \{\n\t"libc6";\n\t"libc6-dev";\n\};$/) }
|
||||
end
|
||||
end
|
||||
|
||||
describe "with update => 2" do
|
||||
let :params do
|
||||
{ :update => "2" }
|
||||
end
|
||||
it { should contain_file(file_periodic).with_content(/^APT::Periodic::Update-Package-Lists "2";$/) }
|
||||
end
|
||||
|
||||
describe "with download => 2" do
|
||||
let :params do
|
||||
{ :download => "2" }
|
||||
end
|
||||
it { should contain_file(file_periodic).with_content(/^APT::Periodic::Download-Upgradeable-Packages "2";$/) }
|
||||
end
|
||||
|
||||
describe "with upgrade => 2" do
|
||||
let :params do
|
||||
{ :upgrade => "2" }
|
||||
end
|
||||
it { should contain_file(file_periodic).with_content(/^APT::Periodic::Unattended-Upgrade "2";$/) }
|
||||
end
|
||||
|
||||
describe "with autoclean => 2" do
|
||||
let :params do
|
||||
{ :autoclean => "2" }
|
||||
end
|
||||
it { should contain_file(file_periodic).with_content(/^APT::Periodic::AutocleanInterval "2";$/) }
|
||||
end
|
||||
|
||||
describe "with auto_fix => false" do
|
||||
let :params do
|
||||
{ :auto_fix => false }
|
||||
end
|
||||
it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::AutoFixInterruptedDpkg "false";$/) }
|
||||
end
|
||||
|
||||
describe "with minimal_steps => true" do
|
||||
let :params do
|
||||
{ :minimal_steps => true }
|
||||
end
|
||||
it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::MinimalSteps "true";$/) }
|
||||
end
|
||||
|
||||
describe "with install_on_shutdown => true" do
|
||||
let :params do
|
||||
{ :install_on_shutdown => true }
|
||||
end
|
||||
it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::InstallOnShutdown "true";$/) }
|
||||
end
|
||||
|
||||
describe "mail_to" do
|
||||
describe "param defaults" do
|
||||
let(:params) {{ }}
|
||||
it { should_not contain_file(file_unattended).with_content(/^Unattended-Upgrade::Mail /) }
|
||||
it { should_not contain_file(file_unattended).with_content(/^Unattended-Upgrade::MailOnlyOnError /) }
|
||||
end
|
||||
|
||||
describe "with mail_to => user@website, mail_only_on_error => true" do
|
||||
let :params do
|
||||
{ :mail_to => "user@website",
|
||||
:mail_only_on_error => true }
|
||||
end
|
||||
it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Mail "user@website";$/) }
|
||||
it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::MailOnlyOnError "true";$/) }
|
||||
end
|
||||
end
|
||||
|
||||
describe "with remove_unused => false" do
|
||||
let :params do
|
||||
{ :remove_unused => false }
|
||||
end
|
||||
it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Remove-Unused-Dependencies "false";$/) }
|
||||
end
|
||||
|
||||
describe "with auto_reboot => true" do
|
||||
let :params do
|
||||
{ :auto_reboot => true }
|
||||
end
|
||||
it { should contain_file(file_unattended).with_content(/^Unattended-Upgrade::Automatic-Reboot "true";$/) }
|
||||
end
|
||||
|
||||
describe "dl_limit" do
|
||||
describe "param defaults" do
|
||||
let(:params) {{ }}
|
||||
it { should_not contain_file(file_unattended).with_content(/^Acquire::http::Dl-Limit /) }
|
||||
end
|
||||
|
||||
describe "with dl_limit => 70" do
|
||||
let :params do
|
||||
{ :dl_limit => "70" }
|
||||
end
|
||||
it { should contain_file(file_unattended).with_content(/^Acquire::http::Dl-Limit "70";$/) }
|
||||
end
|
||||
end
|
||||
|
||||
describe "with enable => 0" do
|
||||
let :params do
|
||||
{ :enable => "0" }
|
||||
end
|
||||
it { should contain_file(file_periodic).with_content(/^APT::Periodic::Enable "0";$/) }
|
||||
end
|
||||
|
||||
describe "with backup_interval => 1" do
|
||||
let :params do
|
||||
{ :backup_interval => "1" }
|
||||
end
|
||||
it { should contain_file(file_periodic).with_content(/^APT::Periodic::BackUpArchiveInterval "1";$/) }
|
||||
end
|
||||
|
||||
describe "with backup_level => 0" do
|
||||
let :params do
|
||||
{ :backup_level => "0" }
|
||||
end
|
||||
it { should contain_file(file_periodic).with_content(/^APT::Periodic::BackUpLevel "0";$/) }
|
||||
end
|
||||
|
||||
describe "with max_age => 1" do
|
||||
let :params do
|
||||
{ :max_age => "1" }
|
||||
end
|
||||
it { should contain_file(file_periodic).with_content(/^APT::Periodic::MaxAge "1";$/) }
|
||||
end
|
||||
|
||||
describe "with min_age => 1" do
|
||||
let :params do
|
||||
{ :min_age => "1" }
|
||||
end
|
||||
it { should contain_file(file_periodic).with_content(/^APT::Periodic::MinAge "1";$/) }
|
||||
end
|
||||
|
||||
describe "with max_size => 1" do
|
||||
let :params do
|
||||
{ :max_size => "1" }
|
||||
end
|
||||
it { should contain_file(file_periodic).with_content(/^APT::Periodic::MaxSize "1";$/) }
|
||||
end
|
||||
|
||||
describe "with download_delta => 2" do
|
||||
let :params do
|
||||
{ :download_delta => "2" }
|
||||
end
|
||||
it { should contain_file(file_periodic).with_content(/^APT::Periodic::Download-Upgradeable-Packages-Debdelta "2";$/) }
|
||||
end
|
||||
|
||||
describe "with verbose => 2" do
|
||||
let :params do
|
||||
{ :verbose => "2" }
|
||||
end
|
||||
it { should contain_file(file_periodic).with_content(/^APT::Periodic::Verbose "2";$/) }
|
||||
end
|
||||
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue