(#12529) Add unit test for apt proxy settings
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.
This commit is contained in:
parent
3abad192fa
commit
997c9fdc40
1 changed files with 15 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue