beaker-pe 0.9.0 → 0.10.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
- NmJmY2Y3NDAxYjE4YTMwNDM3ZjE3YjczMmRjYWNhMDBkNzI3OGVmMA==
4
+ NWFhYmVkMTkzMDUwYzk2YTljYTcwNDY4ZDllMjkyYzE4Mjc0MWFmNw==
5
5
  data.tar.gz: !binary |-
6
- ODQ2Yjc1ZjA4YjdiZGIwZDRiZmM2OWM4ZjAzZGFmMTQ4YTg5ZTc0YQ==
6
+ MGFhYjc2NjFhOWRjYjJmYTBmOWFlYWJkYTNjYTNlNzQ5ZjVkM2MyZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTA5MjVlZjIzOWZhMDhjYzhkNWJmN2I1NGZlMDE3MDAwYjViODY2Yzg1YThl
10
- OWUxOGUzYTE0YjBjNDgxNjc5MDJkNjFlNTQ5OGE5YTBjZTM0ZWNlYWQ4MDI1
11
- MTE4NDgwMmZmYzEyOTY2NWMyOWY0NWUyNWUxZTE2ODNlYTlmN2M=
9
+ YWRjNTZiMGMxMWU3ODFkNGU5NzkwMGNiM2Q4NWU3N2NiYzk0OWEyY2YzMWIy
10
+ NGIxODI5YzVhYzdjOTBmZThiM2JkNmIwNmMwYWQyZmI5MWYxY2UzYWY2Y2Rk
11
+ ZTMxMDBkNzM5NmM0NWEyNTY1NzA1YzU1Y2Y4YzJiMzhkMjZmMTQ=
12
12
  data.tar.gz: !binary |-
13
- ZTFlNzRiNWE4MDczNzg5ODg3ZGJjNWFlMjIyZjFiZDA2ZTc5ZmViMmFkYzY2
14
- YWI0MDMzYzAxNGFiZjc1ZGY0NDI0YjgxOWYwZDVkMTIwMjNlYTEzZmRkOWYx
15
- NjU1MzVlYWJjOTVkNjY0ZDk5MDA2NWIzM2EyNDBlMzFkZTYzM2Y=
13
+ YzRkZjhjYWQwZmQ0NzVkMmRjZmRhOGQwNDE2YzM2MzkxMjhiMTI2OGY3ZjY0
14
+ N2RiOTgxZjI3YTlmNWI2NDUwZjBmNzFmZjAwMzc0ZGQyMWMyZWE5YjVhMzNk
15
+ MTA4NDlkY2Y3ZDJiMGQ1N2U1N2I2YmI5ZTM0YjdhMzQ2MGNhYzc=
data/HISTORY.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # default - History
2
2
  ## Tags
3
- * [LATEST - 15 Aug, 2016 (01d03513)](#LATEST)
3
+ * [LATEST - 23 Aug, 2016 (1c8df4c3)](#LATEST)
4
+ * [0.9.0 - 15 Aug, 2016 (e29ed491)](#0.9.0)
4
5
  * [0.8.0 - 2 Aug, 2016 (b40f583b)](#0.8.0)
5
6
  * [0.7.0 - 19 Jul, 2016 (8256c0ac)](#0.7.0)
6
7
  * [0.6.0 - 11 Jul, 2016 (e974e7f8)](#0.6.0)
@@ -13,7 +14,23 @@
13
14
  * [0.1.0 - 29 Feb, 2016 (4fc88d8c)](#0.1.0)
14
15
 
15
16
  ## Details
16
- ### <a name = "LATEST">LATEST - 15 Aug, 2016 (01d03513)
17
+ ### <a name = "LATEST">LATEST - 23 Aug, 2016 (1c8df4c3)
18
+
19
+ * (GEM) update beaker-pe version to 0.10.0 (1c8df4c3)
20
+
21
+ * (BKR-908) added attempts config to console status check (#22) (d5e711de)
22
+
23
+
24
+ ```
25
+ (BKR-908) added attempts config to console status check (#22)
26
+
27
+ * (BKR-908) added attempts config to console status check
28
+
29
+ * (BKR-908) handle JSON::ParserError case
30
+ ```
31
+ ### <a name = "0.9.0">0.9.0 - 15 Aug, 2016 (e29ed491)
32
+
33
+ * (HISTORY) update beaker-pe history for gem release 0.9.0 (e29ed491)
17
34
 
18
35
  * (GEM) update beaker-pe version to 0.9.0 (01d03513)
19
36
 
@@ -702,23 +702,34 @@ module Beaker
702
702
  fail_test "PuppetDB took too long to start"
703
703
  end
704
704
 
705
+ # Checks Console Status Endpoint, failing the test if the
706
+ # endpoints don't report a running state.
707
+ #
708
+ # @param [Host] host Host to check status on
709
+ #
710
+ # @note Uses the global option's :pe_console_status_attempts
711
+ # value to determine how many times it's going to retry the
712
+ # check with fibonacci back offs.
713
+ #
714
+ # @return nil
705
715
  def check_console_status_endpoint(host)
706
- if version_is_less(host['pe_ver'], '2015.2.0')
707
- return true
708
- end
709
- Timeout.timeout(60) do
710
- match = nil
711
- while not match
716
+ return true if version_is_less(host['pe_ver'], '2015.2.0')
717
+
718
+ attempts_limit = @options[:pe_console_status_attempts] || 9
719
+ step 'Check Console Status Endpoint' do
720
+ match = repeat_fibonacci_style_for(attempts_limit) do
712
721
  output = on(host, "curl -s -k https://localhost:4433/status/v1/services --cert /etc/puppetlabs/puppet/ssl/certs/#{host}.pem --key /etc/puppetlabs/puppet/ssl/private_keys/#{host}.pem --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem", :accept_all_exit_codes => true)
713
- output = JSON.parse(output.stdout)
714
- match = output['classifier-service']['state'] == 'running'
715
- match = match && output['rbac-service']['state'] == 'running'
716
- match = match && output['activity-service']['state'] == 'running'
717
- sleep 1
722
+ begin
723
+ output = JSON.parse(output.stdout)
724
+ match = output['classifier-service']['state'] == 'running'
725
+ match = match && output['rbac-service']['state'] == 'running'
726
+ match && output['activity-service']['state'] == 'running'
727
+ rescue JSON::ParserError
728
+ false
729
+ end
718
730
  end
731
+ fail_test 'Console services took too long to start' if !match
719
732
  end
720
- rescue Timeout::Error
721
- fail_test "Console services took too long to start"
722
733
  end
723
734
 
724
735
  #Install PE based upon host configuration and options
@@ -3,7 +3,7 @@ module Beaker
3
3
  module PE
4
4
 
5
5
  module Version
6
- STRING = '0.9.0'
6
+ STRING = '0.10.0'
7
7
  end
8
8
 
9
9
  end
@@ -1202,4 +1202,65 @@ describe ClassMixedWithDSLInstallUtils do
1202
1202
  end
1203
1203
  end
1204
1204
 
1205
+ describe '#check_console_status_endpoint' do
1206
+
1207
+ it 'does not do anything if version is less than 2015.2.0' do
1208
+ allow(subject).to receive(:version_is_less).and_return(true)
1209
+
1210
+ global_options = subject.instance_variable_get(:@options)
1211
+ expect(global_options).not_to receive(:[]).with(:pe_console_status_attempts)
1212
+ subject.check_console_status_endpoint({})
1213
+ end
1214
+
1215
+ it 'allows the number of attempts to be configured via the global options' do
1216
+ attempts = 37819
1217
+ options = {:pe_console_status_attempts => attempts}
1218
+ subject.instance_variable_set(:@options, options)
1219
+ allow(subject).to receive(:version_is_less).and_return(false)
1220
+ allow(subject).to receive(:fail_test)
1221
+
1222
+ expect(subject).to receive(:repeat_fibonacci_style_for).with(attempts)
1223
+ subject.check_console_status_endpoint({})
1224
+ end
1225
+
1226
+ it 'yields false to repeat_fibonacci_style_for when conditions are not true' do
1227
+ subject.instance_variable_set(:@options, {})
1228
+ allow(subject).to receive(:version_is_less).and_return(false)
1229
+ allow(subject).to receive(:sleep)
1230
+
1231
+ output_hash = {
1232
+ 'classifier-service' => {}
1233
+ }
1234
+ output_stub = Object.new
1235
+ allow(output_stub).to receive(:stdout)
1236
+ expect(subject).to receive(:on).exactly(9).times.and_return(output_stub)
1237
+ allow(JSON).to receive(:parse).and_return(output_hash)
1238
+ allow(subject).to receive(:fail_test)
1239
+ subject.check_console_status_endpoint({})
1240
+ end
1241
+
1242
+ it 'yields false to repeat_fibonacci_style_for when JSON::ParserError occurs' do
1243
+ subject.instance_variable_set(:@options, {})
1244
+ allow(subject).to receive(:version_is_less).and_return(false)
1245
+ allow(subject).to receive(:sleep)
1246
+
1247
+ output_stub = Object.new
1248
+ # empty string causes JSON::ParserError
1249
+ allow(output_stub).to receive(:stdout).and_return('')
1250
+ expect(subject).to receive(:on).exactly(9).times.and_return(output_stub)
1251
+ allow(subject).to receive(:fail_test)
1252
+ subject.check_console_status_endpoint({})
1253
+ end
1254
+
1255
+ it 'calls fail_test when no checks pass' do
1256
+ subject.instance_variable_set(:@options, {})
1257
+ allow(subject).to receive(:version_is_less).and_return(false)
1258
+
1259
+ allow(subject).to receive(:repeat_fibonacci_style_for).and_return(false)
1260
+ expect(subject).to receive(:fail_test)
1261
+ subject.check_console_status_endpoint({})
1262
+ end
1263
+
1264
+ end
1265
+
1205
1266
  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: 0.9.0
4
+ version: 0.10.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-08-15 00:00:00.000000000 Z
11
+ date: 2016-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec