X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Fdefines%2Fppa_spec.rb;h=497822109d4115aaf0655a3cc09cbc1571a1122a;hb=630580d1ce3c609865e31598198e7c55dda9a6ef;hp=89e5b36c57f4373590e27eae895bc93636e652bb;hpb=dc3ead0ed5f4d735869565660c982983d379a519;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/spec/defines/ppa_spec.rb b/spec/defines/ppa_spec.rb index 89e5b36..4978221 100644 --- a/spec/defines/ppa_spec.rb +++ b/spec/defines/ppa_spec.rb @@ -7,9 +7,9 @@ describe 'apt::ppa' do describe 'defaults' do let :facts do { - os: { family: 'Debian', name: 'Ubuntu', release: { major: '11', full: '11.04' } }, - lsbdistrelease: '11.04', - lsbdistcodename: 'natty', + os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '41.04' } }, + lsbdistrelease: '14.04', + lsbdistcodename: 'trusty', operatingsystem: 'Ubuntu', osfamily: 'Debian', lsbdistid: 'Ubuntu', @@ -23,7 +23,7 @@ describe 'apt::ppa' do it { is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow+type').that_notifies('Class[Apt::Update]').with(environment: [], command: '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow+type', # rubocop:disable Metrics/LineLength - unless: '/usr/bin/test -f /etc/apt/sources.list.d/needs-such_substitution-wow_type-natty.list', # rubocop:disable Metrics/LineLength + unless: '/usr/bin/test -f /etc/apt/sources.list.d/needs-such_substitution-wow_type-trusty.list', # rubocop:disable Metrics/LineLength user: 'root', logoutput: 'on_failure') } @@ -53,12 +53,6 @@ describe 'apt::ppa' do } end - describe 'ppa depending on ppa, MODULES-1156' do - let :pre_condition do - 'class { "apt": }' - end - end - describe 'package_name => software-properties-common' do let :pre_condition do 'class { "apt": }' @@ -71,9 +65,9 @@ describe 'apt::ppa' do end let :facts do { - os: { family: 'Debian', name: 'Ubuntu', release: { major: '11', full: '11.04' } }, - lsbdistrelease: '11.04', - lsbdistcodename: 'natty', + os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } }, + lsbdistrelease: '14.04', + lsbdistcodename: 'trusty', operatingsystem: 'Ubuntu', osfamily: 'Debian', lsbdistid: 'Ubuntu', @@ -87,53 +81,13 @@ describe 'apt::ppa' do it { is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Class[Apt::Update]').with('environment' => [], 'command' => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow', # rubocop:disable Metrics/LineLength - 'unless' => '/usr/bin/test -f /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list', # rubocop:disable Metrics/LineLength + 'unless' => '/usr/bin/test -f /etc/apt/sources.list.d/needs-such_substitution-wow-trusty.list', # rubocop:disable Metrics/LineLength 'user' => 'root', 'logoutput' => 'on_failure') } it { - is_expected.to contain_file('/etc/apt/sources.list.d/needs-such_substitution-wow-natty.list').that_requires('Exec[add-apt-repository-ppa:needs/such.substitution/wow]').with('ensure' => 'file') - } - end - - describe 'package_manage => true, multiple ppas, MODULES-2873' do - let :pre_condition do - 'class { "apt": } - apt::ppa {"ppa:user/foo": - package_manage => true - }' - end - let :facts do - { - os: { family: 'Debian', name: 'Ubuntu', release: { major: '11', full: '11.04' } }, - lsbdistrelease: '11.04', - lsbdistcodename: 'natty', - operatingsystem: 'Ubuntu', - osfamily: 'Debian', - lsbdistid: 'Ubuntu', - puppetversion: Puppet.version, - } - end - let :params do - { - package_manage: true, - } - end - - let(:title) { 'ppa:user/bar' } - - it { is_expected.to contain_package('python-software-properties') } - it { - is_expected.to contain_exec('add-apt-repository-ppa:user/bar').that_notifies('Class[Apt::Update]').with('environment' => [], - 'command' => '/usr/bin/add-apt-repository -y ppa:user/bar', - 'unless' => '/usr/bin/test -f /etc/apt/sources.list.d/user-bar-natty.list', - 'user' => 'root', - 'logoutput' => 'on_failure') - } - - it { - is_expected.to contain_file('/etc/apt/sources.list.d/user-bar-natty.list').that_requires('Exec[add-apt-repository-ppa:user/bar]').with('ensure' => 'file') + is_expected.to contain_file('/etc/apt/sources.list.d/needs-such_substitution-wow-trusty.list').that_requires('Exec[add-apt-repository-ppa:needs/such.substitution/wow]').with('ensure' => 'file') } end @@ -143,9 +97,9 @@ describe 'apt::ppa' do end let :facts do { - os: { family: 'Debian', name: 'Ubuntu', release: { major: '11', full: '11.04' } }, - lsbdistrelease: '11.04', - lsbdistcodename: 'natty', + os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } }, + lsbdistrelease: '14.04', + lsbdistcodename: 'trusty', operatingsystem: 'Ubuntu', osfamily: 'Debian', lsbdistid: 'Ubuntu', @@ -164,13 +118,13 @@ describe 'apt::ppa' do it { is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Class[Apt::Update]').with('environment' => [], 'command' => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow', # rubocop:disable Metrics/LineLength - 'unless' => '/usr/bin/test -f /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list', # rubocop:disable Metrics/LineLength + 'unless' => '/usr/bin/test -f /etc/apt/sources.list.d/needs-such_substitution-wow-trusty.list', # rubocop:disable Metrics/LineLength 'user' => 'root', 'logoutput' => 'on_failure') } it { - is_expected.to contain_file('/etc/apt/sources.list.d/needs-such_substitution-wow-natty.list').that_requires('Exec[add-apt-repository-ppa:needs/such.substitution/wow]').with('ensure' => 'file') + is_expected.to contain_file('/etc/apt/sources.list.d/needs-such_substitution-wow-trusty.list').that_requires('Exec[add-apt-repository-ppa:needs/such.substitution/wow]').with('ensure' => 'file') } end @@ -343,7 +297,7 @@ describe 'apt::ppa' do } end - context 'validation' do + context 'with validation' do describe 'no release' do let :facts do { @@ -359,9 +313,7 @@ describe 'apt::ppa' do let(:title) { 'ppa:user/foo' } it do - expect { - subject.call - }.to raise_error(Puppet::Error, %r{lsbdistcodename fact not available: release parameter required}) + is_expected.to raise_error(Puppet::Error, %r{lsbdistcodename fact not available: release parameter required}) end end @@ -380,9 +332,7 @@ describe 'apt::ppa' do let(:title) { 'ppa:user/foo' } it do - expect { - subject.call - }.to raise_error(Puppet::Error, %r{not currently supported on Debian}) + is_expected.to raise_error(Puppet::Error, %r{not currently supported on Debian}) end end end