Merge branch 'main' into xepa-patch-1
[puppet-modules/puppetlabs-apt.git] / spec / classes / apt_spec.rb
index 03b638ca7fbd1406ae1888578d8c2317d58e3738..1a7513c44a1113f2101e7be2061e98eefbae96d9 100644 (file)
@@ -45,11 +45,11 @@ describe 'apt' do
         family: 'Debian',
         name: 'Debian',
         release: {
-          major: '8',
-          full: '8.0',
+          major: '9',
+          full: '9.0',
         },
         distro: {
-          codename: 'jessie',
+          codename: 'stretch',
           id: 'Debian',
         },
       },
@@ -342,34 +342,6 @@ describe 'apt' do
 
   context 'with entries for /etc/apt/auth.conf' do
     facts_hash = {
-      'Ubuntu 14.04' => {
-        os: {
-          family: 'Debian',
-          name: 'Ubuntu',
-          release: {
-            major: '14',
-            full: '14.04',
-          },
-          distro: {
-            codename: 'trusty',
-            id: 'Ubuntu',
-          },
-        },
-      },
-      'Ubuntu 16.04' => {
-        os: {
-          family: 'Debian',
-          name: 'Ubuntu',
-          release: {
-            major: '16',
-            full: '16.04',
-          },
-          distro: {
-            codename: 'xenial',
-            id: 'Ubuntu',
-          },
-        },
-      },
       'Ubuntu 18.04' => {
         os: {
           family: 'Debian',
@@ -384,34 +356,6 @@ describe 'apt' do
           },
         },
       },
-      'Debian 7.0' => {
-        os: {
-          family: 'Debian',
-          name: 'Debian',
-          release: {
-            major: '7',
-            full: '7.0',
-          },
-          distro: {
-            codename: 'wheezy',
-            id: 'Debian',
-          },
-        },
-      },
-      'Debian 8.0' => {
-        os: {
-          family: 'Debian',
-          name: 'Debian',
-          release: {
-            major: '8',
-            full: '8.0',
-          },
-          distro: {
-            codename: 'jessie',
-            id: 'Debian',
-          },
-        },
-      },
       'Debian 9.0' => {
         os: {
           family: 'Debian',
@@ -469,16 +413,6 @@ describe 'apt' do
             super().merge(manage_auth_conf: true)
           end
 
-          # Going forward starting with Ubuntu 16.04 and Debian 9.0
-          # /etc/apt/auth.conf is owned by _apt. In previous versions it is
-          # root.
-          auth_conf_owner = case os
-                            when 'Ubuntu 14.04', 'Debian 7.0', 'Debian 8.0'
-                              'root'
-                            else
-                              '_apt'
-                            end
-
           auth_conf_content = "// This file is managed by Puppet. DO NOT EDIT.
 machine deb.example.net login foologin password secret
 machine apt.example.com login aptlogin password supersecret
@@ -486,7 +420,7 @@ machine apt.example.com login aptlogin password supersecret
 
           it {
             is_expected.to contain_file('/etc/apt/auth.conf').with(ensure: 'present',
-                                                                   owner: auth_conf_owner,
+                                                                   owner: '_apt',
                                                                    group: 'root',
                                                                    mode: '0600',
                                                                    notify: 'Class[Apt::Update]',
@@ -535,11 +469,11 @@ machine apt.example.com login aptlogin password supersecret
           family: 'Debian',
           name: 'Ubuntu',
           release: {
-            major: '16',
-            full: '16.04',
+            major: '18',
+            full: '18.04',
           },
           distro: {
-            codename: 'xenial',
+            codename: 'bionic',
             id: 'Ubuntu',
           },
         },
@@ -574,7 +508,7 @@ machine apt.example.com login aptlogin password supersecret
       is_expected.to contain_apt__setting('list-puppetlabs').with(ensure: 'present')
     }
 
-    it { is_expected.to contain_file('/etc/apt/sources.list.d/puppetlabs.list').with_content(%r{^deb http://apt.puppetlabs.com xenial main$}) }
+    it { is_expected.to contain_file('/etc/apt/sources.list.d/puppetlabs.list').with_content(%r{^deb http://apt.puppetlabs.com bionic main$}) }
   end
 
   context 'with confs defined on valid os.family' do
@@ -584,11 +518,11 @@ machine apt.example.com login aptlogin password supersecret
           family: 'Debian',
           name: 'Ubuntu',
           release: {
-            major: '16',
-            full: '16.04',
+            major: '18',
+            full: '18.04',
           },
           distro: {
-            codename: 'xenial',
+            codename: 'bionic',
             id: 'Ubuntu',
           },
         },
@@ -621,11 +555,11 @@ machine apt.example.com login aptlogin password supersecret
           family: 'Debian',
           name: 'Ubuntu',
           release: {
-            major: '16',
-            full: '16.04',
+            major: '18',
+            full: '18.04',
           },
           distro: {
-            codename: 'xenial',
+            codename: 'bionic',
             id: 'Ubuntu',
           },
         },
@@ -658,11 +592,11 @@ machine apt.example.com login aptlogin password supersecret
           family: 'Debian',
           name: 'Ubuntu',
           release: {
-            major: '16',
-            full: '16.04',
+            major: '18',
+            full: '18.04',
           },
           distro: {
-            codename: 'xenial',
+            codename: 'bionic',
             id: 'Ubuntu',
           },
         },
@@ -686,11 +620,11 @@ machine apt.example.com login aptlogin password supersecret
           family: 'Debian',
           name: 'Ubuntu',
           release: {
-            major: '16',
-            full: '16.04',
+            major: '18',
+            full: '18.04',
           },
           distro: {
-            codename: 'xenial',
+            codename: 'bionic',
             id: 'Ubuntu',
           },
         },
@@ -714,11 +648,11 @@ machine apt.example.com login aptlogin password supersecret
           family: 'Debian',
           name: 'Ubuntu',
           release: {
-            major: '16',
-            full: '16.04',
+            major: '18',
+            full: '18.04',
           },
           distro: {
-            codename: 'xenial',
+            codename: 'bionic',
             id: 'Ubuntu',
           },
         },