beaker-pe 3.6.4 → 3.6.5

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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17f39948dbc58217035cd4e93469070ac5f35309dc2078fb3995e7edc6558d7f
4
- data.tar.gz: 65d1131709c2e886a82dc29f74a7f5a9907f89b2da0fc799233f325954069193
3
+ metadata.gz: 330fb055e63900ac5bdefd9d48a122eb35a13872c6a820bb072fe88409415ab7
4
+ data.tar.gz: 17588df9d4e67e74cab914118a35457d66aad62397c6c1194c41eb1ba51e967c
5
5
  SHA512:
6
- metadata.gz: bef219e4d18d83b1663764cb203cdeb1f857a889d602e4b22d91e1a47c9d96019a169bc8265cf67d485f3082bd67704e7454bc2caf5dff8548bf333be7fcda23
7
- data.tar.gz: 420a8f53c44f65636413a31b292b8f510369a740fa619c9c163143e4af02f0de115c7fca9c9bae7cf29d4a63a94a103cf8fd8d26cc4048e6202a4292a1194248
6
+ metadata.gz: 50576aa57b1e28945226720abe0f959cf1c05b56c29e84f61a215b461bb171728b27c0b03eaea233b9da69fc948938536c23ee8057bc7c54f5647c1ef6d6fd94
7
+ data.tar.gz: 8e5c488e4dbfd2a940f78a7bf434efc5d9fac63ffece679e07d5a078a616c807c480fe234b53d3710bc0b67c447362382abecefa25e14139f5762ba2195bd0b9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.6.5](https://github.com/puppetlabs/beaker-pe/tree/3.6.5) (2026-07-29)
4
+
5
+ [Full Changelog](https://github.com/puppetlabs/beaker-pe/compare/3.6.4...3.6.5)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - (PE-45366) Add pe_run_in_parallel option, serial by default on macOS [#309](https://github.com/puppetlabs/beaker-pe/pull/309) ([Magisus](https://github.com/Magisus))
10
+
3
11
  ## [3.6.4](https://github.com/puppetlabs/beaker-pe/tree/3.6.4) (2026-07-23)
4
12
 
5
13
  [Full Changelog](https://github.com/puppetlabs/beaker-pe/compare/3.6.3...3.6.4)
data/README.md CHANGED
@@ -31,6 +31,27 @@ of key concepts.
31
31
  involved in addressing key problems and use-cases. For instance, checkout our
32
32
  [How-to Install Puppet Enterprise doc](docs/how_to/install_puppet_enterprise.md).
33
33
 
34
+ ## Configuration
35
+
36
+ ### Running install/upgrade steps serially (`pe_run_in_parallel`)
37
+
38
+ Several PE install/upgrade steps act on many hosts at once by `fork()`ing a child
39
+ process per host, each with its own SSH connection. **On macOS, forking a Ruby
40
+ process that has already used `Net::SSH` deadlocks the child**, so these steps hang
41
+ until beaker's watchdog kills them (`RuntimeError: Child process ran longer than
42
+ timeout of 1800`). This does not happen on Linux/CI.
43
+
44
+ Because of this, beaker-pe defaults to running these steps **serially on macOS** and
45
+ **in parallel on every other platform**. You can override the default either way:
46
+
47
+ - Option: set `pe_run_in_parallel: true` (or `false`) in your beaker options.
48
+ - Env var: `export BEAKER_PE_RUN_IN_PARALLEL=1` (or `0`) before running beaker.
49
+
50
+ Precedence, highest first: the `BEAKER_PE_RUN_IN_PARALLEL` env var, then the
51
+ `pe_run_in_parallel` option, then the platform default (`false` on macOS, `true`
52
+ elsewhere). For the env var, `1`, `true`, or `yes` force parallel; `0`, `false`, or
53
+ `no` force serial.
54
+
34
55
  ## Upgrading from 0.y to 1.y?
35
56
 
36
57
  If you've used beaker-pe previously (during the 0.y versions), you'll
@@ -1519,12 +1519,27 @@ NOASK
1519
1519
  (host['platform'] =~ /windows-2008r2/ && (!version_is_less(host['pe_ver'], '2016.4.99') && version_is_less(host['pe_ver'], '2016.5.99') && !version_is_less(host['pe_ver'], '3.99')))
1520
1520
  end
1521
1521
 
1522
+ # Whether PE install/upgrade steps that act on many hosts should fork and
1523
+ # run in parallel. Forking + Net::SSH deadlocks on macOS, so the default is
1524
+ # serial there and parallel everywhere else; a developer can override either
1525
+ # way. Precedence, highest first:
1526
+ # BEAKER_PE_RUN_IN_PARALLEL env var > :pe_run_in_parallel option > default
1527
+ # (false on macOS, true elsewhere)
1528
+ # @api private
1529
+ # @return [Boolean]
1530
+ def pe_run_in_parallel?
1531
+ env = ENV['BEAKER_PE_RUN_IN_PARALLEL']
1532
+ return %w[1 true yes].include?(env.downcase) unless env.nil? || env.empty?
1533
+ opt = options[:pe_run_in_parallel]
1534
+ opt.nil? ? (RUBY_PLATFORM !~ /darwin/) : !!opt
1535
+ end
1536
+
1522
1537
  # Runs puppet on all nodes, unless they have the roles: master,database,console/dashboard
1523
1538
  # @param [Array<Host>] hosts The sorted hosts to install or upgrade PE on
1524
1539
  def run_puppet_on_non_infrastructure_nodes(all_hosts)
1525
1540
  pe_infrastructure = select_hosts({:roles => ['master', 'compile_master', 'pe_compiler', 'dashboard', 'database']}, all_hosts)
1526
1541
  non_infrastructure = all_hosts.reject{|host| pe_infrastructure.include? host}
1527
- on non_infrastructure, puppet_agent('-t'), :acceptable_exit_codes => [0,2], :run_in_parallel => true
1542
+ on non_infrastructure, puppet_agent('-t'), :acceptable_exit_codes => [0,2], :run_in_parallel => pe_run_in_parallel?
1528
1543
  end
1529
1544
 
1530
1545
  # Whether or not PE should be managing the puppet service on agents.
@@ -2133,7 +2148,7 @@ EOM
2133
2148
  end
2134
2149
 
2135
2150
  step "Stop agent service on infrastructure nodes" do
2136
- stop_agent_on(pe_infrastructure, :run_in_parallel => true)
2151
+ stop_agent_on(pe_infrastructure, :run_in_parallel => pe_run_in_parallel?)
2137
2152
  end
2138
2153
 
2139
2154
  # waitforlock in case stopping the agent run after stopping the agent service
@@ -2488,7 +2503,7 @@ EOM
2488
2503
  end
2489
2504
 
2490
2505
  step "Install agents" do
2491
- block_on(agent_nodes, {:run_in_parallel => true}) do |host|
2506
+ block_on(agent_nodes, {:run_in_parallel => pe_run_in_parallel?}) do |host|
2492
2507
  install_ca_cert_on(host, opts)
2493
2508
  on(host, installer_cmd(host, opts))
2494
2509
  end
@@ -2500,13 +2515,13 @@ EOM
2500
2515
  end
2501
2516
 
2502
2517
  step "Stop puppet agents to avoid interfering with tests" do
2503
- stop_agent_on(agent_nodes, :run_in_parallel => true)
2518
+ stop_agent_on(agent_nodes, :run_in_parallel => pe_run_in_parallel?)
2504
2519
  end
2505
2520
 
2506
2521
  # waitforlock in case stopping the agent run after stopping the agent service
2507
2522
  # takes a little longer than usual
2508
2523
  step "Run puppet on all agent nodes" do
2509
- block_on(agent_nodes, {:run_in_parallel => true}) do |host|
2524
+ block_on(agent_nodes, {:run_in_parallel => pe_run_in_parallel?}) do |host|
2510
2525
  on host, puppet_agent("-t #{waitforlock_flag(host)}"), :acceptable_exit_codes => [0,2]
2511
2526
  end
2512
2527
  end
@@ -3,7 +3,7 @@ module Beaker
3
3
  module PE
4
4
 
5
5
  module Version
6
- STRING = '3.6.4'
6
+ STRING = '3.6.5'
7
7
  end
8
8
 
9
9
  end
@@ -25,6 +25,17 @@ class ClassMixedWithDSLInstallUtils
25
25
  end
26
26
 
27
27
  describe ClassMixedWithDSLInstallUtils do
28
+ # Neutralize BEAKER_PE_RUN_IN_PARALLEL and pin RUBY_PLATFORM to a non-macOS value
29
+ # for every example in this file, so that pre-existing specs asserting the default
30
+ # (:run_in_parallel => true) are not affected by whatever a developer happens to
31
+ # have exported in their shell or by running the suite on a Mac (where the default
32
+ # is serial). Examples that exercise the macOS default stub RUBY_PLATFORM to darwin.
33
+ before do
34
+ allow(ENV).to receive(:[]).and_call_original
35
+ allow(ENV).to receive(:[]).with('BEAKER_PE_RUN_IN_PARALLEL').and_return(nil)
36
+ stub_const('RUBY_PLATFORM', 'x86_64-linux')
37
+ end
38
+
28
39
  let(:presets) { Beaker::Options::Presets.new }
29
40
  let(:opts) { presets.presets.merge(presets.env_vars) }
30
41
  let(:basic_hosts) { make_hosts( { :pe_ver => '3.0',
@@ -612,6 +623,35 @@ describe ClassMixedWithDSLInstallUtils do
612
623
  end
613
624
  end
614
625
 
626
+ describe '#run_puppet_on_non_infrastructure_nodes parallel wiring' do
627
+ let(:master) { make_host('master', :pe_ver => '2016.4', :platform => 'el-7-x86_64', :roles => ['master', 'database', 'dashboard']) }
628
+ let(:el_agent) { make_host('agent', :pe_ver => '2016.4', :platform => 'el-7-x86_64', :roles => ['frictionless']) }
629
+
630
+ before do
631
+ allow(ENV).to receive(:[]).and_call_original
632
+ allow(ENV).to receive(:[]).with('BEAKER_PE_RUN_IN_PARALLEL').and_return(nil)
633
+ end
634
+
635
+ it 'passes run_in_parallel => false when the option disables it' do
636
+ subject.options[:pe_run_in_parallel] = false
637
+ expect(subject).to receive(:on).with(
638
+ [el_agent],
639
+ anything,
640
+ hash_including(:run_in_parallel => false)
641
+ ).once
642
+ subject.run_puppet_on_non_infrastructure_nodes([master, el_agent])
643
+ end
644
+
645
+ it 'passes run_in_parallel => true by default' do
646
+ expect(subject).to receive(:on).with(
647
+ [el_agent],
648
+ anything,
649
+ hash_including(:run_in_parallel => true)
650
+ ).once
651
+ subject.run_puppet_on_non_infrastructure_nodes([master, el_agent])
652
+ end
653
+ end
654
+
615
655
  describe 'install_via_msi?' do
616
656
  it 'returns true if pe_version is before PE 2016.4.0' do
617
657
  the_host = winhost.dup
@@ -661,6 +701,71 @@ describe ClassMixedWithDSLInstallUtils do
661
701
 
662
702
  end
663
703
 
704
+ describe '#pe_run_in_parallel?' do
705
+ before do
706
+ # Default: pretend the env var is unset unless a specific example sets it.
707
+ allow(ENV).to receive(:[]).and_call_original
708
+ allow(ENV).to receive(:[]).with('BEAKER_PE_RUN_IN_PARALLEL').and_return(nil)
709
+ end
710
+
711
+ context 'with no option and no env var' do
712
+ it 'defaults to true off macOS' do
713
+ stub_const('RUBY_PLATFORM', 'x86_64-linux')
714
+ expect(subject.send(:pe_run_in_parallel?)).to eq(true)
715
+ end
716
+
717
+ it 'defaults to false on macOS' do
718
+ stub_const('RUBY_PLATFORM', 'x86_64-darwin21')
719
+ expect(subject.send(:pe_run_in_parallel?)).to eq(false)
720
+ end
721
+ end
722
+
723
+ context 'with the :pe_run_in_parallel option' do
724
+ it 'returns false when the option is false' do
725
+ subject.options[:pe_run_in_parallel] = false
726
+ expect(subject.send(:pe_run_in_parallel?)).to eq(false)
727
+ end
728
+
729
+ it 'returns true when the option is true' do
730
+ subject.options[:pe_run_in_parallel] = true
731
+ expect(subject.send(:pe_run_in_parallel?)).to eq(true)
732
+ end
733
+ end
734
+
735
+ context 'with the BEAKER_PE_RUN_IN_PARALLEL env var set' do
736
+ %w[1 true yes TRUE Yes].each do |truthy|
737
+ it "returns true for #{truthy.inspect}" do
738
+ allow(ENV).to receive(:[]).with('BEAKER_PE_RUN_IN_PARALLEL').and_return(truthy)
739
+ expect(subject.send(:pe_run_in_parallel?)).to eq(true)
740
+ end
741
+ end
742
+
743
+ %w[0 false no off].each do |falsey|
744
+ it "returns false for #{falsey.inspect}" do
745
+ allow(ENV).to receive(:[]).with('BEAKER_PE_RUN_IN_PARALLEL').and_return(falsey)
746
+ expect(subject.send(:pe_run_in_parallel?)).to eq(false)
747
+ end
748
+ end
749
+
750
+ it 'overrides the option (env true beats option false)' do
751
+ subject.options[:pe_run_in_parallel] = false
752
+ allow(ENV).to receive(:[]).with('BEAKER_PE_RUN_IN_PARALLEL').and_return('1')
753
+ expect(subject.send(:pe_run_in_parallel?)).to eq(true)
754
+ end
755
+
756
+ it 'overrides the option (env false beats option true)' do
757
+ subject.options[:pe_run_in_parallel] = true
758
+ allow(ENV).to receive(:[]).with('BEAKER_PE_RUN_IN_PARALLEL').and_return('0')
759
+ expect(subject.send(:pe_run_in_parallel?)).to eq(false)
760
+ end
761
+
762
+ it 'falls through to the default when the env var is empty' do
763
+ allow(ENV).to receive(:[]).with('BEAKER_PE_RUN_IN_PARALLEL').and_return('')
764
+ expect(subject.send(:pe_run_in_parallel?)).to eq(true)
765
+ end
766
+ end
767
+ end
768
+
664
769
  describe 'higgs installer' do
665
770
  let(:host) { unixhost }
666
771
  let(:higgs_regex) { %r{cd .* ; nohup \./puppet-enterprise-installer <<<#{higgs_answer} .*} }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-pe
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.4
4
+ version: 3.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs