beaker-pe 3.6.3 → 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 +4 -4
- data/CHANGELOG.md +32 -0
- data/README.md +21 -0
- data/lib/beaker-pe/install/pe_utils.rb +59 -12
- data/lib/beaker-pe/version.rb +1 -1
- data/spec/beaker-pe/install/pe_utils_spec.rb +172 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 330fb055e63900ac5bdefd9d48a122eb35a13872c6a820bb072fe88409415ab7
|
|
4
|
+
data.tar.gz: 17588df9d4e67e74cab914118a35457d66aad62397c6c1194c41eb1ba51e967c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 50576aa57b1e28945226720abe0f959cf1c05b56c29e84f61a215b461bb171728b27c0b03eaea233b9da69fc948938536c23ee8057bc7c54f5647c1ef6d6fd94
|
|
7
|
+
data.tar.gz: 8e5c488e4dbfd2a940f78a7bf434efc5d9fac63ffece679e07d5a078a616c807c480fe234b53d3710bc0b67c447362382abecefa25e14139f5762ba2195bd0b9
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
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
|
+
|
|
11
|
+
## [3.6.4](https://github.com/puppetlabs/beaker-pe/tree/3.6.4) (2026-07-23)
|
|
12
|
+
|
|
13
|
+
[Full Changelog](https://github.com/puppetlabs/beaker-pe/compare/3.6.3...3.6.4)
|
|
14
|
+
|
|
15
|
+
**Fixed bugs:**
|
|
16
|
+
|
|
17
|
+
- [PE-41009]: Fall back to agent-downloads when promoted agent is missing from the public mirror [#306](https://github.com/puppetlabs/beaker-pe/pull/306) ([Magisus](https://github.com/Magisus))
|
|
18
|
+
|
|
19
|
+
## [3.6.3](https://github.com/puppetlabs/beaker-pe/tree/3.6.3) (2026-07-16)
|
|
20
|
+
|
|
21
|
+
[Full Changelog](https://github.com/puppetlabs/beaker-pe/compare/3.6.2...3.6.3)
|
|
22
|
+
|
|
23
|
+
**Fixed bugs:**
|
|
24
|
+
|
|
25
|
+
- [PE-45082]: Broaden is_expected_pe_postgres_failure? allowlist [#303](https://github.com/puppetlabs/beaker-pe/pull/303) ([steveax](https://github.com/steveax))
|
|
26
|
+
|
|
27
|
+
## [3.6.2](https://github.com/puppetlabs/beaker-pe/tree/3.6.2) (2026-06-05)
|
|
28
|
+
|
|
29
|
+
[Full Changelog](https://github.com/puppetlabs/beaker-pe/compare/3.6.1...3.6.2)
|
|
30
|
+
|
|
31
|
+
**Fixed bugs:**
|
|
32
|
+
|
|
33
|
+
- Add waitforlock flag to second puppet runs to prevent lock collisions [#300](https://github.com/puppetlabs/beaker-pe/pull/300) ([jonathannewman](https://github.com/jonathannewman))
|
|
34
|
+
|
|
3
35
|
## [3.6.1](https://github.com/puppetlabs/beaker-pe/tree/3.6.1) (2025-11-21)
|
|
4
36
|
|
|
5
37
|
[Full Changelog](https://github.com/puppetlabs/beaker-pe/compare/3.6.0...3.6.1)
|
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
|
|
@@ -43,6 +43,13 @@ module Beaker
|
|
|
43
43
|
NODE_CONF_PATH = "#{MEEP_DATA_DIR}/conf.d/nodes"
|
|
44
44
|
BEAKER_MEEP_TMP = "pe_conf"
|
|
45
45
|
|
|
46
|
+
# Base URL for promoted puppet-agent packages on the internal
|
|
47
|
+
# build-output host. Newer promoted agents (>= 8.11.0) are no longer
|
|
48
|
+
# published to the public pm.puppet.com / S3 mirror; el/windows installs
|
|
49
|
+
# fall back here. This is the same host the sles-11 and
|
|
50
|
+
# solaris-10-sparc install paths already use.
|
|
51
|
+
AGENT_DOWNLOADS_URL = 'http://agent-downloads.delivery.puppetlabs.net/puppet-agent'.freeze
|
|
52
|
+
|
|
46
53
|
# @!macro [new] common_opts
|
|
47
54
|
# @param [Hash{Symbol=>String}] opts Options to alter execution.
|
|
48
55
|
# @option opts [Boolean] :silent (false) Do not produce log output
|
|
@@ -332,7 +339,7 @@ module Beaker
|
|
|
332
339
|
# @api private
|
|
333
340
|
def agent_package_common_vars(puppet_agent_ver, opts)
|
|
334
341
|
{
|
|
335
|
-
agent_downloads_url:
|
|
342
|
+
agent_downloads_url: AGENT_DOWNLOADS_URL,
|
|
336
343
|
master_aio_version: puppet_fact(master, 'aio_agent_build'),
|
|
337
344
|
stream: opts[:puppet_collection] || "puppet#{puppet_agent_ver[0]}"
|
|
338
345
|
}
|
|
@@ -1113,6 +1120,36 @@ NOASK
|
|
|
1113
1120
|
raise RuntimeError("#{host.class} not one of Beaker::(Windows|Mac|Unix)::Host")
|
|
1114
1121
|
end
|
|
1115
1122
|
|
|
1123
|
+
# Fetch a promoted puppet-agent package into copy_dir_local. Tries the
|
|
1124
|
+
# primary (pm.puppet.com/S3) promoted mirror first; if that returns a
|
|
1125
|
+
# 404 — newer agents (>= 8.11.0) are no longer published there — fall
|
|
1126
|
+
# back to the internal agent-downloads host. Any non-404 failure is
|
|
1127
|
+
# re-raised unchanged.
|
|
1128
|
+
#
|
|
1129
|
+
# @param [String] release_path Primary base URL, already including the
|
|
1130
|
+
# /v2/agent/<pe_ver>/<agent_ver>/repos suffix and release_path_end
|
|
1131
|
+
# @param [String] release_path_end Platform suffix ('' unix, '/windows')
|
|
1132
|
+
# @param [String] download_file The package file name
|
|
1133
|
+
# @param [String] copy_dir_local Local destination directory
|
|
1134
|
+
# @param [String] agent_version The puppet-agent version being installed
|
|
1135
|
+
# @api private
|
|
1136
|
+
def fetch_promoted_agent_with_fallback(release_path, release_path_end, download_file, copy_dir_local, agent_version)
|
|
1137
|
+
download_uri = URI.parse("#{release_path}/#{download_file}")
|
|
1138
|
+
redirect = Net::HTTP.start(download_uri.host) { |http| http.head(download_uri.path).response['location'] }
|
|
1139
|
+
primary_base = redirect ? redirect.chomp("/#{download_file}") : release_path
|
|
1140
|
+
|
|
1141
|
+
begin
|
|
1142
|
+
fetch_http_file(primary_base, download_file, copy_dir_local)
|
|
1143
|
+
rescue => e
|
|
1144
|
+
raise unless e.message.include?('404')
|
|
1145
|
+
|
|
1146
|
+
fallback_base = "#{AGENT_DOWNLOADS_URL}/#{agent_version}/repos#{release_path_end}"
|
|
1147
|
+
logger.warn("Promoted puppet-agent not found at #{primary_base}/#{download_file} (#{e.message}); " \
|
|
1148
|
+
"falling back to #{fallback_base}/#{download_file}")
|
|
1149
|
+
fetch_http_file(fallback_base, download_file, copy_dir_local)
|
|
1150
|
+
end
|
|
1151
|
+
end
|
|
1152
|
+
|
|
1116
1153
|
# Install shared repo of the puppet-agent on the given host(s). Downloaded from
|
|
1117
1154
|
# location of the form PE_PROMOTED_BUILDS_URL/PE_VER/puppet-agent/AGENT_VERSION/repo
|
|
1118
1155
|
#
|
|
@@ -1159,12 +1196,7 @@ NOASK
|
|
|
1159
1196
|
|
|
1160
1197
|
onhost_copied_download = File.join(onhost_copy_base, download_file)
|
|
1161
1198
|
onhost_copied_file = File.join(onhost_copy_base, release_file)
|
|
1162
|
-
|
|
1163
|
-
if (redirect = Net::HTTP.start(download_uri.host) { |http| http.head(download_uri.path).response['location'] })
|
|
1164
|
-
fetch_http_file(redirect.chomp("/#{download_file}"), download_file, copy_dir_local)
|
|
1165
|
-
else
|
|
1166
|
-
fetch_http_file(release_path, download_file, copy_dir_local)
|
|
1167
|
-
end
|
|
1199
|
+
fetch_promoted_agent_with_fallback(release_path, release_path_end, download_file, copy_dir_local, opts[:puppet_agent_version])
|
|
1168
1200
|
scp_to host, File.join(copy_dir_local, download_file), onhost_copy_base
|
|
1169
1201
|
|
|
1170
1202
|
if variant == 'windows'
|
|
@@ -1487,12 +1519,27 @@ NOASK
|
|
|
1487
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')))
|
|
1488
1520
|
end
|
|
1489
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
|
+
|
|
1490
1537
|
# Runs puppet on all nodes, unless they have the roles: master,database,console/dashboard
|
|
1491
1538
|
# @param [Array<Host>] hosts The sorted hosts to install or upgrade PE on
|
|
1492
1539
|
def run_puppet_on_non_infrastructure_nodes(all_hosts)
|
|
1493
1540
|
pe_infrastructure = select_hosts({:roles => ['master', 'compile_master', 'pe_compiler', 'dashboard', 'database']}, all_hosts)
|
|
1494
1541
|
non_infrastructure = all_hosts.reject{|host| pe_infrastructure.include? host}
|
|
1495
|
-
on non_infrastructure, puppet_agent('-t'), :acceptable_exit_codes => [0,2], :run_in_parallel =>
|
|
1542
|
+
on non_infrastructure, puppet_agent('-t'), :acceptable_exit_codes => [0,2], :run_in_parallel => pe_run_in_parallel?
|
|
1496
1543
|
end
|
|
1497
1544
|
|
|
1498
1545
|
# Whether or not PE should be managing the puppet service on agents.
|
|
@@ -2101,7 +2148,7 @@ EOM
|
|
|
2101
2148
|
end
|
|
2102
2149
|
|
|
2103
2150
|
step "Stop agent service on infrastructure nodes" do
|
|
2104
|
-
stop_agent_on(pe_infrastructure, :run_in_parallel =>
|
|
2151
|
+
stop_agent_on(pe_infrastructure, :run_in_parallel => pe_run_in_parallel?)
|
|
2105
2152
|
end
|
|
2106
2153
|
|
|
2107
2154
|
# waitforlock in case stopping the agent run after stopping the agent service
|
|
@@ -2456,7 +2503,7 @@ EOM
|
|
|
2456
2503
|
end
|
|
2457
2504
|
|
|
2458
2505
|
step "Install agents" do
|
|
2459
|
-
block_on(agent_nodes, {:run_in_parallel =>
|
|
2506
|
+
block_on(agent_nodes, {:run_in_parallel => pe_run_in_parallel?}) do |host|
|
|
2460
2507
|
install_ca_cert_on(host, opts)
|
|
2461
2508
|
on(host, installer_cmd(host, opts))
|
|
2462
2509
|
end
|
|
@@ -2468,13 +2515,13 @@ EOM
|
|
|
2468
2515
|
end
|
|
2469
2516
|
|
|
2470
2517
|
step "Stop puppet agents to avoid interfering with tests" do
|
|
2471
|
-
stop_agent_on(agent_nodes, :run_in_parallel =>
|
|
2518
|
+
stop_agent_on(agent_nodes, :run_in_parallel => pe_run_in_parallel?)
|
|
2472
2519
|
end
|
|
2473
2520
|
|
|
2474
2521
|
# waitforlock in case stopping the agent run after stopping the agent service
|
|
2475
2522
|
# takes a little longer than usual
|
|
2476
2523
|
step "Run puppet on all agent nodes" do
|
|
2477
|
-
block_on(agent_nodes, {:run_in_parallel =>
|
|
2524
|
+
block_on(agent_nodes, {:run_in_parallel => pe_run_in_parallel?}) do |host|
|
|
2478
2525
|
on host, puppet_agent("-t #{waitforlock_flag(host)}"), :acceptable_exit_codes => [0,2]
|
|
2479
2526
|
end
|
|
2480
2527
|
end
|
data/lib/beaker-pe/version.rb
CHANGED
|
@@ -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',
|
|
@@ -106,6 +117,73 @@ describe ClassMixedWithDSLInstallUtils do
|
|
|
106
117
|
end
|
|
107
118
|
end
|
|
108
119
|
|
|
120
|
+
context 'AGENT_DOWNLOADS_URL' do
|
|
121
|
+
it 'points at the internal agent-downloads host' do
|
|
122
|
+
expect(Beaker::DSL::InstallUtils::PEUtils::AGENT_DOWNLOADS_URL)
|
|
123
|
+
.to eq('http://agent-downloads.delivery.puppetlabs.net/puppet-agent')
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
context '#fetch_promoted_agent_with_fallback' do
|
|
128
|
+
let(:download_file) { 'puppet-agent-el-8-x86_64.tar.gz' }
|
|
129
|
+
let(:release_path) { 'https://pm.puppet.com/v2/agent/2023.8.3/8.11.0/repos' }
|
|
130
|
+
let(:s3_base) { 'https://s3.amazonaws.com/puppet-agents/puppet-agent/8.11.0/repos' }
|
|
131
|
+
let(:agent_dl_base) { 'http://agent-downloads.delivery.puppetlabs.net/puppet-agent/8.11.0/repos' }
|
|
132
|
+
|
|
133
|
+
before do
|
|
134
|
+
# HEAD on the pm.puppet.com URL resolves (via 302) to the S3 promoted mirror.
|
|
135
|
+
allow(Net::HTTP).to receive(:start).with('pm.puppet.com')
|
|
136
|
+
.and_return("#{s3_base}/#{download_file}")
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
it 'fetches from the primary mirror when the package is present' do
|
|
140
|
+
expect(subject).to receive(:fetch_http_file)
|
|
141
|
+
.with(s3_base, download_file, 'tmp/repo_configs/el')
|
|
142
|
+
expect(subject).not_to receive(:fetch_http_file)
|
|
143
|
+
.with(a_string_including('agent-downloads'), anything, anything)
|
|
144
|
+
|
|
145
|
+
subject.fetch_promoted_agent_with_fallback(release_path, '', download_file, 'tmp/repo_configs/el', '8.11.0')
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
it 'falls back to agent-downloads on a 404' do
|
|
149
|
+
allow(subject).to receive(:fetch_http_file)
|
|
150
|
+
.with(s3_base, download_file, 'tmp/repo_configs/el')
|
|
151
|
+
.and_raise("Failed to fetch_remote_file '#{s3_base}/#{download_file}' (404 Not Found)")
|
|
152
|
+
expect(subject).to receive(:fetch_http_file)
|
|
153
|
+
.with(agent_dl_base, download_file, 'tmp/repo_configs/el')
|
|
154
|
+
|
|
155
|
+
subject.fetch_promoted_agent_with_fallback(release_path, '', download_file, 'tmp/repo_configs/el', '8.11.0')
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
it 're-raises non-404 fetch errors without falling back' do
|
|
159
|
+
allow(subject).to receive(:fetch_http_file)
|
|
160
|
+
.with(s3_base, download_file, 'tmp/repo_configs/el')
|
|
161
|
+
.and_raise('Failed to fetch_remote_file (500 Server Error)')
|
|
162
|
+
expect(subject).not_to receive(:fetch_http_file)
|
|
163
|
+
.with(a_string_including('agent-downloads'), anything, anything)
|
|
164
|
+
|
|
165
|
+
expect {
|
|
166
|
+
subject.fetch_promoted_agent_with_fallback(release_path, '', download_file, 'tmp/repo_configs/el', '8.11.0')
|
|
167
|
+
}.to raise_error(/500/)
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
it 'preserves the /windows suffix in the fallback URL' do
|
|
171
|
+
win_file = 'puppet-agent-x64.msi'
|
|
172
|
+
win_release_path = 'https://pm.puppet.com/v2/agent/2023.8.3/8.11.0/repos/windows'
|
|
173
|
+
win_s3_base = "#{s3_base}/windows"
|
|
174
|
+
win_dl_base = "#{agent_dl_base}/windows"
|
|
175
|
+
allow(Net::HTTP).to receive(:start).with('pm.puppet.com')
|
|
176
|
+
.and_return("#{win_s3_base}/#{win_file}")
|
|
177
|
+
allow(subject).to receive(:fetch_http_file)
|
|
178
|
+
.with(win_s3_base, win_file, 'tmp/repo_configs/windows')
|
|
179
|
+
.and_raise("Failed to fetch_remote_file '#{win_s3_base}/#{win_file}' (404 Not Found)")
|
|
180
|
+
expect(subject).to receive(:fetch_http_file)
|
|
181
|
+
.with(win_dl_base, win_file, 'tmp/repo_configs/windows')
|
|
182
|
+
|
|
183
|
+
subject.fetch_promoted_agent_with_fallback(win_release_path, '/windows', win_file, 'tmp/repo_configs/windows', '8.11.0')
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
|
|
109
187
|
context '#prep_host_for_upgrade' do
|
|
110
188
|
|
|
111
189
|
it 'sets per host options before global options' do
|
|
@@ -545,6 +623,35 @@ describe ClassMixedWithDSLInstallUtils do
|
|
|
545
623
|
end
|
|
546
624
|
end
|
|
547
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
|
+
|
|
548
655
|
describe 'install_via_msi?' do
|
|
549
656
|
it 'returns true if pe_version is before PE 2016.4.0' do
|
|
550
657
|
the_host = winhost.dup
|
|
@@ -594,6 +701,71 @@ describe ClassMixedWithDSLInstallUtils do
|
|
|
594
701
|
|
|
595
702
|
end
|
|
596
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
|
+
|
|
597
769
|
describe 'higgs installer' do
|
|
598
770
|
let(:host) { unixhost }
|
|
599
771
|
let(:higgs_regex) { %r{cd .* ; nohup \./puppet-enterprise-installer <<<#{higgs_answer} .*} }
|