X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Fdefines%2Fppa_spec.rb;h=74b52ea9c94fba1a82f69bd14de522786e2e8102;hb=5e0128cc86bf89c870607c3abbeee8eeb48dc2c5;hp=63c297b82ccc90c52b7ced78fa0d6d2af9f97a66;hpb=f2c3956fd12ff980615cdc07b9ff884b31af2f58;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/spec/defines/ppa_spec.rb b/spec/defines/ppa_spec.rb index 63c297b..74b52ea 100644 --- a/spec/defines/ppa_spec.rb +++ b/spec/defines/ppa_spec.rb @@ -12,16 +12,39 @@ describe 'apt::ppa' do :operatingsystem => 'Ubuntu', :osfamily => 'Debian', :lsbdistid => 'Ubuntu', - :puppetversion => '3.5.0', + :puppetversion => Puppet.version, } end - let(:title) { 'ppa:needs/such.substitution/wow' } + let(:title) { 'ppa:needs/such.substitution/wow+type' } 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({ + 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', - :unless => '/usr/bin/test -s /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list', + :command => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow+type', + :unless => '/usr/bin/test -s /etc/apt/sources.list.d/needs-such_substitution-wow_type-natty.list', + :user => 'root', + :logoutput => 'on_failure', + }) + } + end + + describe 'Ubuntu 15.10 sources.list filename' do + let :facts do + { + :lsbdistrelease => '15.10', + :lsbdistcodename => 'wily', + :operatingsystem => 'Ubuntu', + :osfamily => 'Debian', + :lsbdistid => 'Ubuntu', + :puppetversion => Puppet.version, + } + end + + let(:title) { 'ppa:user/foo' } + it { is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with({ + :environment => [], + :command => '/usr/bin/add-apt-repository -y ppa:user/foo', + :unless => '/usr/bin/test -s /etc/apt/sources.list.d/user-ubuntu-foo-wily.list', :user => 'root', :logoutput => 'on_failure', }) @@ -51,13 +74,13 @@ describe 'apt::ppa' do :operatingsystem => 'Ubuntu', :osfamily => 'Debian', :lsbdistid => 'Ubuntu', - :puppetversion => '3.5.0', + :puppetversion => Puppet.version, } end let(:title) { 'ppa:needs/such.substitution/wow' } it { is_expected.to contain_package('software-properties-common') } - it { is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Exec[apt_update]').with({ + 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', 'unless' => '/usr/bin/test -s /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list', @@ -72,6 +95,46 @@ describe 'apt::ppa' do } 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 + { + :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 -s /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', + }) + } + end + describe 'package_manage => false' do let :pre_condition do 'class { "apt": }' @@ -83,7 +146,7 @@ describe 'apt::ppa' do :operatingsystem => 'Ubuntu', :osfamily => 'Debian', :lsbdistid => 'Ubuntu', - :puppetversion => '3.5.0', + :puppetversion => Puppet.version, } end let :params do @@ -94,7 +157,7 @@ describe 'apt::ppa' 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({ + 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', 'unless' => '/usr/bin/test -s /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list', @@ -112,7 +175,7 @@ describe 'apt::ppa' do describe 'apt included, no proxy' do let :pre_condition do 'class { "apt": } - apt::ppa { "ppa:foo2": } + apt::ppa { "ppa:user/foo2": } ' end let :facts do @@ -122,23 +185,23 @@ describe 'apt::ppa' do :operatingsystem => 'Ubuntu', :lsbdistid => 'Ubuntu', :osfamily => 'Debian', - :puppetversion => '3.5.0', + :puppetversion => Puppet.version, } end let :params do { :options => '', :package_manage => true, - :require => 'Apt::Ppa[ppa:foo2]', + :require => 'Apt::Ppa[ppa:user/foo2]', } end - let(:title) { 'ppa:foo' } + let(:title) { 'ppa:user/foo' } it { is_expected.to compile.with_all_deps } 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({ + it { is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[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', + :command => '/usr/bin/add-apt-repository ppa:user/foo', + :unless => '/usr/bin/test -s /etc/apt/sources.list.d/user-foo-trusty.list', :user => 'root', :logoutput => 'on_failure', }) @@ -158,7 +221,7 @@ describe 'apt::ppa' do :operatingsystem => 'Ubuntu', :lsbdistid => 'Ubuntu', :osfamily => 'Debian', - :puppetversion => '3.5.0', + :puppetversion => Puppet.version, } end let :params do @@ -167,12 +230,12 @@ describe 'apt::ppa' do 'package_manage' => true, } end - let(:title) { 'ppa:foo' } + let(:title) { 'ppa:user/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({ + it { is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with({ :environment => ['http_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', + :command => '/usr/bin/add-apt-repository ppa:user/foo', + :unless => '/usr/bin/test -s /etc/apt/sources.list.d/user-foo-trusty.list', :user => 'root', :logoutput => 'on_failure', }) @@ -192,7 +255,7 @@ describe 'apt::ppa' do :operatingsystem => 'Ubuntu', :lsbdistid => 'Ubuntu', :osfamily => 'Debian', - :puppetversion => '3.5.0', + :puppetversion => Puppet.version, } end let :params do @@ -201,12 +264,12 @@ describe 'apt::ppa' do :package_manage => true, } end - let(:title) { 'ppa:foo' } + let(:title) { 'ppa:user/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({ + it { is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with({ :environment => ['http_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', + :command => '/usr/bin/add-apt-repository ppa:user/foo', + :unless => '/usr/bin/test -s /etc/apt/sources.list.d/user-foo-trusty.list', :user => 'root', :logoutput => 'on_failure', }) @@ -226,7 +289,7 @@ describe 'apt::ppa' do :operatingsystem => 'Ubuntu', :lsbdistid => 'Ubuntu', :osfamily => 'Debian', - :puppetversion => '3.5.0', + :puppetversion => Puppet.version, } end let :params do @@ -235,12 +298,12 @@ describe 'apt::ppa' do :package_manage => true, } end - let(:title) { 'ppa:foo' } + let(:title) { 'ppa:user/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({ + it { is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with({ :environment => ['http_proxy=http://localhost:8180', 'https_proxy=https://localhost:8180'], - :command => '/usr/bin/add-apt-repository ppa:foo', - :unless => '/usr/bin/test -s /etc/apt/sources.list.d/foo-trusty.list', + :command => '/usr/bin/add-apt-repository ppa:user/foo', + :unless => '/usr/bin/test -s /etc/apt/sources.list.d/user-foo-trusty.list', :user => 'root', :logoutput => 'on_failure', }) @@ -258,16 +321,16 @@ describe 'apt::ppa' do :operatingsystem => 'Ubuntu', :lsbdistid => 'Ubuntu', :osfamily => 'Debian', - :puppetversion => '3.5.0', + :puppetversion => Puppet.version, } end - let(:title) { 'ppa:foo' } + let(:title) { 'ppa:user/foo' } let :params do { :ensure => 'absent' } end - it { is_expected.to contain_file('/etc/apt/sources.list.d/foo-trusty.list').that_notifies('Exec[apt_update]').with({ + it { is_expected.to contain_file('/etc/apt/sources.list.d/user-foo-trusty.list').that_notifies('Class[Apt::Update]').with({ :ensure => 'absent', }) } @@ -282,10 +345,10 @@ describe 'apt::ppa' do :lsbdistid => 'Ubuntu', :osfamily => 'Debian', :lsbdistcodeanme => nil, - :puppetversion => '3.5.0', + :puppetversion => Puppet.version, } end - let(:title) { 'ppa:foo' } + let(:title) { 'ppa:user/foo' } it do expect { subject.call @@ -301,10 +364,10 @@ describe 'apt::ppa' do :operatingsystem => 'Debian', :lsbdistid => 'debian', :osfamily => 'Debian', - :puppetversion => '3.5.0', + :puppetversion => Puppet.version, } end - let(:title) { 'ppa:foo' } + let(:title) { 'ppa:user/foo' } it do expect { subject.call