beaker-puppet 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDFjMDdlN2QwYTMxOTQ0YjM0ZTdlODFlMjMwM2EyMTU5OTE4ZmE0OQ==
4
+ ZmFlNjQ0ODQxODBjZGU3ZGMzZTEyNThkNjk5MzIxNGJiMWFhOTBiZA==
5
5
  data.tar.gz: !binary |-
6
- ODY5MzhlODg2OWYwMTNjNGY1OWE0Mjg3YTk5YmM2NjJkNjliYWVmNQ==
6
+ NGVhYWFhYzNjNGMyMjM0ZDBlNTRiZDEwNjM2NGIzNjgyNjE3NjMzZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZGYzZjQyYWU2M2IzNGYxNGIwZDI0ZGU4YWY5NjI3NDI4ZGRhNmZhNzkzZjU0
10
- YjQ0MGQ1ZTA4NTY4ZmJjMzk5MGVkNjI5M2NmMDI4MDNlNDdhMjBiNTJjOTRh
11
- ZGMxYzYxODJlYWNhZWZmZmZlOGI4ZDE2ZmI5YzY0OTJiOTBjMWM=
9
+ NDExMDZiODg5OWFiZDlhNWJiMzJjMjNhZjhlYWRiMDQxNTNhM2Q3NDUyNDRk
10
+ NTYzZjgxOTJkMWJhMWJhYzJmZDc2Y2JlNzk0NjcyNDNjNDYwMDhkNmYxNGZk
11
+ OWZjNTVkOGU4YTI2NWJjOTY3YWMwMjkxNmU2NzY5MmY1MWNkNmQ=
12
12
  data.tar.gz: !binary |-
13
- OTZjODNjNGMwMmNhY2NjMWEyZjBhNGU0ZGExMDQ2ZDdhYzkzZTdiNTA3NmI1
14
- ZDRlZjRjYjhkNWZlMDNlMjliNDBlMDNjYTcxZDRjNWI0NmNmYTlkYzk2ZWNl
15
- ZWQ5ODA2ZjEwOGI2OTdhYWQ2NWRlZWQyMmU3NjcwMWJkOTJmZDU=
13
+ NTQ3MzE2MDRhZTAzZDIxN2Y0ZjJmZDAyZDEzODZmMTM0Njk3YmNjOGI0NWYx
14
+ ZTg2NzY3ZmU0OTljYjBjMmI0YjUyMzZmNzBjNmM1NjQyOWVlMTRhYzcwNDE5
15
+ YTNlMTkxMWQ2NTkzMGEzYjk5YjI2Y2RiZjFjMzU5MGZmZjVhZDE=
data/Gemfile CHANGED
@@ -16,7 +16,7 @@ end
16
16
 
17
17
 
18
18
  group :test do
19
- gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 3.0')
19
+ gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 3.24')
20
20
  end
21
21
 
22
22
 
data/README.md CHANGED
@@ -53,3 +53,6 @@ file, or you can provide a beaker-hostgenerator value to the `TEST_TARGET`
53
53
  environment variable. You can also specify the tests that get executed with the
54
54
  `TESTS` environment variable.
55
55
 
56
+ # Contributing
57
+
58
+ Please refer to puppetlabs/beaker's [contributing](https://github.com/puppetlabs/beaker/blob/master/CONTRIBUTING.md) guide.
@@ -438,7 +438,9 @@ module Beaker
438
438
  # @api private
439
439
  def install_puppet_from_rpm_on( hosts, opts )
440
440
  block_on hosts do |host|
441
- if host[:type] == 'aio'
441
+ if opts[:puppet_collection] && opts[:puppet_collection].match(/puppet\d*/)
442
+ install_puppetlabs_release_repo(host,opts[:puppet_collection],opts)
443
+ elsif host[:type] == 'aio'
442
444
  install_puppetlabs_release_repo(host,'pc1',opts)
443
445
  else
444
446
  install_puppetlabs_release_repo(host,nil,opts)
@@ -590,14 +592,22 @@ module Beaker
590
592
  end
591
593
 
592
594
  # @api private
593
- def install_a_puppet_msi_on(hosts, opts)
594
- block_on hosts do |host|
595
+ def msi_link_path(host, opts)
596
+ if opts[:puppet_collection] && opts[:puppet_collection].match(/puppet\d*/)
597
+ link = "#{opts[:win_download_url]}/#{opts[:puppet_collection]}/#{host['dist']}.msi"
598
+ else
595
599
  link = "#{opts[:win_download_url]}/#{host['dist']}.msi"
596
- if not link_exists?( link )
597
- raise "Puppet MSI at #{link} does not exist!"
598
- end
599
-
600
+ end
601
+ if not link_exists?( link )
602
+ raise "Puppet MSI at #{link} does not exist!"
603
+ end
604
+ link
605
+ end
600
606
 
607
+ # @api private
608
+ def install_a_puppet_msi_on(hosts, opts)
609
+ block_on hosts do |host|
610
+ link = msi_link_path(host, opts)
601
611
  msi_download_path = "#{host.system_temp_path}\\#{host['dist']}.msi"
602
612
 
603
613
  if host.is_cygwin?
@@ -709,14 +719,18 @@ module Beaker
709
719
  # @api private
710
720
  def install_puppet_agent_from_dmg_on(hosts, opts)
711
721
  opts[:puppet_collection] ||= 'PC1'
712
- opts[:puppet_collection] = opts[:puppet_collection].upcase #needs to be upcase, more lovely consistency
722
+ opts[:puppet_collection] = opts[:puppet_collection].upcase if opts[:puppet_collection].match(/pc1/i)
713
723
  block_on hosts do |host|
714
724
 
715
725
  add_role(host, 'aio') #we are installing agent, so we want aio role
716
726
 
717
727
  variant, version, arch, codename = host['platform'].to_array
718
728
 
719
- download_url = "#{opts[:mac_download_url]}/#{version}/#{opts[:puppet_collection]}/#{arch}"
729
+ if opts[:puppet_collection].match(/puppet\d*/)
730
+ download_url = "#{opts[:mac_download_url]}/#{opts[:puppet_collection]}/#{version}/#{arch}"
731
+ else
732
+ download_url = "#{opts[:mac_download_url]}/#{version}/#{opts[:puppet_collection]}/#{arch}"
733
+ end
720
734
 
721
735
  latest = get_latest_puppet_agent_build_from_url(download_url)
722
736
 
@@ -913,7 +927,7 @@ module Beaker
913
927
  def install_puppetlabs_release_repo_on( hosts, repo = nil, opts = options )
914
928
  block_on hosts do |host|
915
929
  variant, version, arch, codename = host['platform'].to_array
916
- repo_name = repo.nil? ? '' : '-' + repo
930
+ repo_name = repo || opts[:puppet_collection] || ''
917
931
  opts = FOSS_DEFAULT_DOWNLOAD_URLS.merge(opts)
918
932
 
919
933
  case variant
@@ -927,8 +941,14 @@ module Beaker
927
941
  variant_url_value = 'cisco-wrlinux'
928
942
  version = '7'
929
943
  end
930
- remote = "%s/puppetlabs-release%s-%s-%s.noarch.rpm" %
931
- [opts[:release_yum_repo_url], repo_name, variant_url_value, version]
944
+ if repo_name.match(/puppet\d*/)
945
+ remote = "%s/%s/%s-release-%s-%s.noarch.rpm" %
946
+ [opts[:release_yum_repo_url], repo_name, repo_name, variant_url_value, version]
947
+ else
948
+ repo_name = '-' + repo_name unless repo_name.empty?
949
+ remote = "%s/puppetlabs-release%s-%s-%s.noarch.rpm" %
950
+ [opts[:release_yum_repo_url], repo_name, variant_url_value, version]
951
+ end
932
952
 
933
953
  if variant == 'cisco_nexus'
934
954
  # cisco nexus requires using yum to install the repo
@@ -943,7 +963,12 @@ module Beaker
943
963
  end
944
964
 
945
965
  when /^(debian|ubuntu|cumulus|huaweios)$/
946
- deb = "puppetlabs-release%s-%s.deb" % [repo_name, codename]
966
+ if repo_name.match(/puppet\d*/)
967
+ deb = "%s-release-%s.deb" % [repo_name, codename]
968
+ else
969
+ repo_name = '-' + repo_name unless repo_name.empty?
970
+ deb = "puppetlabs-release%s-%s.deb" % [repo_name, codename]
971
+ end
947
972
 
948
973
  remote = URI.join( opts[:release_apt_repo_url], deb )
949
974
 
@@ -1,3 +1,3 @@
1
1
  module BeakerPuppet
2
- VERSION = '0.7.0'
2
+ VERSION = '0.8.0'
3
3
  end
@@ -270,6 +270,12 @@ describe ClassMixedWithDSLInstallUtils do
270
270
  end
271
271
 
272
272
  context 'install_puppet_from_rpm_on' do
273
+ it 'installs puppet release repo when set' do
274
+ expect(subject).to receive(:install_puppetlabs_release_repo).with(el6hostaio,'puppet',{:puppet_collection => 'puppet'})
275
+
276
+ subject.install_puppet_from_rpm_on( el6hostaio, {:puppet_collection => 'puppet'} )
277
+ end
278
+
273
279
  it 'installs PC1 release repo when AIO' do
274
280
  expect(subject).to receive(:install_puppetlabs_release_repo).with(el6hostaio,'pc1',{})
275
281
 
@@ -688,6 +694,55 @@ describe ClassMixedWithDSLInstallUtils do
688
694
  allow( subject ).to receive( :options ) { opts }
689
695
  end
690
696
 
697
+ context 'on el 7' do
698
+ let( :platform ) { Beaker::Platform.new( 'el-7-x86_64' ) }
699
+ it 'returns the correct url when repo is set to puppet8' do
700
+ expect( host ).to receive( :install_package_with_rpm ).with( /puppet8\/puppet8-release-el-7\.noarch\.rpm$/, '--replacepkgs', {:package_proxy=>false} )
701
+ subject.install_puppetlabs_release_repo_on( host, 'puppet8')
702
+ end
703
+ it 'returns the correct url when opts[:puppet_collection] is set to puppet14' do
704
+ expect( host ).to receive( :install_package_with_rpm ).with( /puppet14\/puppet14-release-el-7\.noarch\.rpm$/, '--replacepkgs', {:package_proxy=>false} )
705
+ subject.install_puppetlabs_release_repo_on( host, nil, {:puppet_collection => 'puppet14'})
706
+ end
707
+ it 'returns the correct url when both repo and opts[:puppet_collection] are nil' do
708
+ expect( host ).to receive( :install_package_with_rpm ).with( /puppetlabs-release-el-7\.noarch\.rpm$/, '--replacepkgs', {:package_proxy=>false} )
709
+ subject.install_puppetlabs_release_repo_on( host )
710
+ end
711
+ it 'returns the correct url when repo is set to pc1' do
712
+ expect( host ).to receive( :install_package_with_rpm ).with( /puppetlabs-release-pc1-el-7\.noarch\.rpm$/, '--replacepkgs', {:package_proxy=>false} )
713
+ subject.install_puppetlabs_release_repo_on( host, 'pc1' )
714
+ end
715
+ end
716
+
717
+ context 'on debian 8' do
718
+ let( :platform ) { Beaker::Platform.new( 'debian-8-i386' ) }
719
+ it 'returns the correct url when repo is set to puppet4' do
720
+ expect( subject ).to receive( :on ).with( host, /puppet4-release-jessie\.deb$/ ).once
721
+ expect( subject ).to receive( :on ).with( host, "dpkg -i --force-all /tmp/puppet.deb" ).once
722
+ expect( subject ).to receive( :on ).with( host, "apt-get update" ).once
723
+ subject.install_puppetlabs_release_repo_on( host, 'puppet4' )
724
+ end
725
+ it 'returns the correct url when opts[:puppet_collection] is set to puppet7' do
726
+ expect( subject ).to receive( :on ).with( host, /puppet7-release-jessie\.deb$/ ).once
727
+ expect( subject ).to receive( :on ).with( host, "dpkg -i --force-all /tmp/puppet.deb" ).once
728
+ expect( subject ).to receive( :on ).with( host, "apt-get update" ).once
729
+ subject.install_puppetlabs_release_repo_on( host, nil, {:puppet_collection => 'puppet7'} )
730
+ end
731
+ it 'returns the correct url when both repo and opts[:puppet_collection] are nil' do
732
+ expect( subject ).to receive( :on ).with( host, /puppetlabs-release-jessie\.deb$/ ).once
733
+ expect( subject ).to receive( :on ).with( host, "dpkg -i --force-all /tmp/puppet.deb" ).once
734
+ expect( subject ).to receive( :on ).with( host, "apt-get update" ).once
735
+ subject.install_puppetlabs_release_repo_on( host )
736
+ end
737
+ it 'returns the correct url when both repo is set to pc1' do
738
+ expect( subject ).to receive( :on ).with( host, /puppetlabs-release-pc1-jessie\.deb$/ ).once
739
+ expect( subject ).to receive( :on ).with( host, "dpkg -i --force-all /tmp/puppet.deb" ).once
740
+ expect( subject ).to receive( :on ).with( host, "apt-get update" ).once
741
+ subject.install_puppetlabs_release_repo_on( host, 'pc1' )
742
+ end
743
+ end
744
+
745
+
691
746
  context 'on cisco platforms' do
692
747
  context 'version 5' do
693
748
  let( :platform ) { Beaker::Platform.new( 'cisco_nexus-7-x86_64' ) }
@@ -817,19 +872,36 @@ describe ClassMixedWithDSLInstallUtils do
817
872
 
818
873
  end
819
874
 
820
- describe '#install_puppet_agent_from_msi_on' do
875
+ describe '#msi_link_path' do
821
876
  let( :opts ) { { :puppet_agent_version => 'VERSION', :win_download_url => 'http://downloads.puppetlabs.com/windows' } }
822
877
  let( :platform ) { 'windows' }
823
- let( :host ) { { :platform => platform } }
878
+ let( :host ) { { :platform => platform, 'dist' => 'puppet-agent-VERSION-x64' } }
879
+
880
+ it 'returns the right link when puppet collection is set' do
881
+ allow(subject).to receive(:link_exists?).with(anything()).and_return( true )
882
+
883
+ expect(subject.msi_link_path( host, opts.merge({:puppet_collection => 'puppet'}) )).to eq "#{opts[:win_download_url]}/puppet/puppet-agent-VERSION-x64.msi"
884
+ end
885
+
886
+ it 'returns the right link when puppet collection is not set' do
887
+ expect(subject).to receive(:link_exists?).with(anything()).and_return( true )
888
+
889
+ expect(subject.msi_link_path( host, opts )).to eq "#{opts[:win_download_url]}/puppet-agent-VERSION-x64.msi"
890
+ end
824
891
 
825
892
  it 'returns error when link incorrect' do
826
893
  allow(subject).to receive(:link_exists?).with(anything()).and_return( false )
827
- expect( host ).to receive( :is_x86_64? ).and_return( true )
828
894
 
829
895
  expect{
830
- subject.install_puppet_agent_from_msi_on( host, opts )
896
+ subject.msi_link_path( host, opts )
831
897
  }.to raise_error(RuntimeError, /Puppet MSI at http:\/\/downloads.puppetlabs.com\/windows\/puppet-agent-VERSION-x64.msi does not exist!/)
832
898
  end
899
+ end
900
+
901
+ describe '#install_puppet_agent_from_msi_on' do
902
+ let( :opts ) { { :puppet_agent_version => 'VERSION', :win_download_url => 'http://downloads.puppetlabs.com/windows' } }
903
+ let( :platform ) { 'windows' }
904
+ let( :host ) { { :platform => platform } }
833
905
 
834
906
  it 'uses x86 msi when host is_x86_64 and install_32 is set on the host' do
835
907
  host['install_32'] = true
@@ -240,7 +240,7 @@ describe ClassMixedWithDSLInstallUtils do
240
240
  allow( subject ).to receive( :install_artifact_on )
241
241
 
242
242
  expect( subject ).to receive( :configure_type_defaults_on ).with( hosts[0] ).once
243
- subject.install_from_build_data_url( 'project_name', 'project_sha', host[0] )
243
+ subject.install_from_build_data_url( 'project_name', 'project_sha', hosts[0] )
244
244
  end
245
245
 
246
246
  it 'calls #configure_type_defaults_on custom array of hosts if set' do
@@ -250,7 +250,7 @@ describe ClassMixedWithDSLInstallUtils do
250
250
 
251
251
  custom_host_list = hosts.sample(1 + rand(hosts.count))
252
252
 
253
- custom_host_list do |host|
253
+ custom_host_list.each do |host|
254
254
  expect( subject ).to receive( :configure_type_defaults_on ).with( host ).once
255
255
  end
256
256
  subject.install_from_build_data_url( 'project_name', 'project_sha', custom_host_list )
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-15 00:00:00.000000000 Z
11
+ date: 2017-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec