minitest_rollbar 0.3.3 → 1.0.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
- SHA1:
3
- metadata.gz: 32ce6e93eae1a3574774ebb77611485bf366e6d7
4
- data.tar.gz: f3ebec98ec6b0d9e91908fb1b172191d4b79c352
2
+ SHA256:
3
+ metadata.gz: c9610c9e587b99d002297b5a35cd47ff746b26918fe284ace66c5ea3ac711f76
4
+ data.tar.gz: 78cc79d7cbd79c6a03d87e73ea5070d3c8a675e4d45805b9c75957fa6cce8a92
5
5
  SHA512:
6
- metadata.gz: e25c6103a31fb6263fac2f80e0be6b5c101c7ecd695c89dcfbd09f5702be15e75f3ed2719ef4608c64e3bcc4fb09c12dddf7397ddcc170bea1ed46a02e833a04
7
- data.tar.gz: d65d445cd3b9f57b9fc5a5a5d6a5a020bd3e05009d5624fc21e026bb56d9d5c33d56d56f3b176a289dd733c6fb788c1c3893c007433a63d43838de728b17eed4
6
+ metadata.gz: f59643be2d588a7466b40cd5a8afc68cda0701ebc05477af027c0387610542e17919c2c6f6f9d8d056f386d7db19791fca7fffe138987706dbea83fe8257d264
7
+ data.tar.gz: 35a5a643b94a4809ae4dd71bc9f779d2f855e22c8d5110632d954ec46b44f97bb773623f5b0ff7163b032b2eca5f2fe46c9f68249534f524d9dc0c07835b20cc
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org' do
4
+ gem 'appraisal', '>= 2.3', '< 3'
5
+ gem 'bundler', '>= 1.17.3', '< 3'
6
+ gem 'minitest', '>= 5.8', '< 6'
7
+ gem 'mocha', '>= 1.11', '< 2'
8
+ gem 'rake', '>= 13', '< 14'
9
+ gem 'rubocop', '>= 0.91', '< 1'
10
+ gem 'rubocop-minitest', '>= 0.10', '< 1'
11
+ gem 'simplecov', '>= 0.18', '< 1', group: :test, require: false
12
+ end
13
+
14
+ gemspec
@@ -1,22 +1,20 @@
1
- Copyright (c) 2016, AppFolio, Inc.
2
- All rights reserved.
1
+ Copyright (c) 2016-2020 AppFolio inc
3
2
 
4
- Redistribution and use in source and binary forms, with or without
5
- modification, are permitted provided that the following conditions are met:
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
6
10
 
7
- 1. Redistributions of source code must retain the above copyright notice, this
8
- list of conditions and the following disclaimer.
9
- 2. Redistributions in binary form must reproduce the above copyright notice,
10
- this list of conditions and the following disclaimer in the documentation
11
- and/or other materials provided with the distribution.
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
12
13
 
13
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
17
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
20
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,42 +1,52 @@
1
- # Minitest-rollbar
1
+ # MinitestRollbar
2
2
 
3
- Minitest-rollbar is a gem to log test exceptions to rollbar. This is useful in
4
- a CI environment to gather statistics on common exceptions that could indicate
5
- infrastructer related issues.
3
+ minitest_rollbar is a gem to log test exceptions to rollbar. This is useful in a CI environment to gather statistics on
4
+ common exceptions that could indicate infrastructer related issues.
6
5
 
7
6
  ## Installation
8
7
 
9
8
  Add this line to your application's Gemfile:
10
9
 
11
10
  ```ruby
12
- gem 'minitest_rollbar'
11
+ gem 'minitest_rollbar'
13
12
  ```
14
13
 
15
14
  And then execute:
16
15
 
17
- $ bundle
16
+ ```bash
17
+ $ bundle install
18
+ ```
18
19
 
19
20
  Or install it yourself as:
20
21
 
21
- $ gem install minitest_rollbar
22
+ ```bash
23
+ $ gem install minitest_rollbar
24
+ ```
22
25
 
23
26
  ## Usage
24
27
 
25
- Require necessary files on test_helper:
28
+ Require necessary files in the test_helper:
26
29
 
27
- require 'minitest_rollbar'
30
+ ```ruby
31
+ require 'minitest_rollbar'
32
+ ```
28
33
 
29
34
  Get a reporter with access_token and ssl policy using:
30
35
 
31
- @reporter = MinitestRollbar::RollbarReporter.new(rollbar_config: {verify_ssl_peer: false, access_token: 'whatever'})
32
-
33
- By default we try to group occurrence by string returned by exception.inspect (Concatenate exception class name and message). We generate a fingerprint for that. To use rollbar's [default](https://rollbar.com/docs/grouping-algorithm/) default grouping algorithm, do
36
+ ```ruby
37
+ MinitestRollbar::RollbarReporter.new(rollbar_config: { verify_ssl_peer: false, access_token: 'whatever' })
38
+ ```
34
39
 
35
- MinitestRollbar.use_default_grouping = true
40
+ By default, occurrences are grouped by string and returned by exception.inspect (Concatenate exception class name and
41
+ message). We generate a fingerprint for that. To use rollbar's [default](https://rollbar.com/docs/grouping-algorithm/)
42
+ grouping algorithm use:
36
43
 
44
+ ```ruby
45
+ MinitestRollbar.use_default_grouping = true
46
+ ```
37
47
 
38
48
  ## License
39
49
 
40
- This gem is available under the Simplified BSD License.
50
+ This gem is available under the MIT License.
41
51
 
42
- * Copyright (c), 2016, AppFolio, Inc.
52
+ * Copyright (c), 2016-2020, AppFolio, Inc.
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler'
4
+
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ warn e.message
9
+ warn 'Run `bundle install` to install missing gems'
10
+ exit e.status_code
11
+ end
12
+
13
+ require 'rake/testtask'
14
+
15
+ Rake::TestTask.new(:test) do |test|
16
+ test.libs << 'test'
17
+ test.pattern = 'test/**/*_test.rb'
18
+ test.verbose = true
19
+ end
20
+
21
+ task default: :test
@@ -1,2 +1,8 @@
1
- require 'minitest_rollbar/reporters'
2
- require 'minitest_rollbar/version'
1
+ # frozen_string_literal: true
2
+
3
+ require 'rollbar'
4
+ require 'minitest/reporters'
5
+
6
+ module MinitestRollbar
7
+ autoload :RollbarReporter, 'minitest_rollbar/rollbar_reporter'
8
+ end
@@ -1,13 +1,14 @@
1
- require 'rollbar'
2
- require 'minitest/reporters'
3
- module MinitestRollbar
1
+ # frozen_string_literal: true
4
2
 
3
+ module MinitestRollbar
5
4
  class RollbarReporter < Minitest::Reporters::BaseReporter
6
-
7
5
  attr_accessor :use_default_grouping
8
6
 
9
7
  def initialize(options = {})
10
8
  @rollbar_config = options.delete(:rollbar_config) || {}
9
+
10
+ raise StandardError.new('Must set rollbar access token') if @rollbar_config[:access_token].nil?
11
+
11
12
  super(options)
12
13
 
13
14
  @sequential_exception_count = 0
@@ -17,27 +18,24 @@ module MinitestRollbar
17
18
 
18
19
  # Rollbar global setting, notifier instance won't report if this is not set
19
20
  Rollbar.configuration.enabled = true
20
-
21
- raise 'Must set rollbar access token' if @rollbar_config[:access_token].nil?
22
21
  end
23
22
 
24
23
  def record(result)
25
24
  super
26
25
  if result.error?
27
26
  current_exception = result.failure.exception
28
- current_exception_inspect_result = current_exception.inspect
29
27
 
30
28
  if @previous_exception_inspect_result.nil?
31
29
  record_new_error(current_exception)
32
- elsif current_exception_inspect_result == @previous_exception_inspect_result
30
+ elsif current_exception.inspect == @previous_exception_inspect_result
33
31
  increment_error_counting
34
32
  else # New exception
35
- report_error_to_rollbar notifier
33
+ report_error_to_rollbar(notifier)
36
34
  record_new_error current_exception
37
35
  end
38
36
  else
39
37
  unless @previous_exception.nil?
40
- report_error_to_rollbar notifier
38
+ report_error_to_rollbar(notifier)
41
39
  reset_error_counting
42
40
  end
43
41
  end
@@ -45,8 +43,8 @@ module MinitestRollbar
45
43
 
46
44
  def report
47
45
  super
48
- if @sequential_exception_count > 0
49
- report_error_to_rollbar notifier
46
+ if @sequential_exception_count.positive?
47
+ report_error_to_rollbar(notifier)
50
48
  reset_error_counting
51
49
  end
52
50
  end
@@ -54,23 +52,30 @@ module MinitestRollbar
54
52
  private
55
53
 
56
54
  def git_commit_hash
57
- ENV['BUILD_VCS_NUMBER']
55
+ ENV['CIRCLE_SHA1']
58
56
  end
59
57
 
60
58
  def build_config_name
61
- ENV['TEAMCITY_BUILDCONF_NAME']
59
+ ENV['CIRCLE_JOB']
62
60
  end
63
61
 
64
62
  def notifier
65
- if @use_default_grouping
66
- @notifier = Rollbar.scope({environment: 'PossibleInfraFlaky',count: @sequential_exception_count, commit_hash: git_commit_hash, build_config: build_config_name})
67
- else
68
- @notifier = Rollbar.scope({environment: 'PossibleInfraFlaky',count: @sequential_exception_count, commit_hash: git_commit_hash, build_config: build_config_name, fingerprint: @previous_exception_inspect_result})
69
- end
70
- @rollbar_config.each do |key,value|
71
- @notifier.configuration.send("#{key}=", value)
72
- end
73
- @notifier
63
+ scope.merge!(fingerprint: @previous_exception_inspect_result) unless @use_default_grouping
64
+
65
+ rollbar_notifier = Rollbar.scope(scope)
66
+
67
+ @rollbar_config.each { |key, value| rollbar_notifier.configuration.send("#{key}=", value) }
68
+
69
+ rollbar_notifier
70
+ end
71
+
72
+ def scope
73
+ @scope ||= {
74
+ environment: 'PossibleInfraFlaky',
75
+ count: @sequential_exception_count,
76
+ commit_hash: git_commit_hash,
77
+ build_config: build_config_name
78
+ }
74
79
  end
75
80
 
76
81
  def report_error_to_rollbar(notifier)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module MinitestRollbar
2
- VERSION = '0.3.3'.freeze
4
+ VERSION = '1.0.0'
3
5
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/minitest_rollbar/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'minitest_rollbar'
7
+ spec.version = MinitestRollbar::VERSION
8
+ spec.platform = Gem::Platform::RUBY
9
+ spec.authors = ['AppFolio']
10
+ spec.email = ['dev@appfolio.com']
11
+ spec.summary = 'A minitest reporter that logs test exceptions to Rollbar.'
12
+ spec.description = spec.summary
13
+ spec.homepage = 'https://github.com/appfolio/minitest_rollbar'
14
+ spec.licenses = ['MIT']
15
+ spec.files = Dir['**/*'].select { |f| f[%r{^(lib/|Gemfile$|Rakefile|LICENSE.*|README.*|.*gemspec)}] }
16
+ spec.test_files = spec.files.grep(%r{^(test)/})
17
+ spec.require_paths = ['lib']
18
+
19
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
20
+
21
+ spec.add_dependency('minitest-reporters', ['>= 1', '< 2'])
22
+ spec.add_dependency('rollbar', ['>= 2', '< 4'])
23
+ end
metadata CHANGED
@@ -1,88 +1,76 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest_rollbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - Yuesong Wang
8
- autorequire:
7
+ - AppFolio
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-26 00:00:00.000000000 Z
11
+ date: 2020-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: minitest-reporters
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.12'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
17
+ - - ">="
25
18
  - !ruby/object:Gem::Version
26
- version: '1.12'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
19
+ version: '1'
20
+ - - "<"
32
21
  - !ruby/object:Gem::Version
33
- version: '10.0'
34
- type: :development
22
+ version: '2'
23
+ type: :runtime
35
24
  prerelease: false
36
25
  version_requirements: !ruby/object:Gem::Requirement
37
26
  requirements:
38
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '1'
30
+ - - "<"
39
31
  - !ruby/object:Gem::Version
40
- version: '10.0'
32
+ version: '2'
41
33
  - !ruby/object:Gem::Dependency
42
34
  name: rollbar
43
35
  requirement: !ruby/object:Gem::Requirement
44
36
  requirements:
45
- - - "~>"
37
+ - - ">="
46
38
  - !ruby/object:Gem::Version
47
- version: '2.0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '2.0'
55
- - !ruby/object:Gem::Dependency
56
- name: minitest-reporters
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
39
+ version: '2'
40
+ - - "<"
60
41
  - !ruby/object:Gem::Version
61
- version: '1.0'
42
+ version: '4'
62
43
  type: :runtime
63
44
  prerelease: false
64
45
  version_requirements: !ruby/object:Gem::Requirement
65
46
  requirements:
66
- - - "~>"
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '2'
50
+ - - "<"
67
51
  - !ruby/object:Gem::Version
68
- version: '1.0'
69
- description:
52
+ version: '4'
53
+ description: A minitest reporter that logs test exceptions to Rollbar.
70
54
  email:
71
- - wangyuesong0@qq.com
55
+ - dev@appfolio.com
72
56
  executables: []
73
57
  extensions: []
74
58
  extra_rdoc_files: []
75
59
  files:
60
+ - Gemfile
76
61
  - LICENSE.txt
77
62
  - README.md
63
+ - Rakefile
78
64
  - lib/minitest_rollbar.rb
79
- - lib/minitest_rollbar/reporters.rb
65
+ - lib/minitest_rollbar/rollbar_reporter.rb
80
66
  - lib/minitest_rollbar/version.rb
81
- homepage: https://github.com/appfolio/minitest-rollbar
67
+ - minitest_rollbar.gemspec
68
+ homepage: https://github.com/appfolio/minitest_rollbar
82
69
  licenses:
83
- - BSD-2-Clause
84
- metadata: {}
85
- post_install_message:
70
+ - MIT
71
+ metadata:
72
+ allowed_push_host: https://rubygems.org
73
+ post_install_message:
86
74
  rdoc_options: []
87
75
  require_paths:
88
76
  - lib
@@ -97,9 +85,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
85
  - !ruby/object:Gem::Version
98
86
  version: '0'
99
87
  requirements: []
100
- rubyforge_project:
101
- rubygems_version: 2.6.6
102
- signing_key:
88
+ rubygems_version: 3.1.2
89
+ signing_key:
103
90
  specification_version: 4
104
- summary: A minitest reporter that logs testexceptions to Rollbar.
91
+ summary: A minitest reporter that logs test exceptions to Rollbar.
105
92
  test_files: []