require 'spec_helper'
-describe 'apt', :type => :class do
+describe 'apt' do
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
context 'defaults' do
it { is_expected.to contain_file('sources.list').that_notifies('Exec[apt_update]').only_with({
- 'ensure' => 'present',
- 'path' => '/etc/apt/sources.list',
- 'owner' => 'root',
- 'group' => 'root',
- 'mode' => '0644',
- 'notify' => 'Exec[apt_update]',
+ :ensure => 'present',
+ :path => '/etc/apt/sources.list',
+ :owner => 'root',
+ :group => 'root',
+ :mode => '0644',
+ :notify => 'Exec[apt_update]',
})}
it { is_expected.to contain_file('sources.list.d').that_notifies('Exec[apt_update]').only_with({
- 'ensure' => 'directory',
- 'path' => '/etc/apt/sources.list.d',
- 'owner' => 'root',
- 'group' => 'root',
- 'purge' => false,
- 'recurse' => false,
- 'notify' => 'Exec[apt_update]',
+ :ensure => 'directory',
+ :path => '/etc/apt/sources.list.d',
+ :owner => 'root',
+ :group => 'root',
+ :purge => false,
+ :recurse => false,
+ :notify => 'Exec[apt_update]',
})}
it { is_expected.to contain_file('preferences.d').only_with({
- 'ensure' => 'directory',
- 'path' => '/etc/apt/preferences.d',
- 'owner' => 'root',
- 'group' => 'root',
- 'purge' => false,
- 'recurse' => false,
+ :ensure => 'directory',
+ :path => '/etc/apt/preferences.d',
+ :owner => 'root',
+ :group => 'root',
+ :purge => false,
+ :recurse => false,
})}
it 'should lay down /etc/apt/apt.conf.d/15update-stamp' do
is_expected.to contain_file('/etc/apt/apt.conf.d/15update-stamp').with({
- 'group' => 'root',
- 'mode' => '0644',
- 'owner' => 'root',
+ :group => 'root',
+ :mode => '0644',
+ :owner => 'root',
}).with_content(/APT::Update::Post-Invoke-Success \{"touch \/var\/lib\/apt\/periodic\/update-success-stamp 2>\/dev\/null \|\| true";\};/)
end
it { is_expected.to contain_exec('apt_update').with({
- 'refreshonly' => 'true',
+ :refreshonly => 'true',
})}
end
end
it { is_expected.to contain_file('sources.list').with({
- 'content' => "# Repos managed by puppet.\n"
+ :content => "# Repos managed by puppet.\n"
})}
it { is_expected.to contain_file('sources.list.d').with({
- 'purge' => 'true',
- 'recurse' => 'true',
+ :purge => 'true',
+ :recurse => 'true',
})}
it { is_expected.to contain_file('apt-preferences').only_with({
- 'ensure' => 'absent',
- 'path' => '/etc/apt/preferences',
+ :ensure => 'absent',
+ :path => '/etc/apt/preferences',
})}
it { is_expected.to contain_file('preferences.d').with({
- 'purge' => 'true',
- 'recurse' => 'true',
+ :purge => 'true',
+ :recurse => 'true',
})}
it { is_expected.to contain_exec('apt_update').with({
- 'refreshonly' => 'false',
- 'timeout' => '1',
- 'tries' => '3',
+ :refreshonly => 'false',
+ :timeout => '1',
+ :tries => '3',
})}
end
'key' => '55BE302B',
'key_server' => 'subkeys.pgp.net',
'pin' => '-10',
- 'include_src' => true
+ 'include_src' => true,
},
'puppetlabs' => {
'location' => 'http://apt.puppetlabs.com',
it {
is_expected.to contain_apt__setting('list-debian_unstable').with({
- 'ensure' => 'present',
+ :ensure => 'present',
})
}
it {
is_expected.to contain_apt__setting('list-puppetlabs').with({
- 'ensure' => 'present',
+ :ensure => 'present',
})
}
context 'bad purge_sources_list' do
let :params do
{
- 'purge_sources_list' => 'foo'
+ :purge_sources_list => 'foo'
}
end
it do
context 'bad purge_sources_list_d' do
let :params do
{
- 'purge_sources_list_d' => 'foo'
+ :purge_sources_list_d => 'foo'
}
end
it do
context 'bad purge_preferences' do
let :params do
{
- 'purge_preferences' => 'foo'
+ :purge_preferences => 'foo'
}
end
it do
context 'bad purge_preferences_d' do
let :params do
{
- 'purge_preferences_d' => 'foo'
+ :purge_preferences_d => 'foo'
}
end
it do
require 'spec_helper'
-describe 'apt::ppa', :type => :define do
+describe 'apt::ppa' do
describe 'defaults' do
let :pre_condition do
let(:title) { 'ppa:needs/such.substitution/wow' }
it { is_expected.to_not contain_package('python-software-properties') }
it { is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Exec[apt_update]').with({
- 'environment' => [],
- 'command' => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow',
- 'unless' => '/usr/bin/test -s /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list',
- 'user' => 'root',
- 'logoutput' => 'on_failure',
+ :environment => [],
+ :command => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow',
+ :unless => '/usr/bin/test -s /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list',
+ :user => 'root',
+ :logoutput => 'on_failure',
})
}
end
end
let :params do
{
- 'options' => '',
- 'package_manage' => true,
+ :options => '',
+ :package_manage => true,
}
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' => [],
- 'command' => '/usr/bin/add-apt-repository ppa:foo',
- 'unless' => '/usr/bin/test -s /etc/apt/sources.list.d/foo-trusty.list',
- 'user' => 'root',
- 'logoutput' => 'on_failure',
+ :environment => [],
+ :command => '/usr/bin/add-apt-repository ppa:foo',
+ :unless => '/usr/bin/test -s /etc/apt/sources.list.d/foo-trusty.list',
+ :user => 'root',
+ :logoutput => 'on_failure',
})
}
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://localhost:8080', 'https_proxy=http://localhost:8080'],
- 'command' => '/usr/bin/add-apt-repository ppa:foo',
- 'unless' => '/usr/bin/test -s /etc/apt/sources.list.d/foo-trusty.list',
- 'user' => 'root',
- 'logoutput' => 'on_failure',
+ :environment => ['http_proxy=http://localhost:8080', 'https_proxy=http://localhost:8080'],
+ :command => '/usr/bin/add-apt-repository ppa:foo',
+ :unless => '/usr/bin/test -s /etc/apt/sources.list.d/foo-trusty.list',
+ :user => 'root',
+ :logoutput => 'on_failure',
})
}
end
end
let :params do
{
- 'options' => '',
- 'package_manage' => true,
- 'proxy' => { 'host' => 'localhost', 'port' => 8180, }
+ :options => '',
+ :package_manage => true,
+ :proxy => { 'host' => 'localhost', 'port' => 8180, }
}
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://localhost:8180', 'https_proxy=http://localhost:8180'],
- 'command' => '/usr/bin/add-apt-repository ppa:foo',
- 'unless' => '/usr/bin/test -s /etc/apt/sources.list.d/foo-trusty.list',
- 'user' => 'root',
- 'logoutput' => 'on_failure',
+ :environment => ['http_proxy=http://localhost:8180', 'https_proxy=http://localhost:8180'],
+ :command => '/usr/bin/add-apt-repository ppa:foo',
+ :unless => '/usr/bin/test -s /etc/apt/sources.list.d/foo-trusty.list',
+ :user => 'root',
+ :logoutput => 'on_failure',
})
}
end
let(:title) { 'ppa:foo' }
let :params do
{
- 'ensure' => 'absent'
+ :ensure => 'absent'
}
end
it { is_expected.to contain_file('/etc/apt/sources.list.d/foo-trusty.list').that_notifies('Exec[apt_update]').with({
- 'ensure' => 'absent',
+ :ensure => 'absent',
})
}
end