Sfoglia il codice sorgente

Unbreak broken tests

Morgan Haskel 9 anni fa
parent
commit
61080fb676

+ 0 - 4
manifests/init.pp

@@ -11,10 +11,6 @@ class apt(
   $sources              = undef,
 ) inherits ::apt::params {
 
-  if $::osfamily != 'Debian' {
-    fail('This module only works on Debian or derivatives like Ubuntu')
-  }
-
   include apt::update
 
   $frequency_options = ['always','daily','weekly','reluctantly']

+ 4 - 0
manifests/params.pp

@@ -5,6 +5,10 @@ class apt::params {
   $apt_conf_d     = "${root}/apt.conf.d"
   $preferences_d  = "${root}/preferences.d"
 
+  if $::osfamily != 'Debian' {
+    fail('This module only works on Debian or derivatives like Ubuntu')
+  }
+
   case $::lsbdistid {
     'ubuntu', 'debian': {
       $distid = $::lsbdistid

+ 0 - 58
spec/classes/apt_spec.rb

@@ -31,12 +31,6 @@ describe 'apt', :type => :class do
       'recurse' => false,
     })}
 
-    it { should contain_file('01proxy').that_notifies('Exec[apt_update]').only_with({
-      'ensure' => 'absent',
-      'path'   => '/etc/apt/apt.conf.d/01proxy',
-      'notify' => 'Exec[apt_update]',
-    })}
-
     it 'should lay down /etc/apt/apt.conf.d/15update-stamp' do
       should contain_file('/etc/apt/apt.conf.d/15update-stamp').with({
         'group' => 'root',
@@ -45,12 +39,6 @@ describe 'apt', :type => :class do
       }).with_content(/APT::Update::Post-Invoke-Success \{"touch \/var\/lib\/apt\/periodic\/update-success-stamp 2>\/dev\/null \|\| true";\};/)
     end
 
-    it { should contain_file('old-proxy-file').that_notifies('Exec[apt_update]').only_with({
-      'ensure' => 'absent',
-      'path'   => '/etc/apt/apt.conf.d/proxy',
-      'notify' => 'Exec[apt_update]',
-    })}
-
     it { should contain_exec('apt_update').with({
       'refreshonly' => 'true',
     })}
@@ -60,16 +48,12 @@ describe 'apt', :type => :class do
     let :params do
       {
         :always_apt_update    => true,
-        :disable_keys         => true,
-        :proxy_host           => 'foo',
-        :proxy_port           => '9876',
         :purge_sources_list   => true,
         :purge_sources_list_d => true,
         :purge_preferences    => true,
         :purge_preferences_d  => true,
         :update_timeout       => '1',
         :update_tries         => '3',
-        :fancy_progress       => true,
       }
     end
 
@@ -92,28 +76,6 @@ describe 'apt', :type => :class do
       'recurse' => 'true',
     })}
 
-    it { should contain_file('99progressbar').only_with({
-      'ensure'  => 'present',
-      'content' => /Dpkg::Progress-Fancy "1";/,
-      'path'    => '/etc/apt/apt.conf.d/99progressbar',
-    })}
-
-    it { should contain_file('99unauth').only_with({
-      'ensure'  => 'present',
-      'content' => /APT::Get::AllowUnauthenticated 1;/,
-      'path'    => '/etc/apt/apt.conf.d/99unauth',
-    })}
-
-    it { should contain_file('01proxy').that_notifies('Exec[apt_update]').only_with({
-      'ensure'  => 'present',
-      'path'    => '/etc/apt/apt.conf.d/01proxy',
-      'content' => /Acquire::http::Proxy "http:\/\/foo:9876";/,
-      'notify'  => 'Exec[apt_update]',
-      'mode'    => '0644',
-      'owner'   => 'root',
-      'group'   => 'root'
-    })}
-
     it { should contain_exec('apt_update').with({
       'refreshonly' => 'false',
       'timeout'     => '1',
@@ -122,26 +84,6 @@ describe 'apt', :type => :class do
 
   end
 
-  context 'more non-default' do
-    let :params do
-      {
-        :fancy_progress => false,
-        :disable_keys   => false,
-      }
-    end
-
-    it { should contain_file('99progressbar').only_with({
-      'ensure'  => 'absent',
-      'path'    => '/etc/apt/apt.conf.d/99progressbar',
-    })}
-
-    it { should contain_file('99unauth').only_with({
-      'ensure'  => 'absent',
-      'path'    => '/etc/apt/apt.conf.d/99unauth',
-    })}
-
-  end
-
   context 'with sources defined on valid osfamily' do
     let :facts do
       { :osfamily        => 'Debian',

+ 2 - 2
spec/classes/params_spec.rb

@@ -14,7 +14,7 @@ describe 'apt::params', :type => :class do
 
   describe "With unknown lsbdistid" do
 
-    let(:facts) { { :lsbdistid => 'CentOS' } }
+    let(:facts) { { :lsbdistid => 'CentOS', :osfamily => 'Debian' } }
     let (:title) { 'my_package' }
 
     it do
@@ -26,7 +26,7 @@ describe 'apt::params', :type => :class do
   end
 
   describe "With lsb-release not installed" do
-    let(:facts) { { :lsbdistid => '' } }
+    let(:facts) { { :lsbdistid => '', :osfamily => 'Debian' } }
     let (:title) { 'my_package' }
 
     it do

+ 1 - 1
spec/classes/release_spec.rb

@@ -1,6 +1,6 @@
 require 'spec_helper'
 describe 'apt::release', :type => :class do
-  let(:facts) { { :lsbdistid => 'Debian' } }
+  let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
   let (:title) { 'my_package' }
 
   let :param_set do

+ 5 - 1
spec/classes/unattended_upgrades_spec.rb

@@ -2,7 +2,7 @@ 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' } }
+  let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
 
   it { should contain_package("unattended-upgrades") }
 
@@ -29,6 +29,7 @@ describe 'apt::unattended_upgrades', :type => :class do
       {
         'lsbdistid'       => 'debian',
         'lsbdistcodename' => 'squeeze',
+        'osfamily'        => 'Debian',
       }
     end
     context 'bad auto_fix' do
@@ -109,6 +110,7 @@ describe 'apt::unattended_upgrades', :type => :class do
       {
         'lsbdistid'       => 'debian',
         'lsbdistcodename' => 'squeeze',
+        'osfamily'        => 'Debian',
       }
     end
 
@@ -139,6 +141,7 @@ describe 'apt::unattended_upgrades', :type => :class do
       {
         'lsbdistid'       => 'debian',
         'lsbdistcodename' => 'wheezy',
+        'osfamily'        => 'Debian',
       }
     end
 
@@ -150,6 +153,7 @@ describe 'apt::unattended_upgrades', :type => :class do
       {
         'lsbdistid'       => 'debian',
         'lsbdistcodename' => 'wheezy',
+        'osfamily'        => 'Debian',
       }
     end
 

+ 1 - 1
spec/defines/conf_spec.rb

@@ -1,6 +1,6 @@
 require 'spec_helper'
 describe 'apt::conf', :type => :define do
-  let(:facts) { { :lsbdistid => 'Debian' } }
+  let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
   let :title do
     'norecommends'
   end

+ 1 - 1
spec/defines/force_spec.rb

@@ -1,6 +1,6 @@
 require 'spec_helper'
 describe 'apt::force', :type => :define do
-  let(:facts) { { :lsbdistid => 'Debian' } }
+  let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
   let :pre_condition do
     'include apt::params'
   end

+ 1 - 1
spec/defines/key_spec.rb

@@ -1,7 +1,7 @@
 require 'spec_helper'
 
 describe 'apt::key', :type => :define do
-  let(:facts) { { :lsbdistid => 'Debian' } }
+  let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
   GPG_KEY_ID = '47B320EB4C7C375AA9DAE1A01054B7A24BD6EC30'
 
   let :title do

+ 1 - 1
spec/defines/pin_spec.rb

@@ -1,6 +1,6 @@
 require 'spec_helper'
 describe 'apt::pin', :type => :define do
-  let(:facts) { { :lsbdistid => 'Debian' } }
+  let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
   let(:title) { 'my_pin' }
 
   context 'defaults' do

+ 0 - 35
spec/defines/ppa_spec.rb

@@ -67,41 +67,6 @@ describe 'apt::ppa', :type => :define do
     }
   end
 
-  describe 'apt included, proxy' do
-    let :pre_condition do
-      'class { "apt": proxy_host => "example.com" }'
-    end
-    let :facts do
-      {
-        :lsbdistrelease  => '14.04',
-        :lsbdistcodename => 'trusty',
-        :operatingsystem => 'Ubuntu',
-        :lsbdistid       => 'Ubuntu',
-        :osfamily        => 'Debian',
-      }
-    end
-    let :params do
-      {
-        'release' => 'lucid',
-      }
-    end
-    let(:title) { 'ppa:foo' }
-    it { is_expected.to contain_package('software-properties-common') }
-    it { is_expected.to contain_exec('add-apt-repository-ppa:foo').that_notifies('Exec[apt_update]').with({
-      'environment' => ['http_proxy=http://example.com:8080', 'https_proxy=http://example.com:8080'],
-      'command'     => '/usr/bin/add-apt-repository -y ppa:foo',
-      'unless'      => '/usr/bin/test -s /etc/apt/sources.list.d/foo-lucid.list',
-      'user'        => 'root',
-      'logoutput'   => 'on_failure',
-    })
-    }
-
-    it { is_expected.to contain_file('/etc/apt/sources.list.d/foo-lucid.list').that_requires('Exec[add-apt-repository-ppa:foo]').with({
-      'ensure' => 'file',
-    })
-    }
-  end
-
   describe 'ensure absent' do
     let :facts do
       {