kapnismology 1.11.0 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29e92cc0b15350453a3ef92a2fd8299d66a3e3d9
4
- data.tar.gz: b804388fb355e1afb4ccc6e41af8036808eb5e28
3
+ metadata.gz: cc04d3c658e30139dbf0adf893088832ba05706e
4
+ data.tar.gz: a0b1a9b1050c75aa6907b3cf17a63dd63020ee71
5
5
  SHA512:
6
- metadata.gz: 0dda24022b80c738002ced4a8bab8475bf995d015ee07d1f6b6fc5f1a19f7f0414184e3fbbc5055ea4c11c22ee5197a490a83b492d16800f05a485609a6c1124
7
- data.tar.gz: 912eb47c4d383ccffc1c49da32fbb954e57db7c0af55e8ebe70f79144f8669ad6fab1bf7ec37ccb06a5989d7ba7f935bc805e9fee1c43f33a5ec838e8d9896af
6
+ metadata.gz: 571e122ee54a4a433f02afc0c1b1d743d36c2eaada3375774dd454c0b0129826616171dfb1bad8862489bdcea4c26d5fadc2f8fc19e1e8b9d3f8f1d95adf32e9
7
+ data.tar.gz: 126db5d5528ef6b4ec271d63ab5180892db62a7263f9e69b54d6e4d462125d8c77aad047b200c7b38398a99a396456767d2f16dea5115f9c56f94ce4c6da9bad
data/README.md CHANGED
@@ -120,6 +120,20 @@ It will run all your integration tests. You can run it together with your runtim
120
120
  wget http://myservice.com/smoke_test?tags=integration,runtime
121
121
  ```
122
122
 
123
+ ## Timing out
124
+
125
+ Smoke tests will by default time out after 10 seconds. If you need to change this value overwrite the `timeout` method your smoke test class and return a new number (seconds). Returning `0` will prevent the test from timing out.
126
+
127
+ ```Ruby
128
+ class SuperSlowTest < Kapnismology::SmokeTest
129
+ def result
130
+ end
131
+ def self.timeout
132
+ 30
133
+ end
134
+ end
135
+ ```
136
+
123
137
 
124
138
  ## Skipping tests
125
139
 
@@ -12,26 +12,23 @@ module Kapnismology
12
12
  RUNTIME_TAG = 'runtime'.freeze
13
13
  DEFAULT_TAGS = [DEPLOYMENT_TAG, RUNTIME_TAG].freeze
14
14
 
15
- # Default constructor may be overwritten by child class
16
- def initialize
17
- @all_result_messages = []
18
- end
19
-
20
15
  def result
21
16
  end
22
17
 
23
18
  # Internally Kapnismology is calling this method. We are handling exceptions under the hood here
24
19
  def __result__
25
- result_object = result || Result.new(false, {}, 'This test has not returned any result.')
26
- unless result_object.class.ancestors.include?(Kapnismology::BaseResult)
20
+ execution = Timeout::timeout(self.class.timeout) { result }
21
+ result_object = execution || Result.new(false, {}, 'This test has not returned any result')
22
+ unless result_object.class.ancestors.include?(BaseResult)
27
23
  message = "Smoke test #{self.class}, returned #{result_object.class} instead of a Result"
28
24
  result_object = Result.new(false, { returned_class: result_object.class }, message)
29
25
  end
30
26
  rescue Kapnismology::SmokeTestFailed => e
31
27
  result_object = e.result
32
- rescue SmokeTestFailed => e
33
- result_object = e.result
34
- rescue => e
28
+ rescue Timeout::Error => e
29
+ message = "#{self.class} took more than #{self.class.timeout} seconds to finish and timed-out"
30
+ result_object = Result.new(false, { exception: e.class, message: e.message }, message)
31
+ rescue Exception => e # Socket, IO errors inherit from Exception, not StandardError
35
32
  message = "Unrescued error happened in #{self.class}"
36
33
  result_object = Result.new(false, { exception: e.class, message: e.message }, message)
37
34
  ensure
@@ -46,6 +43,10 @@ module Kapnismology
46
43
  def tags
47
44
  DEFAULT_TAGS
48
45
  end
46
+
47
+ def timeout
48
+ 10
49
+ end
49
50
  end
50
51
 
51
52
  protected
@@ -1,3 +1,3 @@
1
1
  module Kapnismology
2
- VERSION = '1.11.0'.freeze
2
+ VERSION = '1.12.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kapnismology
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.0
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordi Polo Carres
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-17 00:00:00.000000000 Z
11
+ date: 2016-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: byebug
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '9.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '9.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: mutant
57
57
  requirement: !ruby/object:Gem::Requirement