X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Fclasses%2Fapt_spec.rb;h=84c65745bd19d81f78154cde5ba5dbf33d2cd4f9;hb=0e75ab7ce4b9ebeca33348b19c2957d5870af690;hp=ca11d4a990ca0cba0c3080d32a0a2a4ab1820c5c;hpb=e69426feee0d2a4069933813ea2a02544a3fe9e2;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/spec/classes/apt_spec.rb b/spec/classes/apt_spec.rb index ca11d4a..84c6574 100644 --- a/spec/classes/apt_spec.rb +++ b/spec/classes/apt_spec.rb @@ -200,6 +200,74 @@ describe 'apt' do } end + context 'with lots of non-defaults' do + let :params do + { + update: { 'frequency' => 'always', 'timeout' => 1, 'tries' => 3 }, + purge: { 'sources.list' => true, 'sources.list.d' => true, + 'preferences' => true, 'preferences.d' => true, + 'apt.conf.d' => true }, + } + end + + it { + is_expected.to contain_file('sources.list').with(content: "# Repos managed by puppet.\n") + } + + it { + is_expected.to contain_file('sources.list.d').with(purge: true, + recurse: true) + } + + it { + is_expected.to contain_file('preferences').with(ensure: 'absent') + } + + it { + is_expected.to contain_file('preferences.d').with(purge: true, + recurse: true) + } + + it { + is_expected.to contain_file('apt.conf.d').with(purge: true, + recurse: true) + } + + it { + is_expected.to contain_exec('apt_update').with(refreshonly: false, + timeout: 1, + tries: 3) + } + end + + context 'with defaults for sources_list_force' do + let :params do + { + update: { 'frequency' => 'always', 'timeout' => 1, 'tries' => 3 }, + purge: { 'sources.list' => true }, + sources_list_force: false, + } + end + + it { + is_expected.to contain_file('sources.list').with(content: "# Repos managed by puppet.\n") + } + end + + context 'with non defaults for sources_list_force' do + let :params do + { + update: { 'frequency' => 'always', 'timeout' => 1, 'tries' => 3 }, + purge: { 'sources.list' => true }, + sources_list_force: true, + } + end + + it { + is_expected.to contain_file('sources.list').with(ensure: 'absent') + } + end + context 'with entries for /etc/apt/auth.conf' do facts_hash = { 'Ubuntu 14.04' => {