beaker-pe 1.38.0 → 1.39.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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27e92eecfdcc213e61799677bec5ed8bd276066e
4
- data.tar.gz: e90e286369a943c793b2dff3b4311ff777b0a252
3
+ metadata.gz: bc167d062d00e928c3edab27aba88917f54740c0
4
+ data.tar.gz: be559e84df01d94b0476d6cd8ffa016f8e9a553e
5
5
  SHA512:
6
- metadata.gz: 5f6106081204c645a007bb513f5e8ead7fe4d163ba532e5c6f0ae5f5d5c04899dae7f38079af907e791bbece8d52ebca6afc8fa84e94cf741f80800de9f464ff
7
- data.tar.gz: 73f71045099372b06f175d014a12b589be56ea93ef2370067daf577bd651232f67c877117e86306db405380b5ff1a6d2385b2b15c080a4c1f1a67302f1b8d292
6
+ metadata.gz: 4be7886aef369fad8961946989a0f62e8de2a27fce265d23067fcaa8226b06b0d6988611e3f8fca5ae4300e76a51f52e7fdd6ea6d560185ace4b2c6c65e26e1d
7
+ data.tar.gz: ad0d95afca16cb36b9d7c492d29d2430ce002d2298cac88d328d107f53542e9cf7359daed05117b4a6d8d777140d77cd0de0dcb7988c23f6532906d66d9982df
@@ -1424,10 +1424,7 @@ module Beaker
1424
1424
  begin
1425
1425
  execute_installer_cmd(master, opts)
1426
1426
  rescue Beaker::Host::CommandFailure => e
1427
- installer_log_dir = '/var/log/puppetlabs/installer'
1428
- latest_installer_log_file = on(master, "ls -1t #{installer_log_dir} | head -n1").stdout.chomp
1429
- #Check the lastest install log to confirm the expected failure is there
1430
- unless on(master, "grep 'The operation could not be completed because RBACs database has not been initialized' #{installer_log_dir}/#{latest_installer_log_file}", :acceptable_exit_codes => [0,1]).exit_code == 0
1427
+ unless is_expected_pe_postgres_failure?(master)
1431
1428
  raise "Install on master failed in an unexpected manner"
1432
1429
  end
1433
1430
  end
@@ -1464,6 +1461,23 @@ module Beaker
1464
1461
  end
1465
1462
  end
1466
1463
 
1464
+ #Check the lastest install log to confirm the expected failure is there
1465
+ def is_expected_pe_postgres_failure?(host)
1466
+ installer_log_dir = '/var/log/puppetlabs/installer'
1467
+ latest_installer_log_file = on(host, "ls -1t #{installer_log_dir} | head -n1").stdout.chomp
1468
+ # As of PE Irving (PE 2018.1.x), these are the only two expected errors
1469
+ allowed_errors = ["The operation could not be completed because RBACs database has not been initialized",
1470
+ "Timeout waiting for the database pool to become ready"]
1471
+
1472
+ allowed_errors.each do |error|
1473
+ if(on(host, "grep '#{error}' #{installer_log_dir}/#{latest_installer_log_file}", :acceptable_exit_codes => [0,1]).exit_code == 0)
1474
+ return true
1475
+ end
1476
+ end
1477
+
1478
+ false
1479
+ end
1480
+
1467
1481
  # Grabs the pe file from a remote host to the machine running Beaker, then
1468
1482
  # scp's the file out to the host.
1469
1483
  #
@@ -3,7 +3,7 @@ module Beaker
3
3
  module PE
4
4
 
5
5
  module Version
6
- STRING = '1.38.0'
6
+ STRING = '1.39.0'
7
7
  end
8
8
 
9
9
  end
@@ -1164,6 +1164,47 @@ describe ClassMixedWithDSLInstallUtils do
1164
1164
  end
1165
1165
  end
1166
1166
 
1167
+ describe 'is_expected_pe_postgres_failure? method' do
1168
+ let(:mono_master) { make_host('mono_master', :pe_ver => '2017.2', :platform => 'ubuntu-16.04-x86_64', :roles => ['master', 'database', 'dashboard']) }
1169
+
1170
+ it 'will return true if it is the RBAC database string matcher' do
1171
+ @installer_log_file_name = Beaker::Result.new( {}, '' )
1172
+ @installer_log_file_name.stdout = "installer_log_name"
1173
+ zero_exit_code_mock = Object.new
1174
+ allow(zero_exit_code_mock).to receive(:exit_code).and_return(0)
1175
+ one_exit_code_mock = Object.new
1176
+ allow(one_exit_code_mock).to receive(:exit_code).and_return(1)
1177
+ allow(subject).to receive(:on).with(mono_master, "ls -1t /var/log/puppetlabs/installer | head -n1").and_return(@installer_log_file_name)
1178
+ 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)
1179
+ 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)
1180
+ expect(subject.is_expected_pe_postgres_failure?(mono_master)). to eq(true)
1181
+ end
1182
+
1183
+ it 'will return true if it is the database pool timeout string matcher' do
1184
+ @installer_log_file_name = Beaker::Result.new( {}, '' )
1185
+ @installer_log_file_name.stdout = "installer_log_name"
1186
+ zero_exit_code_mock = Object.new
1187
+ allow(zero_exit_code_mock).to receive(:exit_code).and_return(0)
1188
+ one_exit_code_mock = Object.new
1189
+ allow(one_exit_code_mock).to receive(:exit_code).and_return(1)
1190
+ allow(subject).to receive(:on).with(mono_master, "ls -1t /var/log/puppetlabs/installer | head -n1").and_return(@installer_log_file_name)
1191
+ 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)
1192
+ 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)
1193
+ expect(subject.is_expected_pe_postgres_failure?(mono_master)). to eq(true)
1194
+ end
1195
+
1196
+ it 'will return false if no error messages are matched' do
1197
+ @installer_log_file_name = Beaker::Result.new( {}, '' )
1198
+ @installer_log_file_name.stdout = "installer_log_name"
1199
+ one_exit_code_mock = Object.new
1200
+ allow(one_exit_code_mock).to receive(:exit_code).and_return(1)
1201
+ allow(subject).to receive(:on).with(mono_master, "ls -1t /var/log/puppetlabs/installer | head -n1").and_return(@installer_log_file_name)
1202
+ 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)
1203
+ 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)
1204
+ expect(subject.is_expected_pe_postgres_failure?(mono_master)). to eq(false)
1205
+ end
1206
+ end
1207
+
1167
1208
  describe 'do_install_pe_with_pe_managed_external_postgres with an agent' do
1168
1209
  let(:mono_master) { make_host('mono_master', :pe_ver => '2017.2', :platform => 'ubuntu-16.04-x86_64', :roles => ['master', 'database', 'dashboard']) }
1169
1210
  let(:pe_postgres) { make_host('pe_postgres', :pe_ver => '2017.2', :platform => 'el-7-x86_64', :roles => ['pe_postgres', 'agent']) }
@@ -1210,14 +1251,7 @@ describe ClassMixedWithDSLInstallUtils do
1210
1251
  #installer command on master is called twice on install
1211
1252
  expect(subject).to receive(:execute_installer_cmd).with(mono_master, {}).and_raise(Beaker::Host::CommandFailure).once.ordered
1212
1253
 
1213
- #Error handling
1214
- @installer_log_file_name = Beaker::Result.new( {}, '' )
1215
- @installer_log_file_name.stdout = "installer_log_name"
1216
- exit_code_mock = Object.new
1217
- allow(exit_code_mock).to receive(:exit_code).and_return( 0 )
1218
- allow(subject).to receive(:on).with(mono_master, "ls -1t /var/log/puppetlabs/installer | head -n1").and_return(@installer_log_file_name)
1219
- 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(exit_code_mock)
1220
-
1254
+ allow(subject).to receive(:is_expected_pe_postgres_failure?).and_return(true)
1221
1255
  allow(subject).to receive(:execute_installer_cmd).with(pe_postgres, {}).once
1222
1256
  expect(subject).to receive(:execute_installer_cmd).with(mono_master, {}).once.ordered
1223
1257
  allow(subject).to receive(:on).with(mono_master, "puppet agent -t", :acceptable_exit_codes=>[0, 2]).exactly(3).times
@@ -1241,14 +1275,7 @@ describe ClassMixedWithDSLInstallUtils do
1241
1275
  allow(subject).to receive(:setup_pe_conf).exactly(2).times
1242
1276
 
1243
1277
  expect(subject).to receive(:execute_installer_cmd).with(mono_master, {}).and_raise(Beaker::Host::CommandFailure).once.ordered
1244
-
1245
- #Error handling
1246
- @installer_log_file_name = Beaker::Result.new( {}, '' )
1247
- @installer_log_file_name.stdout = "installer_log_name"
1248
- exit_code_mock = Object.new
1249
- allow(exit_code_mock).to receive(:exit_code).and_return(1)
1250
- allow(subject).to receive(:on).with(mono_master, "ls -1t /var/log/puppetlabs/installer | head -n1").and_return(@installer_log_file_name)
1251
- 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(exit_code_mock)
1278
+ allow(subject).to receive(:is_expected_pe_postgres_failure?).and_return(false)
1252
1279
 
1253
1280
  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")
1254
1281
  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.38.0
4
+ version: 1.39.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-15 00:00:00.000000000 Z
11
+ date: 2018-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec