beaker-pe 3.6.1 → 3.6.3

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: dfd1d8c42972081bb9b5f9f49d4f1cefd90424a84594dfdf1c96a136fa48d7d8
4
- data.tar.gz: eff2646196013b1cf2ad368e4a5f4ce3fe4c6d5534dcf5425f5024dc1b508b53
3
+ metadata.gz: 03bf3c005114d8ea4bc9e8a2f10b1d25afcd1e3919d09a0a079e925ef35b51ff
4
+ data.tar.gz: c5507077282d107fdab48081b9736fcfb9a9af8ca600faf316e76fc26ba16067
5
5
  SHA512:
6
- metadata.gz: '069a53cb8696fb530fe31c90cb3820408285a56894bfa62c6677dd4ea89a9e183a74dc1f1771bebb14bd1ec43af32457427d6b712eb5a0587a14e9a251df0efe'
7
- data.tar.gz: f3053f4e7d7a3a1aae929b40448e8c60357e814cd8bedc91a3d165d899932410575f11d02c3ca3f6a3ed65d7b95db32292278abcbb7a035ceca0012ac3a16958
6
+ metadata.gz: efb6f1688532acf22b13e6978d4b5cc65df15b2c1e781c886a701deb42206d0985d3bd1af74ddcda09377700777fb83c8278971ef567f682aee71478c278c918
7
+ data.tar.gz: c9a0843cf5ee0dffa774db34b254214ffc0df72bc54bda36afb4ce89650e6060f481729721f43f67bd2396b0700f61f54d92595114b9314c51205a47a5693708
@@ -825,8 +825,10 @@ NOASK
825
825
 
826
826
  install_agents_only_on(agents, opts)
827
827
 
828
+ # waitforlock in case install_agents_only_on triggers a puppet run on the
829
+ # master that is still in progress when we get here
828
830
  step "Run puppet a second time on the primary to populate services.conf (PE-19054)" do
829
- on(master, puppet_agent('-t'), :acceptable_exit_codes => [0,2])
831
+ on(master, puppet_agent("-t #{waitforlock_flag(master)}".rstrip), :acceptable_exit_codes => [0,2])
830
832
  end
831
833
  end
832
834
 
@@ -2082,7 +2084,7 @@ EOM
2082
2084
  execute_installer_cmd(master, opts)
2083
2085
  rescue Beaker::Host::CommandFailure => e
2084
2086
  unless is_expected_pe_postgres_failure?(master)
2085
- raise "Install on master failed in an unexpected manner"
2087
+ raise "Install on master failed in an unexpected manner: #{e.message}"
2086
2088
  end
2087
2089
  end
2088
2090
  end
@@ -2102,9 +2104,11 @@ EOM
2102
2104
  stop_agent_on(pe_infrastructure, :run_in_parallel => true)
2103
2105
  end
2104
2106
 
2107
+ # waitforlock in case stopping the agent run after stopping the agent service
2108
+ # takes a little longer than usual
2105
2109
  step "First puppet run on infrastructure + postgres node" do
2106
2110
  [master, database, dashboard, pe_postgres].uniq.each do |host|
2107
- on host, 'puppet agent -t', :acceptable_exit_codes => [0,2]
2111
+ on host, ["puppet agent -t", waitforlock_flag(host)].reject(&:empty?).join(' '), :acceptable_exit_codes => [0,2]
2108
2112
  end
2109
2113
  end
2110
2114
 
@@ -2112,13 +2116,15 @@ EOM
2112
2116
  install_agents_only_on(non_infrastructure, opts)
2113
2117
 
2114
2118
  step "Run puppet to setup mcollective and pxp-agent" do
2115
- on master, 'puppet agent -t', :acceptable_exit_codes => [0,2]
2119
+ on master, ["puppet agent -t", waitforlock_flag(master)].reject(&:empty?).join(' '), :acceptable_exit_codes => [0,2]
2116
2120
  run_puppet_on_non_infrastructure_nodes(non_infrastructure)
2117
2121
  end
2118
2122
 
2119
2123
  end
2124
+ # waitforlock in case install_agents_only_on triggers a puppet run on the
2125
+ # master that is still in progress when we get here
2120
2126
  step "Run puppet a second time on the primary to populate services.conf (PE-19054)" do
2121
- on master, 'puppet agent -t', :acceptable_exit_codes => [0,2]
2127
+ on master, ["puppet agent -t", waitforlock_flag(master)].reject(&:empty?).join(' '), :acceptable_exit_codes => [0,2]
2122
2128
  end
2123
2129
  end
2124
2130
 
@@ -2126,14 +2132,23 @@ EOM
2126
2132
  def is_expected_pe_postgres_failure?(host)
2127
2133
  installer_log_dir = '/var/log/puppetlabs/installer'
2128
2134
  latest_installer_log_file = on(host, "ls -1t #{installer_log_dir} | head -n1").stdout.chomp
2129
- # As of PE Irving (PE 2018.1.x), these are the only two expected errors
2135
+ # The initial master install pass runs before pe-postgres is fully
2136
+ # up, so it's expected to fail: the RBAC/console database isn't
2137
+ # reachable yet, and depending on timing any core PE service
2138
+ # (pe-console-services, pe-puppetdb, pe-puppetserver, etc.) may
2139
+ # not (re)start before this pass' own timeouts trip. All of these
2140
+ # are recoverable by the later "Install/Upgrade postgres service"
2141
+ # and "Finish install/upgrade" steps, so they shouldn't fail the
2142
+ # test. Match the service-startup failure class generically
2143
+ # rather than enumerating individual services/ports here.
2130
2144
  allowed_errors = ["The operation could not be completed because RBACs database has not been initialized",
2131
2145
  "Timeout waiting for the database pool to become ready",
2132
- "Systemd restart for pe-console-services failed",
2133
- "Execution of.*service pe-console-services.*: Reload timed out after 120 seconds"]
2146
+ "Systemd (start|restart) for pe-\\S+ failed",
2147
+ "Execution of.*service pe-console-services.*: Reload timed out after 120 seconds",
2148
+ "Connection refused"]
2134
2149
 
2135
2150
  allowed_errors.each do |error|
2136
- if(on(host, "grep '#{error}' #{installer_log_dir}/#{latest_installer_log_file}", :acceptable_exit_codes => [0,1]).exit_code == 0)
2151
+ if(on(host, "grep -E '#{error}' #{installer_log_dir}/#{latest_installer_log_file}", :acceptable_exit_codes => [0,1]).exit_code == 0)
2137
2152
  return true
2138
2153
  end
2139
2154
  end
@@ -3,7 +3,7 @@ module Beaker
3
3
  module PE
4
4
 
5
5
  module Version
6
- STRING = '3.6.1'
6
+ STRING = '3.6.3'
7
7
  end
8
8
 
9
9
  end
@@ -1305,76 +1305,61 @@ describe ClassMixedWithDSLInstallUtils do
1305
1305
  describe 'is_expected_pe_postgres_failure? method' do
1306
1306
  let(:mono_master) { make_host('mono_master', :pe_ver => '2017.2', :platform => 'ubuntu-16.04-x86_64', :roles => ['master', 'database', 'dashboard']) }
1307
1307
 
1308
- it 'will return true if it is the RBAC database string matcher' do
1308
+ let(:zero_exit_code_mock) do
1309
+ mock = Object.new
1310
+ allow(mock).to receive(:exit_code).and_return(0)
1311
+ mock
1312
+ end
1313
+ let(:one_exit_code_mock) do
1314
+ mock = Object.new
1315
+ allow(mock).to receive(:exit_code).and_return(1)
1316
+ mock
1317
+ end
1318
+
1319
+ def stub_installer_log_greps(all_but: nil)
1309
1320
  @installer_log_file_name = Beaker::Result.new( {}, '' )
1310
1321
  @installer_log_file_name.stdout = "installer_log_name"
1311
- zero_exit_code_mock = Object.new
1312
- allow(zero_exit_code_mock).to receive(:exit_code).and_return(0)
1313
- one_exit_code_mock = Object.new
1314
- allow(one_exit_code_mock).to receive(:exit_code).and_return(1)
1315
1322
  allow(subject).to receive(:on).with(mono_master, "ls -1t /var/log/puppetlabs/installer | head -n1").and_return(@installer_log_file_name)
1316
- allow(subject).to receive(:on).with(mono_master, "grep 'The operation could not be completed because RBACs database has not been initialized' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(zero_exit_code_mock)
1317
- allow(subject).to receive(:on).with(mono_master, "grep 'Timeout waiting for the database pool to become ready' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(one_exit_code_mock)
1318
- allow(subject).to receive(:on).with(mono_master, "grep 'Systemd restart for pe-console-services failed' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(one_exit_code_mock)
1319
- allow(subject).to receive(:on).with(mono_master, "grep 'Execution of.*service pe-console-services.*: Reload timed out after 120 seconds' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(one_exit_code_mock)
1323
+
1324
+ patterns = ["The operation could not be completed because RBACs database has not been initialized",
1325
+ "Timeout waiting for the database pool to become ready",
1326
+ "Systemd (start|restart) for pe-\\S+ failed",
1327
+ "Execution of.*service pe-console-services.*: Reload timed out after 120 seconds",
1328
+ "Connection refused"]
1329
+
1330
+ patterns.each do |pattern|
1331
+ result = (pattern == all_but) ? zero_exit_code_mock : one_exit_code_mock
1332
+ allow(subject).to receive(:on).with(mono_master, "grep -E '#{pattern}' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(result)
1333
+ end
1334
+ end
1335
+
1336
+ it 'will return true if it is the RBAC database string matcher' do
1337
+ stub_installer_log_greps(all_but: "The operation could not be completed because RBACs database has not been initialized")
1320
1338
  expect(subject.is_expected_pe_postgres_failure?(mono_master)). to eq(true)
1321
1339
  end
1322
1340
 
1323
1341
  it 'will return true if it is the database pool timeout string matcher' do
1324
- @installer_log_file_name = Beaker::Result.new( {}, '' )
1325
- @installer_log_file_name.stdout = "installer_log_name"
1326
- zero_exit_code_mock = Object.new
1327
- allow(zero_exit_code_mock).to receive(:exit_code).and_return(0)
1328
- one_exit_code_mock = Object.new
1329
- allow(one_exit_code_mock).to receive(:exit_code).and_return(1)
1330
- allow(subject).to receive(:on).with(mono_master, "ls -1t /var/log/puppetlabs/installer | head -n1").and_return(@installer_log_file_name)
1331
- allow(subject).to receive(:on).with(mono_master, "grep 'The operation could not be completed because RBACs database has not been initialized' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(one_exit_code_mock)
1332
- allow(subject).to receive(:on).with(mono_master, "grep 'Timeout waiting for the database pool to become ready' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(zero_exit_code_mock)
1333
- allow(subject).to receive(:on).with(mono_master, "grep 'Systemd restart for pe-console-services failed' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(one_exit_code_mock)
1334
- allow(subject).to receive(:on).with(mono_master, "grep 'Execution of.*service pe-console-services.*: Reload timed out after 120 seconds' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(one_exit_code_mock)
1342
+ stub_installer_log_greps(all_but: "Timeout waiting for the database pool to become ready")
1335
1343
  expect(subject.is_expected_pe_postgres_failure?(mono_master)). to eq(true)
1336
1344
  end
1337
1345
 
1338
- it 'will return true if it is the systemd restart of cosnole-services failure matcher' do
1339
- @installer_log_file_name = Beaker::Result.new( {}, '' )
1340
- @installer_log_file_name.stdout = "installer_log_name"
1341
- zero_exit_code_mock = Object.new
1342
- allow(zero_exit_code_mock).to receive(:exit_code).and_return(0)
1343
- one_exit_code_mock = Object.new
1344
- allow(one_exit_code_mock).to receive(:exit_code).and_return(1)
1345
- allow(subject).to receive(:on).with(mono_master, "ls -1t /var/log/puppetlabs/installer | head -n1").and_return(@installer_log_file_name)
1346
- allow(subject).to receive(:on).with(mono_master, "grep 'The operation could not be completed because RBACs database has not been initialized' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(one_exit_code_mock)
1347
- allow(subject).to receive(:on).with(mono_master, "grep 'Timeout waiting for the database pool to become ready' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(one_exit_code_mock)
1348
- allow(subject).to receive(:on).with(mono_master, "grep 'Systemd restart for pe-console-services failed' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(zero_exit_code_mock)
1349
- allow(subject).to receive(:on).with(mono_master, "grep 'Execution of.*service pe-console-services.*: Reload timed out after 120 seconds' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(one_exit_code_mock)
1346
+ it 'will return true if it is the systemd start/restart of a pe-* service failure matcher (e.g. pe-console-services, pe-puppetdb, pe-puppetserver)' do
1347
+ stub_installer_log_greps(all_but: "Systemd (start|restart) for pe-\\S+ failed")
1350
1348
  expect(subject.is_expected_pe_postgres_failure?(mono_master)). to eq(true)
1351
1349
  end
1352
1350
 
1353
1351
  it 'will return true if it is the console-services reload timeout string matcher' do
1354
- @installer_log_file_name = Beaker::Result.new( {}, '' )
1355
- @installer_log_file_name.stdout = "installer_log_name"
1356
- zero_exit_code_mock = Object.new
1357
- allow(zero_exit_code_mock).to receive(:exit_code).and_return(0)
1358
- one_exit_code_mock = Object.new
1359
- allow(one_exit_code_mock).to receive(:exit_code).and_return(1)
1360
- allow(subject).to receive(:on).with(mono_master, "ls -1t /var/log/puppetlabs/installer | head -n1").and_return(@installer_log_file_name)
1361
- allow(subject).to receive(:on).with(mono_master, "grep 'The operation could not be completed because RBACs database has not been initialized' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(one_exit_code_mock)
1362
- allow(subject).to receive(:on).with(mono_master, "grep 'Timeout waiting for the database pool to become ready' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(one_exit_code_mock)
1363
- allow(subject).to receive(:on).with(mono_master, "grep 'Systemd restart for pe-console-services failed' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(one_exit_code_mock)
1364
- allow(subject).to receive(:on).with(mono_master, "grep 'Execution of.*service pe-console-services.*: Reload timed out after 120 seconds' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(zero_exit_code_mock)
1352
+ stub_installer_log_greps(all_but: "Execution of.*service pe-console-services.*: Reload timed out after 120 seconds")
1353
+ expect(subject.is_expected_pe_postgres_failure?(mono_master)). to eq(true)
1354
+ end
1355
+
1356
+ it 'will return true if it is the connection refused matcher' do
1357
+ stub_installer_log_greps(all_but: "Connection refused")
1365
1358
  expect(subject.is_expected_pe_postgres_failure?(mono_master)). to eq(true)
1366
1359
  end
1367
1360
 
1368
1361
  it 'will return false if no error messages are matched' do
1369
- @installer_log_file_name = Beaker::Result.new( {}, '' )
1370
- @installer_log_file_name.stdout = "installer_log_name"
1371
- one_exit_code_mock = Object.new
1372
- allow(one_exit_code_mock).to receive(:exit_code).and_return(1)
1373
- allow(subject).to receive(:on).with(mono_master, "ls -1t /var/log/puppetlabs/installer | head -n1").and_return(@installer_log_file_name)
1374
- allow(subject).to receive(:on).with(mono_master, "grep 'The operation could not be completed because RBACs database has not been initialized' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(one_exit_code_mock)
1375
- allow(subject).to receive(:on).with(mono_master, "grep 'Timeout waiting for the database pool to become ready' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(one_exit_code_mock)
1376
- allow(subject).to receive(:on).with(mono_master, "grep 'Systemd restart for pe-console-services failed' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(one_exit_code_mock)
1377
- allow(subject).to receive(:on).with(mono_master, "grep 'Execution of.*service pe-console-services.*: Reload timed out after 120 seconds' /var/log/puppetlabs/installer/installer_log_name", :acceptable_exit_codes=>[0, 1]).and_return(one_exit_code_mock)
1362
+ stub_installer_log_greps
1378
1363
  expect(subject.is_expected_pe_postgres_failure?(mono_master)). to eq(false)
1379
1364
  end
1380
1365
  end
@@ -1458,7 +1443,7 @@ describe ClassMixedWithDSLInstallUtils do
1458
1443
  expect(subject).to receive(:execute_installer_cmd).with(mono_master, {}).and_raise(Beaker::Host::CommandFailure).once.ordered
1459
1444
  allow(subject).to receive(:is_expected_pe_postgres_failure?).and_return(false)
1460
1445
 
1461
- expect{ subject.do_install_pe_with_pe_managed_external_postgres([mono_master, pe_postgres, agent], {}) }.to raise_error(RuntimeError, "Install on master failed in an unexpected manner")
1446
+ expect{ subject.do_install_pe_with_pe_managed_external_postgres([mono_master, pe_postgres, agent], {}) }.to raise_error(RuntimeError, /\AInstall on master failed in an unexpected manner: /)
1462
1447
  end
1463
1448
 
1464
1449
  it 'will do a monolithic upgrade of PE with an external postgres that is managed by PE' do
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.1
4
+ version: 3.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
@@ -320,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
320
320
  - !ruby/object:Gem::Version
321
321
  version: '0'
322
322
  requirements: []
323
- rubygems_version: 3.6.9
323
+ rubygems_version: 4.0.16
324
324
  specification_version: 4
325
325
  summary: Beaker PE DSL Helpers!
326
326
  test_files: []