summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRaoul Bhatia <raoul@bhatia.at>2015-09-09 22:31:53 +0200
committerRaoul Bhatia <raoul@bhatia.at>2015-09-09 23:06:05 +0200
commit84a7d6cdea460cb3da3c95adc8d8b9f2d421eeff (patch)
treef82eda6a929fc9ce2f19bc68891838bad3bfea63 /spec
parentd9a1edcad619b5a87c6f2e9857c8200e540e2410 (diff)
Enhance and bugfix tests for Debian & Ubuntu LTS
Diffstat (limited to 'spec')
-rw-r--r--spec/classes/unattended_upgrades_spec.rb94
1 files changed, 88 insertions, 6 deletions
diff --git a/spec/classes/unattended_upgrades_spec.rb b/spec/classes/unattended_upgrades_spec.rb
index 1333434..d47ad06 100644
--- a/spec/classes/unattended_upgrades_spec.rb
+++ b/spec/classes/unattended_upgrades_spec.rb
@@ -6,7 +6,7 @@ describe 'unattended_upgrades' do
let(:facts) { {
:osfamily => 'Debian',
:lsbdistid => 'Debian',
- :lsbistcodename => 'wheezy',
+ :lsbdistcodename => 'wheezy',
:lsbrelease => '7.0.3',
} }
let(:pre_condition) {
@@ -92,11 +92,94 @@ describe 'unattended_upgrades' do
}
end
- context 'with defaults on ubuntu' do
+ context 'with defaults on Debian 6 Squeeze' do
+ let(:facts) { {
+ :osfamily => 'Debian',
+ :lsbdistid => 'Debian',
+ :lsbdistcodename => 'squeeze',
+ :lsbdistrelease => '6.0.10',
+ } }
+ it {
+ should create_file(file_unattended).with({
+ 'owner' => 'root',
+ 'group' => 'root',
+ 'mode' => '0644',
+ }).with_content(
+ # This section varies for different releases
+ /\Unattended-Upgrade::Allowed-Origins\ {\n
+ \t"\${distro_id}\ oldoldstable";\n
+ \t"\${distro_id}\ \${distro_codename}-security";\n
+ \t"\${distro_id}\ \${distro_codename}-lts";\n
+ };/x
+ )}
+ end
+
+ context 'with defaults on Debian 7 Wheezy' do
+ let(:facts) { {
+ :osfamily => 'Debian',
+ :lsbdistid => 'Debian',
+ :lsbdistcodename => 'wheezy',
+ :lsbdistrelease => '7.1',
+ } }
+ it {
+ should create_file(file_unattended).with({
+ 'owner' => 'root',
+ 'group' => 'root',
+ 'mode' => '0644',
+ }).with_content(
+ # This section varies for different releases
+ /\Unattended-Upgrade::Origins-Pattern\ {\n
+ \t"origin=Debian,archive=stable,label=Debian-Security";\n
+ \t"origin=Debian,archive=oldstable,label=Debian-Security";\n
+ };/x
+ )}
+ end
+
+ context 'with defaults on Debian 8 Jessie' do
+ let(:facts) { {
+ :osfamily => 'Debian',
+ :lsbdistid => 'Debian',
+ :lsbdistcodename => 'jessie',
+ :lsbdistrelease => '8.2',
+ } }
+ it {
+ should create_file(file_unattended).with({
+ 'owner' => 'root',
+ 'group' => 'root',
+ 'mode' => '0644',
+ }).with_content(
+ # This section varies for different releases
+ /\Unattended-Upgrade::Origins-Pattern\ {\n
+ \t"origin=Debian,codename=\${distro_codename},label=Debian-Security";\n
+ };/x
+ )}
+ end
+
+ context 'with defaults on Ubuntu 12.04LTS Precise Pangolin' do
let(:facts) { {
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
- :lsbistcodename => 'trusty',
+ :lsbdistcodename => 'precise',
+ :lsbrelease => '12.04',
+ } }
+ it {
+ should create_file(file_unattended).with({
+ 'owner' => 'root',
+ 'group' => 'root',
+ 'mode' => '0644',
+ }).with_content(
+ # This is the only section that's different for Ubuntu compared to Debian
+ /\Unattended-Upgrade::Allowed-Origins\ {\n
+ \t"\${distro_id}\:\${distro_codename}-security";\n
+ };/x
+ )}
+ end
+
+ context 'with defaults on Ubuntu 14.04LTS Trusty Tahr' do
+ let(:facts) { {
+ :osfamily => 'Debian',
+ :lsbdistid => 'Ubuntu',
+ :lsbdistcodename => 'trusty',
:lsbrelease => '14.04',
} }
it {
@@ -107,8 +190,7 @@ describe 'unattended_upgrades' do
}).with_content(
# This is the only section that's different for Ubuntu compared to Debian
/\Unattended-Upgrade::Allowed-Origins\ {\n
- \t"\${distro_id}\ \${distro_codename}-security";\n
- \t"\${distro_id}\ \${distro_codename}-updates";\n
+ \t"\${distro_id}\:\${distro_codename}-security";\n
};/x
)}
end
@@ -117,7 +199,7 @@ describe 'unattended_upgrades' do
let(:facts) { {
:osfamily => 'Debian',
:lsbdistid => 'Raspbian',
- :lsbistcodename => 'jessie',
+ :lsbdistcodename => 'jessie',
:lsbrelease => '8.0',
} }
it {