]> review.fuel-infra Code Review - puppet-modules/puppetlabs-apt.git/commitdiff
(#12529) Add unit test for apt proxy settings
authorDan Bode <dan@puppetlabs.com>
Mon, 13 Feb 2012 17:58:30 +0000 (09:58 -0800)
committerDan Bode <dan@puppetlabs.com>
Mon, 13 Feb 2012 17:58:30 +0000 (09:58 -0800)
This commit adds unit tests to validate that the
apt proxy is configured as expected when the class
parameter proxy_host is set as a class parameter for
the apt class.

spec/classes/apt_spec.rb

index 5ac64f2b2eaa9e0cf3d4371dd09bb07dbd8d56b0..1c7c18f4c2b6bdc1e1ee8faf858126212da903a1 100644 (file)
@@ -10,7 +10,9 @@ describe 'apt', :type => :class do
   [{},
    {
       :disable_keys => true,
-      :always_apt_update => true
+      :always_apt_update => true,
+      :proxy_host => true,
+      :proxy_port => '3128'
     }
   ].each do |param_set|
     describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do
@@ -74,6 +76,18 @@ describe 'apt', :type => :class do
           })
         end
       }
+      describe 'when setting a proxy' do
+        it {
+          if param_hash[:proxy_host]
+            should contain_file('configure-apt-proxy').with(
+              'path'    => '/etc/apt/apt.conf.d/proxy',
+              'content' => "Acquire::http::Proxy \"http://#{param_hash[:proxy_host]}:#{param_hash[:proxy_port]}\";"
+            )
+          else
+            should_not contain_file('configure_apt_proxy')
+          end
+        }
+      end
     end
   end
 end