beaker-pe 1.6.1 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTA3NWI0NmU2ZjExNGQ5OTk2MWQxZDYxYTJiMzU1MjI1OWYxMjhmNw==
4
+ ZWU4ZTk5NzEzNTQyM2YzNDAzZjY0YWMxMmQwMjA4MDE3MTkwM2JhNg==
5
5
  data.tar.gz: !binary |-
6
- YjBmZTAyNDc5ZjRlNjk1M2RhMjcxYmQ1Y2Q4ZmM3MWVhODZlNGY0MA==
6
+ Y2RiZDllMDhiY2Q4ZDhlMzUzNDU3ZTg1MjU1MjlhYzg3ZmFiODdmNg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDY5N2JhNmVmZjE2ZmFiNTNmOTk5MzBiNjlhY2QwYzgyZmNmZDk3ZWYwNTM5
10
- OTU0ZmM3MGE5NThhNTFjMTQwYjUzMDM3MTI1MmFkNjUzMzA0ZDJhZTkyMjAy
11
- Y2RiZGQ0Zjk3YjZkMTc5ZjY2NDJiZjIxOWQ5ODRkNWM2OGFjMjU=
9
+ MTM1YjU2ODYwZGZmMDVlNGQ4MDhjMzcwNDU1Yzc3N2IxNTIzODFkZTQ4YzEy
10
+ OTBhZjI5NjIxY2ZmYjA0ODBiMTljZWViNDFhNGNhZDI4Y2RhMDQ4MmVlNTlm
11
+ MTcwZGQ1NmZmNTkyZjQ5ZTFkM2QyYTJkOWNjOTc4Y2NmNmMyZWM=
12
12
  data.tar.gz: !binary |-
13
- NmJhMDhmZmRhZTA3MzczNDRjYzA5YjExMDc4MDcxMjQwY2NmM2NjNWZhNjRj
14
- ZWYxMjYwMDUxNDA3OTcwZWE4NTlkYmIzNDg1YjdmNjk1YmE1YzRlNGMyMTY0
15
- M2U4ZWVlYjEzMGMyYzZhOWQ0YWU3MGUzMjIwNTQ4MmI0MWMzN2Y=
13
+ NmExZjQzNzA1OTMxMmMyZDJiZmExMTgwODMyMjBjMmIwZmE1YjI1M2U0YTBi
14
+ YzIxM2I2Mzc0N2RkZjhkYjk2OTdmMDU1OGViYmM0MzMzYTYzYTY2MjJhNzA4
15
+ ODFhYTgzYzAyNTdmMjE2MGVjNWEyN2FkZTY5ZjRiY2M3OTg2MzY=
data/HISTORY.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # default - History
2
2
  ## Tags
3
- * [LATEST - 22 Nov, 2016 (4b812f78)](#LATEST)
3
+ * [LATEST - 20 Dec, 2016 (80c18a2b)](#LATEST)
4
+ * [1.6.1 - 22 Nov, 2016 (52e30609)](#1.6.1)
4
5
  * [1.6.0 - 16 Nov, 2016 (0da1b64c)](#1.6.0)
5
6
  * [1.5.0 - 7 Nov, 2016 (24d78992)](#1.5.0)
6
7
  * [1.4.0 - 11 Oct, 2016 (6becdbb2)](#1.4.0)
@@ -25,7 +26,53 @@
25
26
  * [0.1.0 - 29 Feb, 2016 (4fc88d8c)](#0.1.0)
26
27
 
27
28
  ## Details
28
- ### <a name = "LATEST">LATEST - 22 Nov, 2016 (4b812f78)
29
+ ### <a name = "LATEST">LATEST - 20 Dec, 2016 (80c18a2b)
30
+
31
+ * (GEM) update beaker-pe version to 1.7.0 (80c18a2b)
32
+
33
+ * Merge pull request #44 from kevpl/maint_version_fix (a1a01605)
34
+
35
+
36
+ ```
37
+ Merge pull request #44 from kevpl/maint_version_fix
38
+
39
+ (MAINT) fix broken version number
40
+ ```
41
+ * (MAINT) fix broken version number (46340fb7)
42
+
43
+
44
+ ```
45
+ (MAINT) fix broken version number
46
+
47
+ [skip ci]
48
+ ```
49
+ * Merge pull request #19 from kevpl/bkr831_install_windows (415d3f3c)
50
+
51
+
52
+ ```
53
+ Merge pull request #19 from kevpl/bkr831_install_windows
54
+
55
+ (BKR-831) added dynamic puppet-agent version read from master
56
+ ```
57
+ * Merge pull request #42 from kevpl/maint_fix_specs (e185d0da)
58
+
59
+
60
+ ```
61
+ Merge pull request #42 from kevpl/maint_fix_specs
62
+
63
+ (MAINT) fix spec testing
64
+ ```
65
+ * (MAINT) fix spec testing (9dc8b8d7)
66
+
67
+ * (BKR-831) add fallback to aio_agent_version (d42ef8ef)
68
+
69
+ * (BKR-831) cleaned up host preparation for installs (f544d6aa)
70
+
71
+ * (BKR-831) added dynamic puppet-agent version read from master (76d2f9a7)
72
+
73
+ ### <a name = "1.6.1">1.6.1 - 22 Nov, 2016 (52e30609)
74
+
75
+ * (HISTORY) update beaker-pe history for gem release 1.6.1 (52e30609)
29
76
 
30
77
  * (GEM) update beaker-pe version to 1.6.1 (4b812f78)
31
78
 
@@ -386,39 +386,7 @@ module Beaker
386
386
  add_extended_gpg_key_to_hosts(hosts, opts)
387
387
 
388
388
  # Set PE distribution for all the hosts, create working dir
389
- use_all_tar = ENV['PE_USE_ALL_TAR'] == 'true'
390
- hosts.each do |host|
391
- next if agent_only_check_needed && hosts_agent_only.include?(host)
392
- host['pe_installer'] ||= 'puppet-enterprise-installer'
393
- if host['platform'] !~ /windows|osx/
394
- platform = use_all_tar ? 'all' : host['platform']
395
- version = host['pe_ver'] || opts[:pe_ver]
396
- host['dist'] = "puppet-enterprise-#{version}-#{platform}"
397
- elsif host['platform'] =~ /osx/
398
- version = host['pe_ver'] || opts[:pe_ver]
399
- host['dist'] = "puppet-enterprise-#{version}-#{host['platform']}"
400
- elsif host['platform'] =~ /windows/
401
- version = host[:pe_ver] || opts['pe_ver_win']
402
- is_config_32 = true == (host['ruby_arch'] == 'x86') || host['install_32'] || opts['install_32']
403
- should_install_64bit = !(version_is_less(version, '3.4')) && host.is_x86_64? && !is_config_32
404
- #only install 64bit builds if
405
- # - we are on pe version 3.4+
406
- # - we do not have install_32 set on host
407
- # - we do not have install_32 set globally
408
- if !(version_is_less(version, '3.99'))
409
- if should_install_64bit
410
- host['dist'] = "puppet-agent-#{version}-x64"
411
- else
412
- host['dist'] = "puppet-agent-#{version}-x86"
413
- end
414
- elsif should_install_64bit
415
- host['dist'] = "puppet-enterprise-#{version}-x64"
416
- else
417
- host['dist'] = "puppet-enterprise-#{version}"
418
- end
419
- end
420
- host['working_dir'] = host.tmpdir(Time.new.strftime("%Y-%m-%d_%H.%M.%S"))
421
- end
389
+ prepare_hosts(hosts_not_agent_only, opts)
422
390
 
423
391
  fetch_pe(hosts_not_agent_only, opts)
424
392
 
@@ -434,10 +402,12 @@ module Beaker
434
402
 
435
403
  if agent_only_check_needed && hosts_agent_only.include?(host) || is_windows_msi_and_aio
436
404
  host['type'] = 'aio'
437
- install_puppet_agent_pe_promoted_repo_on(host, { :puppet_agent_version => host[:puppet_agent_version] || opts[:puppet_agent_version],
438
- :puppet_agent_sha => host[:puppet_agent_sha] || opts[:puppet_agent_sha],
439
- :pe_ver => host[:pe_ver] || opts[:pe_ver],
440
- :puppet_collection => host[:puppet_collection] || opts[:puppet_collection] })
405
+ install_puppet_agent_pe_promoted_repo_on(host, {
406
+ :puppet_agent_version => get_puppet_agent_version(host, opts),
407
+ :puppet_agent_sha => host[:puppet_agent_sha] || opts[:puppet_agent_sha],
408
+ :pe_ver => host[:pe_ver] || opts[:pe_ver],
409
+ :puppet_collection => host[:puppet_collection] || opts[:puppet_collection]
410
+ })
441
411
  # 1 since no certificate found and waitforcert disabled
442
412
  acceptable_exit_codes = [0, 1]
443
413
  acceptable_exit_codes << 2 if opts[:type] == :upgrade
@@ -558,6 +528,88 @@ module Beaker
558
528
  end
559
529
  end
560
530
 
531
+ # Prepares hosts for rest of {#do_install} operations.
532
+ # This includes doing these tasks:
533
+ # - setting 'pe_installer' property on hosts
534
+ # - setting 'dist' property on hosts
535
+ # - creating and setting 'working_dir' property on hosts
536
+ #
537
+ # @note that these steps aren't necessary for all hosts. Specifically,
538
+ # 'agent_only' hosts do not require these steps to be executed.
539
+ #
540
+ # @param [Array<Host>] hosts Hosts to prepare
541
+ # @param [Hash{Symbol=>String}] local_options Local options, used to
542
+ # pass misc configuration required for the prep steps
543
+ #
544
+ # @return nil
545
+ def prepare_hosts(hosts, local_options={})
546
+ use_all_tar = ENV['PE_USE_ALL_TAR'] == 'true'
547
+ hosts.each do |host|
548
+ host['pe_installer'] ||= 'puppet-enterprise-installer'
549
+ if host['platform'] !~ /windows|osx/
550
+ platform = use_all_tar ? 'all' : host['platform']
551
+ version = host['pe_ver'] || local_options[:pe_ver]
552
+ host['dist'] = "puppet-enterprise-#{version}-#{platform}"
553
+ elsif host['platform'] =~ /osx/
554
+ version = host['pe_ver'] || local_options[:pe_ver]
555
+ host['dist'] = "puppet-enterprise-#{version}-#{host['platform']}"
556
+ elsif host['platform'] =~ /windows/
557
+ version = host[:pe_ver] || local_options['pe_ver_win']
558
+ is_config_32 = true == (host['ruby_arch'] == 'x86') || host['install_32'] || local_options['install_32']
559
+ should_install_64bit = !(version_is_less(version, '3.4')) && host.is_x86_64? && !is_config_32
560
+ #only install 64bit builds if
561
+ # - we are on pe version 3.4+
562
+ # - we do not have install_32 set on host
563
+ # - we do not have install_32 set globally
564
+ if !(version_is_less(version, '3.99'))
565
+ if should_install_64bit
566
+ host['dist'] = "puppet-agent-#{version}-x64"
567
+ else
568
+ host['dist'] = "puppet-agent-#{version}-x86"
569
+ end
570
+ elsif should_install_64bit
571
+ host['dist'] = "puppet-enterprise-#{version}-x64"
572
+ else
573
+ host['dist'] = "puppet-enterprise-#{version}"
574
+ end
575
+ end
576
+ host['working_dir'] = host.tmpdir(Time.new.strftime("%Y-%m-%d_%H.%M.%S"))
577
+ end
578
+ end
579
+
580
+ # Gets the puppet-agent version, hopefully from the host or local options.
581
+ # Will fall back to reading the `aio_agent_build` property on the master
582
+ # if neither of those two options are passed
583
+ #
584
+ # @note This method does have a side-effect: if it reads the
585
+ # `aio_agent_build` property from master, it will store it in the local
586
+ # options hash so that it won't have to do this more than once.
587
+ #
588
+ # @param [Beaker::Host] host Host to get puppet-agent for
589
+ # @param [Hash{Symbol=>String}] local_options local method options hash
590
+ #
591
+ # @return [String] puppet-agent version to install
592
+ def get_puppet_agent_version(host, local_options={})
593
+ puppet_agent_version = host[:puppet_agent_version] || local_options[:puppet_agent_version]
594
+ return puppet_agent_version if puppet_agent_version
595
+ log_prefix = "No :puppet_agent_version in host #{host} or local options."
596
+ fail_message = "#{log_prefix} Could not read facts from master to determine puppet_agent_version"
597
+ # we can query the master because do_install is called passing
598
+ # the {#sorted_hosts}, so we know the master will be installed
599
+ # before the agents
600
+ facts_result = on(master, 'puppet facts')
601
+ raise ArgumentError, fail_message if facts_result.exit_code != 0
602
+ facts_hash = JSON.parse(facts_result.stdout.chomp)
603
+ puppet_agent_version = facts_hash['values']['aio_agent_build']
604
+ # released masters don't have _build fact, fallback to _version
605
+ puppet_agent_version ||= facts_hash['values']['aio_agent_version']
606
+ raise ArgumentError, fail_message if puppet_agent_version.nil?
607
+ logger.warn("#{log_prefix} Read puppet-agent version #{puppet_agent_version} from master")
608
+ # saving so that we don't have to query the master more than once
609
+ local_options[:puppet_agent_version] = puppet_agent_version
610
+ puppet_agent_version
611
+ end
612
+
561
613
  # True if version is greater than or equal to MEEP_CUTOVER_VERSION (2016.2.0)
562
614
  def use_meep?(version)
563
615
  !version_is_less(version, MEEP_CUTOVER_VERSION)
@@ -903,7 +955,7 @@ module Beaker
903
955
 
904
956
  #wait for output to host['higgs_file']
905
957
  #we're all done when we find this line in the PE installation log
906
- if version_is_less(options[:pe_ver] || host['pe_ver'], '2016.3')
958
+ if version_is_less(opts[:pe_ver] || host['pe_ver'], '2016.3')
907
959
  higgs_re = /Please\s+go\s+to\s+https:\/\/.*\s+in\s+your\s+browser\s+to\s+continue\s+installation/m
908
960
  else
909
961
  higgs_re = /o\s+to\s+https:\/\/.*\s+in\s+your\s+browser\s+to\s+continue\s+installation/m
@@ -3,7 +3,7 @@ module Beaker
3
3
  module PE
4
4
 
5
5
  module Version
6
- STRING = '1.6.1'
6
+ STRING = '1.7.0'
7
7
  end
8
8
 
9
9
  end
@@ -772,15 +772,32 @@ describe ClassMixedWithDSLInstallUtils do
772
772
  "puppet #{arg}"
773
773
  end
774
774
 
775
+ pa_version = 'rarified_air_9364'
776
+ allow( subject ).to receive( :get_puppet_agent_version ).and_return( pa_version )
777
+
775
778
  allow( subject ).to receive( :hosts ).and_return( hosts )
776
779
  #create answers file per-host, except windows
777
780
  expect( subject ).to receive( :create_remote_file ).with( hosts[0], /answers/, /q/ ).once
778
781
  #run installer on all hosts
779
782
  expect( subject ).to receive( :on ).with( hosts[0], /puppet-enterprise-installer/ ).once
780
- expect( subject ).to receive( :install_puppet_agent_pe_promoted_repo_on ).with( hosts[1],
781
- {:puppet_agent_version=>nil, :puppet_agent_sha=>nil, :pe_ver=>hosts[1][:pe_ver], :puppet_collection=>nil} ).once
782
- expect( subject ).to receive( :install_puppet_agent_pe_promoted_repo_on ).with( hosts[2],
783
- {:puppet_agent_version=>nil, :puppet_agent_sha=>nil, :pe_ver=>hosts[2][:pe_ver], :puppet_collection=>nil} ).once
783
+ expect( subject ).to receive( :install_puppet_agent_pe_promoted_repo_on ).with(
784
+ hosts[1],
785
+ {
786
+ :puppet_agent_version => pa_version,
787
+ :puppet_agent_sha => nil,
788
+ :pe_ver => hosts[1][:pe_ver],
789
+ :puppet_collection => nil
790
+ }
791
+ ).once
792
+ expect( subject ).to receive( :install_puppet_agent_pe_promoted_repo_on ).with(
793
+ hosts[2],
794
+ {
795
+ :puppet_agent_version => pa_version,
796
+ :puppet_agent_sha => nil,
797
+ :pe_ver => hosts[2][:pe_ver],
798
+ :puppet_collection => nil
799
+ }
800
+ ).once
784
801
  hosts.each do |host|
785
802
  expect( subject ).to receive( :configure_type_defaults_on ).with( host ).once
786
803
  expect( subject ).to receive( :sign_certificate_for ).with( host ).once
@@ -812,6 +829,9 @@ describe ClassMixedWithDSLInstallUtils do
812
829
  hosts[2][:platform] = Beaker::Platform.new('el-6-x86_64')
813
830
  hosts[2][:pe_ver] = '3.8'
814
831
 
832
+ pa_version = 'rarified_air_1675'
833
+ allow( subject ).to receive( :get_puppet_agent_version ).and_return( pa_version )
834
+
815
835
  allow( subject ).to receive( :hosts ).and_return( hosts )
816
836
  allow( subject ).to receive( :options ).and_return(Beaker::Options::Presets.new.presets)
817
837
  allow( subject ).to receive( :on ).and_return( Beaker::Result.new( {}, '' ) )
@@ -834,8 +854,15 @@ describe ClassMixedWithDSLInstallUtils do
834
854
  expect( subject ).to receive( :create_remote_file ).with( hosts[0], /answers/, /q/ ).once
835
855
  #run installer on all hosts
836
856
  expect( subject ).to receive( :on ).with( hosts[0], /puppet-enterprise-installer/ ).once
837
- expect( subject ).to receive( :install_puppet_agent_pe_promoted_repo_on ).with( hosts[1],
838
- {:puppet_agent_version=>nil, :puppet_agent_sha=>nil, :pe_ver=>hosts[1][:pe_ver], :puppet_collection=>nil} ).once
857
+ expect( subject ).to receive( :install_puppet_agent_pe_promoted_repo_on ).with(
858
+ hosts[1],
859
+ {
860
+ :puppet_agent_version => pa_version,
861
+ :puppet_agent_sha => nil,
862
+ :pe_ver => hosts[1][:pe_ver],
863
+ :puppet_collection => nil
864
+ }
865
+ ).once
839
866
  expect( subject ).to receive( :on ).with( hosts[2], /puppet-enterprise-installer/ ).once
840
867
  hosts.each do |host|
841
868
  expect( subject ).to receive( :configure_type_defaults_on ).with( host ).once
@@ -860,10 +887,11 @@ describe ClassMixedWithDSLInstallUtils do
860
887
 
861
888
  it 'sets puppet-agent acceptable_exit_codes correctly for config helper on upgrade' do
862
889
  hosts = make_hosts({
863
- :previous_pe_ver => '3.0',
864
- :pe_ver => '4.0',
865
- :roles => ['agent'],
866
- }, 2)
890
+ :previous_pe_ver => '3.0',
891
+ :pe_ver => '4.0',
892
+ :pe_upgrade_ver => '4.0',
893
+ :roles => ['agent'],
894
+ }, 2)
867
895
  hosts[0][:roles] = ['master', 'database', 'dashboard']
868
896
  hosts[1][:platform] = Beaker::Platform.new('el-6-x86_64')
869
897
  opts[:HOSTS] = {}
@@ -871,6 +899,9 @@ describe ClassMixedWithDSLInstallUtils do
871
899
  opts[:HOSTS][host.name] = host
872
900
  end
873
901
 
902
+ pa_version = 'rarified_air_75699'
903
+ allow( subject ).to receive( :get_puppet_agent_version ).and_return( pa_version )
904
+
874
905
  allow( subject ).to receive( :hosts ).and_return( hosts )
875
906
  allow( subject ).to receive( :options ).and_return(Beaker::Options::Presets.new.presets)
876
907
  allow( subject ).to receive( :on ).and_return( Beaker::Result.new( {}, '' ) )
@@ -893,8 +924,14 @@ describe ClassMixedWithDSLInstallUtils do
893
924
  allow( subject ).to receive( :create_remote_file ).with( hosts[0], /answers/, /q/ )
894
925
  #run installer on all hosts
895
926
  allow( subject ).to receive( :on ).with( hosts[0], /puppet-enterprise-installer/ )
896
- allow( subject ).to receive( :install_puppet_agent_pe_promoted_repo_on ).with( hosts[1],
897
- {:puppet_agent_version=>nil, :puppet_agent_sha=>nil, :pe_ver=>hosts[1][:pe_ver], :puppet_collection=>nil} )
927
+ allow( subject ).to receive(
928
+ :install_puppet_agent_pe_promoted_repo_on
929
+ ).with( hosts[1], {
930
+ :puppet_agent_version => pa_version,
931
+ :puppet_agent_sha => nil,
932
+ :pe_ver => hosts[1][:pe_ver],
933
+ :puppet_collection => nil
934
+ } )
898
935
  # expect( subject ).to receive( :on ).with( hosts[2], /puppet-enterprise-installer/ ).once
899
936
  hosts.each do |host|
900
937
  allow( subject ).to receive( :add_pe_defaults_on ).with( host ) unless subject.aio_version?(host)
@@ -1260,7 +1297,86 @@ describe ClassMixedWithDSLInstallUtils do
1260
1297
  expect(subject).to receive(:fail_test)
1261
1298
  subject.check_console_status_endpoint({})
1262
1299
  end
1263
-
1264
1300
  end
1265
1301
 
1302
+ describe '#get_puppet_agent_version' do
1303
+
1304
+ context 'when the puppet_agent version is set on an argument' do
1305
+
1306
+ it 'uses host setting over all others' do
1307
+ pa_version = 'pants of the dance'
1308
+ host_arg = { :puppet_agent_version => pa_version }
1309
+ local_options = { :puppet_agent_version => 'something else' }
1310
+ expect( subject.get_puppet_agent_version( host_arg, local_options ) ).to be === pa_version
1311
+ end
1312
+
1313
+ it 'uses local options over all others (except host setting)' do
1314
+ pa_version = 'who did it?'
1315
+ local_options = { :puppet_agent_version => pa_version }
1316
+ expect( subject.get_puppet_agent_version( {}, local_options ) ).to be === pa_version
1317
+ end
1318
+ end
1319
+
1320
+ context 'when the puppet_agent version has to be read dynamically' do
1321
+
1322
+ def test_setup(mock_values={})
1323
+ json_hash = mock_values[:json_hash]
1324
+ pa_version = mock_values[:pa_version]
1325
+ pa_version ||= 'pa_version_' + rand(10 ** 5).to_s.rjust(5,'0') # 5 digit random number string
1326
+ json_hash ||= "{ \"values\": { \"aio_agent_build\": \"#{pa_version}\" }}"
1327
+
1328
+ allow( subject ).to receive( :master ).and_return( {} )
1329
+ result_mock = Object.new
1330
+ allow( result_mock ).to receive( :stdout ).and_return( json_hash )
1331
+ allow( result_mock ).to receive( :exit_code ).and_return( 0 )
1332
+ allow( subject ).to receive( :on ).and_return( result_mock )
1333
+ pa_version
1334
+ end
1335
+
1336
+ it 'parses and returns the command output correctly' do
1337
+ pa_version = test_setup
1338
+ expect( subject.get_puppet_agent_version( {} ) ).to be === pa_version
1339
+ end
1340
+
1341
+ it 'saves the puppet_agent version in the local_options argument' do
1342
+ pa_version = test_setup
1343
+ local_options_hash = {}
1344
+ subject.get_puppet_agent_version( {}, local_options_hash )
1345
+ expect( local_options_hash[:puppet_agent_version] ).to be === pa_version
1346
+ end
1347
+
1348
+ it 'falls back on aio_agent_version if _build is not available' do
1349
+ pa_version = 'your_face_13587'
1350
+ test_setup( :json_hash => "{ \"values\": { \"aio_agent_version\": \"#{pa_version}\" }}" )
1351
+ expect( subject.get_puppet_agent_version( {} ) ).to be === pa_version
1352
+ end
1353
+ end
1354
+
1355
+ context 'failures' do
1356
+
1357
+ def test_setup(mock_values)
1358
+ exit_code = mock_values[:exit_code] || 0
1359
+ json_hash = mock_values[:json_hash]
1360
+ pa_version = 'pa_version_'
1361
+ pa_version << rand(10 ** 5).to_s.rjust(5,'0') # 5 digit random number string
1362
+ json_hash ||= "{ \"values\": { \"aio_agent_build\": \"#{pa_version}\" }}"
1363
+
1364
+ allow( subject ).to receive( :master ).and_return( {} )
1365
+ result_mock = Object.new
1366
+ allow( result_mock ).to receive( :stdout ).and_return( json_hash )
1367
+ allow( result_mock ).to receive( :exit_code ).and_return( exit_code )
1368
+ allow( subject ).to receive( :on ).and_return( result_mock )
1369
+ end
1370
+
1371
+ it 'fails if "puppet facts" does not succeed' do
1372
+ test_setup( :exit_code => 1 )
1373
+ expect { subject.get_puppet_agent_version( {} ) }.to raise_error( ArgumentError )
1374
+ end
1375
+
1376
+ it 'fails if neither fact exists' do
1377
+ test_setup( :json_hash => "{ \"values\": {}}" )
1378
+ expect { subject.get_puppet_agent_version( {} ) }.to raise_error( ArgumentError )
1379
+ end
1380
+ end
1381
+ end
1266
1382
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-pe
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-22 00:00:00.000000000 Z
11
+ date: 2016-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec