bugsnag 6.12.0 → 6.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.buildkite/pipeline.yml +470 -0
- data/.rubocop.yml +55 -0
- data/.rubocop_todo.yml +530 -160
- data/CHANGELOG.md +67 -0
- data/CONTRIBUTING.md +1 -9
- data/Gemfile +14 -7
- data/TESTING.md +81 -0
- data/VERSION +1 -1
- data/docker-compose.yml +46 -0
- data/dockerfiles/Dockerfile.jruby-unit-tests +13 -0
- data/dockerfiles/Dockerfile.ruby-maze-runner +26 -0
- data/dockerfiles/Dockerfile.ruby-unit-tests +12 -0
- data/features/delayed_job.feature +6 -22
- data/features/fixtures/delayed_job/Dockerfile +2 -4
- data/features/fixtures/delayed_job/app/Gemfile +1 -1
- data/features/fixtures/delayed_job/app/Rakefile +18 -0
- data/features/fixtures/docker-compose.yml +28 -40
- data/features/fixtures/expected_breadcrumbs/active_job.json +9 -0
- data/features/fixtures/expected_breadcrumbs/mongo_failed.json +15 -0
- data/features/fixtures/expected_breadcrumbs/mongo_filtered_request.json +15 -0
- data/features/fixtures/expected_breadcrumbs/mongo_filtered_result.json +15 -0
- data/features/fixtures/expected_breadcrumbs/mongo_success.json +14 -0
- data/features/fixtures/expected_breadcrumbs/request.json +13 -0
- data/features/fixtures/expected_breadcrumbs/sql_with_bindings.json +12 -0
- data/features/fixtures/expected_breadcrumbs/sql_without_bindings.json +11 -0
- data/features/fixtures/plain/Dockerfile +2 -2
- data/features/fixtures/plain/app/app.rb +1 -3
- data/features/fixtures/plain/app/delivery/fork_threadpool.rb +3 -1
- data/features/fixtures/plain/app/unhandled/{Interrupt.rb → interrupt.rb} +0 -0
- data/features/fixtures/rack1/Dockerfile +2 -2
- data/features/fixtures/rack2/Dockerfile +2 -2
- data/features/fixtures/rails3/Dockerfile +2 -2
- data/features/fixtures/rails3/app/Gemfile +4 -0
- data/features/fixtures/rails3/app/config/initializers/bugsnag.rb +3 -2
- data/features/fixtures/rails4/Dockerfile +2 -5
- data/features/fixtures/rails4/app/config/initializers/bugsnag.rb +2 -1
- data/features/fixtures/rails5/Dockerfile +2 -2
- data/features/fixtures/rails5/app/Gemfile +3 -2
- data/features/fixtures/rails5/app/config/initializers/bugsnag.rb +2 -1
- data/features/fixtures/rails6/Dockerfile +2 -2
- data/features/fixtures/rails6/app/Gemfile +3 -2
- data/features/fixtures/rails6/app/app/controllers/mongo_controller.rb +22 -0
- data/features/fixtures/rails6/app/app/models/mongo_model.rb +6 -0
- data/features/fixtures/rails6/app/config/environments/development.rb +2 -0
- data/features/fixtures/rails6/app/config/environments/production.rb +1 -0
- data/features/fixtures/rails6/app/config/environments/rails_env.rb +1 -0
- data/features/fixtures/rails6/app/config/environments/test.rb +1 -0
- data/features/fixtures/rails6/app/config/initializers/bugsnag.rb +2 -1
- data/features/fixtures/rails6/app/config/mongoid.yml +23 -0
- data/features/fixtures/rails6/app/config/routes.rb +4 -0
- data/features/fixtures/resque/Dockerfile +2 -2
- data/features/fixtures/sidekiq/Dockerfile +5 -7
- data/features/fixtures/sidekiq/app/Gemfile +2 -1
- data/features/fixtures/sidekiq/app/Rakefile.rb +14 -0
- data/features/fixtures/sinatra1/Dockerfile +2 -2
- data/features/fixtures/sinatra2/Dockerfile +2 -2
- data/features/plain_features/add_tab.feature +24 -97
- data/features/plain_features/app_type.feature +6 -25
- data/features/plain_features/app_version.feature +6 -25
- data/features/plain_features/auto_notify.feature +4 -20
- data/features/plain_features/delivery.feature +12 -60
- data/features/plain_features/exception_data.feature +24 -94
- data/features/plain_features/filters.feature +9 -43
- data/features/plain_features/handled_errors.feature +16 -78
- data/features/plain_features/ignore_classes.feature +5 -23
- data/features/plain_features/ignore_report.feature +6 -24
- data/features/plain_features/proxies.feature +13 -56
- data/features/plain_features/release_stages.feature +9 -40
- data/features/plain_features/report_api_key.feature +9 -35
- data/features/plain_features/report_severity.feature +8 -35
- data/features/plain_features/report_stack_frames.feature +24 -92
- data/features/plain_features/report_user.feature +23 -96
- data/features/plain_features/unhandled_errors.feature +17 -88
- data/features/rails_features/api_key.feature +12 -58
- data/features/rails_features/app_type.feature +13 -58
- data/features/rails_features/app_version.feature +19 -80
- data/features/rails_features/auto_capture_sessions.feature +31 -112
- data/features/rails_features/auto_notify.feature +28 -105
- data/features/rails_features/before_notify.feature +18 -83
- data/features/rails_features/breadcrumbs.feature +40 -137
- data/features/rails_features/handled.feature +18 -82
- data/features/rails_features/ignore_classes.feature +12 -51
- data/features/rails_features/meta_data_filters.feature +9 -33
- data/features/rails_features/mongo_breadcrumbs.feature +22 -96
- data/features/rails_features/project_root.feature +19 -84
- data/features/rails_features/release_stage.feature +20 -82
- data/features/rails_features/send_code.feature +13 -55
- data/features/rails_features/send_environment.feature +7 -33
- data/features/rails_features/unhandled.feature +6 -31
- data/features/rails_features/user_info.feature +27 -65
- data/features/sidekiq.feature +12 -79
- data/features/steps/ruby_notifier_steps.rb +59 -15
- data/features/support/env.rb +12 -45
- data/lib/bugsnag.rb +74 -21
- data/lib/bugsnag/breadcrumbs/breadcrumbs.rb +0 -2
- data/lib/bugsnag/breadcrumbs/validator.rb +0 -6
- data/lib/bugsnag/cleaner.rb +129 -60
- data/lib/bugsnag/configuration.rb +31 -2
- data/lib/bugsnag/helpers.rb +2 -4
- data/lib/bugsnag/integrations/que.rb +7 -4
- data/lib/bugsnag/integrations/railtie.rb +1 -1
- data/lib/bugsnag/middleware/discard_error_class.rb +30 -0
- data/lib/bugsnag/middleware/exception_meta_data.rb +15 -9
- data/lib/bugsnag/middleware/ignore_error_class.rb +2 -0
- data/lib/bugsnag/middleware/rack_request.rb +2 -4
- data/lib/bugsnag/report.rb +3 -13
- data/lib/bugsnag/stacktrace.rb +6 -10
- data/spec/breadcrumbs/breadcrumb_spec.rb +1 -1
- data/spec/breadcrumbs/validator_spec.rb +1 -26
- data/spec/bugsnag_spec.rb +2 -2
- data/spec/cleaner_spec.rb +202 -10
- data/spec/configuration_spec.rb +16 -1
- data/spec/fixtures/apps/rails-initializer-config/Gemfile +5 -1
- data/spec/fixtures/apps/rails-invalid-initializer-config/Gemfile +5 -1
- data/spec/fixtures/apps/rails-no-config/Gemfile +5 -1
- data/spec/helper_spec.rb +0 -31
- data/spec/integrations/logger_spec.rb +1 -1
- data/spec/integrations/rack_spec.rb +8 -6
- data/spec/integrations/rake_spec.rb +1 -1
- data/spec/report_spec.rb +324 -26
- data/spec/spec_helper.rb +6 -1
- data/spec/stacktrace_spec.rb +179 -72
- metadata +23 -7
- data/.travis.yml +0 -117
- data/features/plain_features/api_key.feature +0 -25
@@ -1,39 +1,13 @@
|
|
1
1
|
Feature: Send environment
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
And I
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
And I set environment variable "BUGSNAG_SEND_ENVIRONMENT" to "true"
|
11
|
-
And I start the service "rails<rails_version>"
|
12
|
-
And I wait for the app to respond on port "6128<rails_version>"
|
13
|
-
When I navigate to the route "/send_environment/initializer" on port "6128<rails_version>"
|
14
|
-
Then I should receive a request
|
15
|
-
And the request is a valid for the error reporting API
|
16
|
-
And the request used the "Ruby Bugsnag Notifier" notifier
|
17
|
-
And the request contained the api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
|
18
|
-
And the payload field "events" is an array with 1 element
|
3
|
+
@rails3 @rails4 @rails5 @rails6
|
4
|
+
Scenario: Send_environment should send environment in handled errors when true
|
5
|
+
Given I set environment variable "BUGSNAG_SEND_ENVIRONMENT" to "true"
|
6
|
+
And I start the rails service
|
7
|
+
When I navigate to the route "/send_environment/initializer" on the rails app
|
8
|
+
And I wait to receive a request
|
9
|
+
Then the request is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier"
|
19
10
|
And the exception "errorClass" equals "RuntimeError"
|
20
11
|
And the exception "message" starts with "handled string"
|
21
12
|
And the event "metaData.environment.REQUEST_METHOD" equals "GET"
|
22
|
-
And the event "metaData.environment.railsVersion" is not null
|
23
13
|
And the event "app.type" equals "rails"
|
24
|
-
|
25
|
-
Examples:
|
26
|
-
| ruby_version | rails_version |
|
27
|
-
| 2.0 | 3 |
|
28
|
-
| 2.1 | 3 |
|
29
|
-
| 2.2 | 3 |
|
30
|
-
| 2.2 | 4 |
|
31
|
-
| 2.2 | 5 |
|
32
|
-
| 2.3 | 3 |
|
33
|
-
| 2.3 | 4 |
|
34
|
-
| 2.3 | 5 |
|
35
|
-
| 2.4 | 3 |
|
36
|
-
| 2.4 | 5 |
|
37
|
-
| 2.5 | 3 |
|
38
|
-
| 2.5 | 5 |
|
39
|
-
| 2.5 | 6 |
|
@@ -1,20 +1,11 @@
|
|
1
1
|
Feature: Unhandled exceptions support
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
Given I set environment variable "RUBY_VERSION" to "<ruby_version>"
|
10
|
-
And I start the service "rails<rails_version>"
|
11
|
-
And I wait for the app to respond on port "6128<rails_version>"
|
12
|
-
When I navigate to the route "/unhandled/error" on port "6128<rails_version>"
|
13
|
-
Then I should receive a request
|
14
|
-
And the request is a valid for the error reporting API
|
15
|
-
And the request used the "Ruby Bugsnag Notifier" notifier
|
16
|
-
And the request contained the api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
|
17
|
-
And the payload field "events" is an array with 1 element
|
3
|
+
@rails3 @rails4 @rails5 @rails6
|
4
|
+
Scenario: Unhandled RuntimeError
|
5
|
+
Given I start the rails service
|
6
|
+
When I navigate to the route "/unhandled/error" on the rails app
|
7
|
+
And I wait to receive a request
|
8
|
+
Then the request is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier"
|
18
9
|
And the event "unhandled" is true
|
19
10
|
And the exception "errorClass" equals "NameError"
|
20
11
|
And the exception "message" starts with "undefined local variable or method `generate_unhandled_error' for #<UnhandledController"
|
@@ -23,19 +14,3 @@ Scenario Outline: Unhandled RuntimeError
|
|
23
14
|
And the event "severity" equals "error"
|
24
15
|
And the event "severityReason.type" equals "unhandledExceptionMiddleware"
|
25
16
|
And the event "severityReason.attributes.framework" equals "Rack"
|
26
|
-
|
27
|
-
Examples:
|
28
|
-
| ruby_version | rails_version |
|
29
|
-
| 2.0 | 3 |
|
30
|
-
| 2.1 | 3 |
|
31
|
-
| 2.2 | 3 |
|
32
|
-
| 2.2 | 4 |
|
33
|
-
| 2.2 | 5 |
|
34
|
-
| 2.3 | 3 |
|
35
|
-
| 2.3 | 4 |
|
36
|
-
| 2.3 | 5 |
|
37
|
-
| 2.4 | 3 |
|
38
|
-
| 2.4 | 5 |
|
39
|
-
| 2.5 | 3 |
|
40
|
-
| 2.5 | 5 |
|
41
|
-
| 2.5 | 6 |
|
@@ -1,90 +1,52 @@
|
|
1
1
|
Feature: Capture user information
|
2
2
|
|
3
|
-
|
4
|
-
Given I set environment variable "BUGSNAG_API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
|
5
|
-
And I set environment variable "APP_PATH" to "/usr/src"
|
6
|
-
And I configure the bugsnag endpoint
|
7
|
-
|
3
|
+
@rails3
|
8
4
|
Scenario Outline: Warden user information is sent
|
9
|
-
Given I
|
10
|
-
|
11
|
-
And I
|
12
|
-
|
13
|
-
|
14
|
-
Then I should receive a request
|
15
|
-
And the request is a valid for the error reporting API
|
16
|
-
And the request used the "Ruby Bugsnag Notifier" notifier
|
17
|
-
And the request contained the api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
|
18
|
-
And the payload field "events" is an array with 1 element
|
5
|
+
Given I start the rails service
|
6
|
+
When I navigate to the route "/warden/create" on the rails app
|
7
|
+
And I navigate to the route "/warden/<route>?email=testtest@test.test" on the rails app
|
8
|
+
And I wait to receive a request
|
9
|
+
Then the request is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier"
|
19
10
|
And the event "user.email" equals "testtest@test.test"
|
20
11
|
And the event "user.name" equals "Warden User"
|
21
12
|
And the event "user.first_name" equals "Warden"
|
22
13
|
And the event "user.last_name" equals "User"
|
23
14
|
|
24
15
|
Examples:
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
| 2.1 | 3 | handled |
|
29
|
-
| 2.1 | 3 | unhandled |
|
30
|
-
| 2.2 | 3 | handled |
|
31
|
-
| 2.2 | 3 | unhandled |
|
32
|
-
| 2.3 | 3 | handled |
|
33
|
-
| 2.3 | 3 | unhandled |
|
34
|
-
| 2.4 | 3 | handled |
|
35
|
-
| 2.4 | 3 | unhandled |
|
36
|
-
| 2.5 | 3 | handled |
|
37
|
-
| 2.5 | 3 | unhandled |
|
38
|
-
|
16
|
+
| route |
|
17
|
+
| handled |
|
18
|
+
| unhandled |
|
39
19
|
|
20
|
+
@rails4
|
40
21
|
Scenario Outline: Devise user information is sent
|
41
|
-
Given I
|
42
|
-
|
43
|
-
And I
|
44
|
-
|
45
|
-
|
46
|
-
Then I should receive a request
|
47
|
-
And the request is a valid for the error reporting API
|
48
|
-
And the request used the "Ruby Bugsnag Notifier" notifier
|
49
|
-
And the request contained the api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
|
50
|
-
And the payload field "events" is an array with 1 element
|
22
|
+
Given I start the rails service
|
23
|
+
When I navigate to the route "/devise/create" on the rails app
|
24
|
+
And I navigate to the route "/devise/<route>" on the rails app
|
25
|
+
And I wait to receive a request
|
26
|
+
Then the request is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier"
|
51
27
|
And the event "user.email" equals "test+test@test.test"
|
52
28
|
And the event "user.name" equals "Devise User"
|
53
29
|
And the event "user.first_name" equals "Devise"
|
54
30
|
And the event "user.last_name" equals "User"
|
55
31
|
|
56
32
|
Examples:
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
| 2.3 | 4 | handled |
|
61
|
-
| 2.3 | 4 | unhandled |
|
33
|
+
| route |
|
34
|
+
| handled |
|
35
|
+
| unhandled |
|
62
36
|
|
37
|
+
@rails5 @rails6
|
63
38
|
Scenario Outline: Clearance user information is sent
|
64
|
-
Given I
|
65
|
-
|
66
|
-
And I
|
67
|
-
|
68
|
-
|
69
|
-
Then I should receive a request
|
70
|
-
And the request is a valid for the error reporting API
|
71
|
-
And the request used the "Ruby Bugsnag Notifier" notifier
|
72
|
-
And the request contained the api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
|
73
|
-
And the payload field "events" is an array with 1 element
|
39
|
+
Given I start the rails service
|
40
|
+
When I navigate to the route "/clearance/create" on the rails app
|
41
|
+
And I navigate to the route "/clearance/<route>" on the rails app
|
42
|
+
And I wait to receive a request
|
43
|
+
Then the request is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier"
|
74
44
|
And the event "user.email" equals "testtest@test.test"
|
75
45
|
And the event "user.name" equals "Clearance User"
|
76
46
|
And the event "user.first_name" equals "Clearance"
|
77
47
|
And the event "user.last_name" equals "User"
|
78
48
|
|
79
49
|
Examples:
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
| 2.3 | 5 | handled |
|
84
|
-
| 2.3 | 5 | unhandled |
|
85
|
-
| 2.4 | 5 | handled |
|
86
|
-
| 2.4 | 5 | unhandled |
|
87
|
-
| 2.5 | 5 | handled |
|
88
|
-
| 2.5 | 5 | unhandled |
|
89
|
-
| 2.5 | 6 | handled |
|
90
|
-
| 2.5 | 6 | unhandled |
|
50
|
+
| route |
|
51
|
+
| handled |
|
52
|
+
| unhandled |
|
data/features/sidekiq.feature
CHANGED
@@ -1,97 +1,30 @@
|
|
1
1
|
Feature: Bugsnag raises errors in Sidekiq workers
|
2
2
|
|
3
|
-
|
4
|
-
Given I
|
5
|
-
And I
|
6
|
-
|
7
|
-
|
8
|
-
Scenario Outline: An unhandled RuntimeError sends a report
|
9
|
-
And I set environment variable "RUBY_VERSION" to "<ruby version>"
|
10
|
-
And I set environment variable "SIDEKIQ_VERSION" to "<sidekiq_version>"
|
11
|
-
And I start the service "sidekiq"
|
12
|
-
And I run the command "bundle exec ruby initializers/UnhandledError.rb" on the service "sidekiq"
|
13
|
-
And I wait for 1 seconds
|
14
|
-
Then I should receive a request
|
15
|
-
And the request used the "Ruby Bugsnag Notifier" notifier
|
16
|
-
And the request used payload v4 headers
|
17
|
-
And the request contained the api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
|
3
|
+
Scenario: An unhandled RuntimeError sends a report
|
4
|
+
Given I run the service "sidekiq" with the command "bundle exec rake sidekiq_tests:unhandled_error"
|
5
|
+
And I wait to receive a request
|
6
|
+
Then the request is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier"
|
18
7
|
And the event "unhandled" is true
|
19
8
|
And the event "severity" equals "error"
|
20
9
|
And the event "context" equals "UnhandledError@default"
|
21
10
|
And the event "severityReason.type" equals "unhandledExceptionMiddleware"
|
22
11
|
And the event "severityReason.attributes.framework" equals "Sidekiq"
|
23
12
|
And the exception "errorClass" equals "RuntimeError"
|
24
|
-
And the "file" of stack frame 0 equals "/
|
13
|
+
And the "file" of stack frame 0 equals "/app/app.rb"
|
25
14
|
And the "lineNumber" of stack frame 0 equals 33
|
26
|
-
And the payload field "events.0.metaData.sidekiq" matches the
|
15
|
+
And the payload field "events.0.metaData.sidekiq" matches the appropriate Sidekiq unhandled payload
|
27
16
|
And the event "metaData.sidekiq.msg.created_at" is a parsable timestamp in seconds
|
28
17
|
And the event "metaData.sidekiq.msg.enqueued_at" is a parsable timestamp in seconds
|
29
18
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
| 2.0 | ~> 3 | true |
|
35
|
-
| 2.1 | ~> 2 | false |
|
36
|
-
| 2.1 | ~> 3 | true |
|
37
|
-
| 2.2 | ~> 2 | false |
|
38
|
-
| 2.2 | ~> 3 | true |
|
39
|
-
| 2.2 | ~> 4 | true |
|
40
|
-
| 2.2 | ~> 5 | true |
|
41
|
-
| 2.3 | ~> 2 | false |
|
42
|
-
| 2.3 | ~> 3 | true |
|
43
|
-
| 2.3 | ~> 4 | true |
|
44
|
-
| 2.3 | ~> 5 | true |
|
45
|
-
| 2.4 | ~> 2 | false |
|
46
|
-
| 2.4 | ~> 3 | true |
|
47
|
-
| 2.4 | ~> 4 | true |
|
48
|
-
| 2.4 | ~> 5 | true |
|
49
|
-
| 2.5 | ~> 2 | false |
|
50
|
-
| 2.5 | ~> 3 | true |
|
51
|
-
| 2.5 | ~> 4 | true |
|
52
|
-
| 2.5 | ~> 5 | true |
|
53
|
-
|
54
|
-
Scenario Outline: A handled RuntimeError can be notified
|
55
|
-
And I set environment variable "RUBY_VERSION" to "<ruby version>"
|
56
|
-
And I set environment variable "SIDEKIQ_VERSION" to "<sidekiq_version>"
|
57
|
-
And I start the service "sidekiq"
|
58
|
-
And I run the command "bundle exec ruby initializers/HandledError.rb" on the service "sidekiq"
|
59
|
-
And I wait for 1 seconds
|
60
|
-
Then I should receive a request
|
61
|
-
And the request used the "Ruby Bugsnag Notifier" notifier
|
62
|
-
And the request used payload v4 headers
|
63
|
-
And the request contained the api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
|
19
|
+
Scenario: A handled RuntimeError can be notified
|
20
|
+
Given I run the service "sidekiq" with the command "bundle exec rake sidekiq_tests:handled_error"
|
21
|
+
And I wait to receive a request
|
22
|
+
Then the request is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier"
|
64
23
|
And the event "unhandled" is false
|
65
24
|
And the event "context" equals "HandledError@default"
|
66
25
|
And the event "severity" equals "warning"
|
67
26
|
And the event "severityReason.type" equals "handledException"
|
68
27
|
And the exception "errorClass" equals "RuntimeError"
|
69
|
-
And the "
|
70
|
-
And the "lineNumber" of stack frame 0 equals 24
|
71
|
-
And the payload field "events.0.metaData.sidekiq" matches the JSON fixture in "features/fixtures/sidekiq/payloads/handled_metadata_ca_<created_at_present>.json"
|
28
|
+
And the payload field "events.0.metaData.sidekiq" matches the appropriate Sidekiq handled payload
|
72
29
|
And the event "metaData.sidekiq.msg.created_at" is a parsable timestamp in seconds
|
73
|
-
And the event "metaData.sidekiq.msg.enqueued_at" is a parsable timestamp in seconds
|
74
|
-
|
75
|
-
Examples:
|
76
|
-
| ruby version | sidekiq_version | created_at_present |
|
77
|
-
| 1.9.3 | ~> 2 | false |
|
78
|
-
| 2.0 | ~> 2 | false |
|
79
|
-
| 2.0 | ~> 3 | true |
|
80
|
-
| 2.1 | ~> 2 | false |
|
81
|
-
| 2.1 | ~> 3 | true |
|
82
|
-
| 2.2 | ~> 2 | false |
|
83
|
-
| 2.2 | ~> 3 | true |
|
84
|
-
| 2.2 | ~> 4 | true |
|
85
|
-
| 2.2 | ~> 5 | true |
|
86
|
-
| 2.3 | ~> 2 | false |
|
87
|
-
| 2.3 | ~> 3 | true |
|
88
|
-
| 2.3 | ~> 4 | true |
|
89
|
-
| 2.3 | ~> 5 | true |
|
90
|
-
| 2.4 | ~> 2 | false |
|
91
|
-
| 2.4 | ~> 3 | true |
|
92
|
-
| 2.4 | ~> 4 | true |
|
93
|
-
| 2.4 | ~> 5 | true |
|
94
|
-
| 2.5 | ~> 2 | false |
|
95
|
-
| 2.5 | ~> 3 | true |
|
96
|
-
| 2.5 | ~> 4 | true |
|
97
|
-
| 2.5 | ~> 5 | true |
|
30
|
+
And the event "metaData.sidekiq.msg.enqueued_at" is a parsable timestamp in seconds
|
@@ -1,31 +1,75 @@
|
|
1
|
-
|
1
|
+
Then(/^the "(.+)" of the top non-bugsnag stackframe equals (\d+|".+")$/) do |element, value|
|
2
|
+
stacktrace = read_key_path(Server.current_request[:body], 'events.0.exceptions.0.stacktrace')
|
3
|
+
frame_index = stacktrace.find_index { |frame| ! /.*lib\/bugsnag.*\.rb/.match(frame["file"]) }
|
2
4
|
steps %Q{
|
3
|
-
|
5
|
+
the "#{element}" of stack frame #{frame_index} equals #{value}
|
4
6
|
}
|
5
7
|
end
|
6
8
|
|
7
|
-
|
9
|
+
Then(/^the total sessionStarted count equals (\d+)$/) do |value|
|
10
|
+
session_counts = read_key_path(Server.current_request[:body], "sessionCounts")
|
11
|
+
total_count = session_counts.inject(0) { |count, session| count += session["sessionsStarted"] }
|
12
|
+
assert_equal(value, total_count)
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
# Due to an ongoing discussion on whether the `payload_version` needs to be present within the headers
|
17
|
+
# and body of the payload, this step is a local replacement for the similar step present in the main
|
18
|
+
# maze-runner library. Once the discussion is resolved this step should be removed and replaced in scenarios
|
19
|
+
# with the main library version.
|
20
|
+
Then("the request is valid for the error reporting API version {string} for the {string}") do |payload_version, notifier_name|
|
8
21
|
steps %Q{
|
9
|
-
|
22
|
+
Then the "Bugsnag-Api-Key" header equals "#{$api_key}"
|
23
|
+
And the payload field "apiKey" equals "#{$api_key}"
|
24
|
+
And the "Bugsnag-Payload-Version" header equals "#{payload_version}"
|
25
|
+
And the "Content-Type" header equals "application/json"
|
26
|
+
And the "Bugsnag-Sent-At" header is a timestamp
|
27
|
+
|
28
|
+
And the payload field "notifier.name" equals "#{notifier_name}"
|
29
|
+
And the payload field "notifier.url" is not null
|
30
|
+
And the payload field "notifier.version" is not null
|
31
|
+
And the payload field "events" is a non-empty array
|
32
|
+
|
33
|
+
And each element in payload field "events" has "severity"
|
34
|
+
And each element in payload field "events" has "severityReason.type"
|
35
|
+
And each element in payload field "events" has "unhandled"
|
36
|
+
And each element in payload field "events" has "exceptions"
|
10
37
|
}
|
11
38
|
end
|
12
39
|
|
13
|
-
|
40
|
+
Given("I start the rails service") do
|
41
|
+
rails_version = ENV["RAILS_VERSION"]
|
14
42
|
steps %Q{
|
15
|
-
When I
|
43
|
+
When I start the service "rails#{rails_version}"
|
44
|
+
And I wait for the host "rails#{rails_version}" to open port "3000"
|
16
45
|
}
|
17
46
|
end
|
18
47
|
|
19
|
-
|
20
|
-
|
21
|
-
frame_index = stacktrace.find_index { |frame| ! /.*lib\/bugsnag.*\.rb/.match(frame["file"]) }
|
48
|
+
When("I navigate to the route {string} on the rails app") do |route|
|
49
|
+
rails_version = ENV["RAILS_VERSION"]
|
22
50
|
steps %Q{
|
23
|
-
|
51
|
+
When I open the URL "http://rails#{rails_version}:3000#{route}"
|
24
52
|
}
|
25
53
|
end
|
26
54
|
|
27
|
-
Then(
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
55
|
+
Then("the payload field {string} matches the appropriate Sidekiq handled payload") do |field|
|
56
|
+
if ENV["SIDEKIQ_VERSION"] == "~> 2"
|
57
|
+
created_at_present = "false"
|
58
|
+
else
|
59
|
+
created_at_present = "true"
|
60
|
+
end
|
61
|
+
steps %Q{
|
62
|
+
And the payload field "#{field}" matches the JSON fixture in "features/fixtures/sidekiq/payloads/handled_metadata_ca_#{created_at_present}.json"
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
Then("the payload field {string} matches the appropriate Sidekiq unhandled payload") do |field|
|
67
|
+
if ENV["SIDEKIQ_VERSION"] == "~> 2"
|
68
|
+
created_at_present = "false"
|
69
|
+
else
|
70
|
+
created_at_present = "true"
|
71
|
+
end
|
72
|
+
steps %Q{
|
73
|
+
And the payload field "#{field}" matches the JSON fixture in "features/fixtures/sidekiq/payloads/unhandled_metadata_ca_#{created_at_present}.json"
|
74
|
+
}
|
75
|
+
end
|
data/features/support/env.rb
CHANGED
@@ -1,56 +1,23 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
|
3
|
-
Before do
|
4
|
-
find_default_docker_compose
|
5
|
-
end
|
6
|
-
|
7
|
-
def output_logs
|
8
|
-
$docker_services.each do |service|
|
9
|
-
logged_service = service[:service] == :all ? '' : service[:service]
|
10
|
-
command = "logs -t #{logged_service}"
|
11
|
-
begin
|
12
|
-
response = run_docker_compose_command(service[:file], command)
|
13
|
-
rescue => exception
|
14
|
-
response = "Couldn't retreive logs for #{service[:file]}:#{logged_service}"
|
15
|
-
end
|
16
|
-
STDOUT.puts response.is_a?(String) ? response : response.to_a
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
3
|
def install_fixture_gems
|
21
|
-
|
22
|
-
Dir.chdir(gem_dir) do
|
23
|
-
`rm bugsnag-*.gem` unless Dir.glob('bugsnag-*.gem').empty?
|
24
|
-
`gem build bugsnag.gemspec`
|
25
|
-
Dir.entries('features/fixtures').reject { |entry| ['.', '..'].include?(entry) }.each do |entry|
|
26
|
-
target_dir = "features/fixtures/#{entry}"
|
27
|
-
if File.directory?(target_dir)
|
28
|
-
`cp bugsnag-*.gem #{target_dir}`
|
29
|
-
`gem unpack #{target_dir}/bugsnag-*.gem --target #{target_dir}/temp-bugsnag-lib`
|
30
|
-
end
|
31
|
-
end
|
32
|
-
`rm bugsnag-*.gem`
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
# Added to ensure that multiple versions of Gems do not exist within the fixture folders,
|
37
|
-
# which can be difficult to track down and clear up
|
38
|
-
def remove_installed_gems
|
39
|
-
removal_targets = ['temp-bugsnag-lib', 'bugsnag-*.gem']
|
4
|
+
throw Error.new("Bugsnag.gem not found. Is this running in a docker-container?") unless File.exist?("/app/bugsnag.gem")
|
40
5
|
Dir.entries('features/fixtures').reject { |entry| ['.', '..'].include?(entry) }.each do |entry|
|
41
6
|
target_dir = "features/fixtures/#{entry}"
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
end
|
46
|
-
target_entries.each do |d_target|
|
47
|
-
FileUtils.rm_rf(d_target)
|
7
|
+
if File.directory?(target_dir)
|
8
|
+
`cp /app/bugsnag.gem #{target_dir}`
|
9
|
+
`gem unpack #{target_dir}/bugsnag.gem --target #{target_dir}/temp-bugsnag-lib`
|
48
10
|
end
|
49
11
|
end
|
50
12
|
end
|
51
13
|
|
52
|
-
|
53
|
-
|
14
|
+
AfterConfiguration do |config|
|
15
|
+
install_fixture_gems
|
54
16
|
end
|
55
17
|
|
56
|
-
|
18
|
+
Before do
|
19
|
+
Docker.compose_project_name = "#{rand.to_s}:#{Time.new.strftime("%s")}"
|
20
|
+
Runner.environment.clear
|
21
|
+
Runner.environment["BUGSNAG_API_KEY"] = $api_key
|
22
|
+
Runner.environment["BUGSNAG_ENDPOINT"] = "http://maze-runner:#{MOCK_API_PORT}"
|
23
|
+
end
|