-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite nethttp features to new steps
- Loading branch information
1 parent
ea2077b
commit 6ae8183
Showing
9 changed files
with
82 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,27 @@ | ||
Feature: Configuring app version | ||
|
||
Background: | ||
Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
And I configure the bugsnag endpoint | ||
And I set environment variable "APP_VERSION" to "3.1.2" | ||
And I set environment variable "SERVER_PORT" to "4512" | ||
And I set environment variable "BUGSNAG_APP_VERSION" to "3.1.2" | ||
|
||
Scenario: A error report contains the configured app type when using a net http app | ||
Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false" | ||
When I start the service "nethttp" | ||
And I wait for the app to open port "4512" | ||
Given I set environment variable "BUGSNAG_AUTO_CAPTURE_SESSIONS" to "false" | ||
When I start the service "app" | ||
And I run "HttpServerScenario" | ||
And I wait for the host "localhost" to open port "4512" | ||
And I wait for 2 seconds | ||
And I open the URL "http://localhost:4512/handled" | ||
Then I wait to receive a request | ||
And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
And I wait to receive an error | ||
And I should receive no sessions | ||
And the error is valid for the error reporting API version "4" for the "Bugsnag Go" notifier | ||
And the event "app.version" equals "3.1.2" | ||
|
||
Scenario: A session report contains the configured app type when using a net http app | ||
Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "true" | ||
When I start the service "nethttp" | ||
And I wait for the app to open port "4512" | ||
Given I set environment variable "BUGSNAG_AUTO_CAPTURE_SESSIONS" to "true" | ||
When I start the service "app" | ||
And I run "HttpServerScenario" | ||
And I wait for the host "localhost" to open port "4512" | ||
And I wait for 2 seconds | ||
And I open the URL "http://localhost:4512/session" | ||
Then I wait to receive a request after the start up session | ||
And the request is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
And the payload field "app.version" equals "3.1.2" | ||
|
||
And I wait to receive a session | ||
And the session is valid for the session reporting API version "1.0" for the "Bugsnag Go" notifier | ||
And the session payload field "sessions.0.app.version" equals "3.1.2" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,25 @@ | ||
Feature: Using auto notify | ||
|
||
Background: | ||
Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
And I configure the bugsnag endpoint | ||
And I set environment variable "SERVER_PORT" to "4512" | ||
|
||
Scenario: An error report is sent when an AutoNotified crash occurs which later gets recovered | ||
Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false" | ||
When I start the service "nethttp" | ||
And I wait for the app to open port "4512" | ||
Given I set environment variable "BUGSNAG_AUTO_CAPTURE_SESSIONS" to "false" | ||
When I start the service "app" | ||
And I run "HttpServerScenario" | ||
And I wait for the host "localhost" to open port "4512" | ||
And I wait for 2 seconds | ||
And I open the URL "http://localhost:4512/autonotify-then-recover" | ||
Then I wait to receive a request | ||
And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
Then I wait to receive an error | ||
And the event "unhandled" is true | ||
And the exception "errorClass" equals "*runtime.TypeAssertionError" | ||
And the exception "message" matches "interface conversion: interface ({} )?is struct {}, not string" | ||
|
||
Scenario: An error report is sent when a go routine crashes which is reported through auto notify | ||
Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false" | ||
When I start the service "nethttp" | ||
And I wait for the app to open port "4512" | ||
Given I set environment variable "BUGSNAG_AUTO_CAPTURE_SESSIONS" to "false" | ||
When I start the service "app" | ||
And I run "HttpServerScenario" | ||
And I wait for the host "localhost" to open port "4512" | ||
And I wait for 2 seconds | ||
And I open the URL "http://localhost:4512/autonotify" | ||
Then I wait to receive a request | ||
And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
Then I wait to receive an error | ||
And the event "unhandled" is true | ||
And the exception "errorClass" equals "*errors.errorString" | ||
And the exception "message" equals "Go routine killed with auto notify" | ||
And the exception "message" equals "Go routine killed with auto notify" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,31 @@ | ||
Feature: Handled errors | ||
|
||
Background: | ||
Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
Given I set environment variable "BUGSNAG_SOURCE_ROOT" to the app directory | ||
And I configure the bugsnag endpoint | ||
And I set environment variable "SERVER_PORT" to "4512" | ||
And I set environment variable "AUTO_CAPTURE_SESSIONS" to "false" | ||
Given I set environment variable "BUGSNAG_SOURCE_ROOT" to "/app/src/features/fixtures/app/" | ||
|
||
Scenario: A handled error sends a report | ||
When I start the service "nethttp" | ||
And I wait for the app to open port "4512" | ||
When I start the service "app" | ||
And I run "HttpServerScenario" | ||
And I wait for the host "localhost" to open port "4512" | ||
And I wait for 2 seconds | ||
And I open the URL "http://localhost:4512/handled" | ||
Then I wait to receive a request | ||
And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
And the event "unhandled" is false for request 0 | ||
And the event "severity" equals "warning" for request 0 | ||
And the event "severityReason.type" equals "handledError" for request 0 | ||
And the exception is a PathError for request 0 | ||
And the "file" of stack frame 0 equals "main.go" for request 0 | ||
Then I wait to receive an error | ||
And the event "unhandled" is false | ||
And the event "severity" equals "warning" | ||
And the event "severityReason.type" equals "handledError" | ||
And the exception "errorClass" equals "*os.PathError" | ||
And the "file" of stack frame 0 equals "nethttp_scenario.go" | ||
|
||
Scenario: A handled error sends a report with a custom name | ||
Given I set environment variable "ERROR_CLASS" to "MyCustomErrorClass" | ||
When I start the service "nethttp" | ||
And I wait for the app to open port "4512" | ||
When I start the service "app" | ||
And I run "HttpServerScenario" | ||
And I wait for the host "localhost" to open port "4512" | ||
And I wait for 2 seconds | ||
And I open the URL "http://localhost:4512/handled" | ||
Then I wait to receive a request | ||
And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
And the event "unhandled" is false for request 0 | ||
And the event "severity" equals "warning" for request 0 | ||
And the event "severityReason.type" equals "handledError" for request 0 | ||
And the exception "errorClass" equals "MyCustomErrorClass" for request 0 | ||
And the "file" of stack frame 0 equals "main.go" for request 0 | ||
Then I wait to receive an error | ||
And the event "unhandled" is false | ||
And the event "severity" equals "warning" | ||
And the event "severityReason.type" equals "handledError" | ||
And the exception "errorClass" equals "MyCustomErrorClass" | ||
And the "file" of stack frame 0 equals "nethttp_scenario.go" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,12 @@ | ||
Feature: Configuring on before notify | ||
|
||
Background: | ||
Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
And I configure the bugsnag endpoint | ||
And I set environment variable "SERVER_PORT" to "4512" | ||
And I set environment variable "AUTO_CAPTURE_SESSIONS" to "false" | ||
|
||
Scenario: Send three bugsnags and use on before notify to drop one and modify the message of another | ||
When I start the service "nethttp" | ||
And I wait for the app to open port "4512" | ||
When I start the service "app" | ||
And I run "HttpServerScenario" | ||
And I wait for the host "localhost" to open port "4512" | ||
And I wait for 2 seconds | ||
And I open the URL "http://localhost:4512/onbeforenotify" | ||
Then I wait to receive 2 requests | ||
And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
And the exception "message" equals "Don't ignore this error" for request 0 | ||
And the request 1 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
And the exception "message" equals "Error message was changed" for request 1 | ||
Then I wait to receive 2 errors | ||
And the exception "message" equals "Don't ignore this error" | ||
And I discard the oldest error | ||
And the exception "message" equals "Error message was changed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,11 @@ | ||
Feature: Using recover | ||
|
||
Background: | ||
Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
And I configure the bugsnag endpoint | ||
And I set environment variable "SERVER_PORT" to "4512" | ||
And I set environment variable "AUTO_CAPTURE_SESSIONS" to "false" | ||
|
||
Scenario: An error report is sent when request crashes but is recovered | ||
When I start the service "nethttp" | ||
And I wait for the app to open port "4512" | ||
When I start the service "app" | ||
And I run "HttpServerScenario" | ||
And I wait for the host "localhost" to open port "4512" | ||
And I wait for 2 seconds | ||
And I open the URL "http://localhost:4512/recover" | ||
Then I wait to receive a request | ||
And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
And the exception "errorClass" equals "*errors.errorString" for request 0 | ||
And the exception "message" equals "Request killed but recovered" for request 0 | ||
Then I wait to receive an error | ||
And the exception "errorClass" equals "*errors.errorString" | ||
And the exception "message" equals "Request killed but recovered" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
Feature: Configuring release stage | ||
|
||
Background: | ||
Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
And I configure the bugsnag endpoint | ||
And I set environment variable "SERVER_PORT" to "4512" | ||
And I set environment variable "RELEASE_STAGE" to "my-stage" | ||
Given I set environment variable "BUGSNAG_RELEASE_STAGE" to "my-stage" | ||
|
||
Scenario: An error report is sent with configured release stage | ||
Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false" | ||
When I start the service "nethttp" | ||
And I wait for the app to open port "4512" | ||
Given I set environment variable "BUGSNAG_AUTO_CAPTURE_SESSIONS" to "false" | ||
When I start the service "app" | ||
And I run "HttpServerScenario" | ||
And I wait for the host "localhost" to open port "4512" | ||
And I wait for 2 seconds | ||
And I open the URL "http://localhost:4512/handled" | ||
Then I wait to receive a request | ||
And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
And the event "app.releaseStage" equals "my-stage" for request 0 | ||
Then I wait to receive an error | ||
And the event "app.releaseStage" equals "my-stage" | ||
|
||
Scenario: A session report contains the configured app type | ||
Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "true" | ||
When I start the service "nethttp" | ||
And I wait for the app to open port "4512" | ||
Given I set environment variable "BUGSNAG_AUTO_CAPTURE_SESSIONS" to "true" | ||
When I start the service "app" | ||
And I run "HttpServerScenario" | ||
And I wait for the host "localhost" to open port "4512" | ||
And I wait for 2 seconds | ||
And I open the URL "http://localhost:4512/session" | ||
Then I wait to receive a request after the start up session | ||
And the request is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
And the payload field "app.releaseStage" equals "my-stage" | ||
Then I wait to receive a session | ||
And I wait to receive an error | ||
And the session payload field "sessions.0.app.releaseStage" equals "my-stage" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,14 @@ | ||
Feature: Capturing request information automatically | ||
|
||
Background: | ||
Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
And I configure the bugsnag endpoint | ||
And I set environment variable "SERVER_PORT" to "4512" | ||
|
||
Scenario: An error report will automatically contain request information | ||
Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false" | ||
When I start the service "nethttp" | ||
And I wait for the app to open port "4512" | ||
When I start the service "app" | ||
And I run "HttpServerScenario" | ||
And I wait for the host "localhost" to open port "4512" | ||
And I wait for 2 seconds | ||
And I open the URL "http://localhost:4512/handled" | ||
Then I wait to receive a request | ||
And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
Then I wait to receive an error | ||
And the event "request.clientIp" is not null | ||
And the event "request.headers.User-Agent" equals "Ruby" | ||
And the event "request.httpMethod" equals "GET" | ||
And the event "request.url" ends with "/handled" | ||
And the event "request.url" starts with "http://" | ||
And the event "request.url" starts with "http://" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,12 @@ | ||
Feature: Sending user data | ||
|
||
Background: | ||
Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
And I configure the bugsnag endpoint | ||
And I set environment variable "SERVER_PORT" to "4512" | ||
And I set environment variable "AUTO_CAPTURE_SESSIONS" to "false" | ||
|
||
Scenario: An error report contains custom user data | ||
Given I set environment variable "USER_ID" to "test-user-id" | ||
And I set environment variable "USER_NAME" to "test-user-name" | ||
And I set environment variable "USER_EMAIL" to "test-user-email" | ||
When I start the service "nethttp" | ||
And I wait for the app to open port "4512" | ||
When I start the service "app" | ||
And I run "HttpServerScenario" | ||
And I wait for the host "localhost" to open port "4512" | ||
And I wait for 2 seconds | ||
And I open the URL "http://localhost:4512/user" | ||
Then I wait to receive a request | ||
And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" | ||
Then I wait to receive an error | ||
And the event "user.id" equals "test-user-id" | ||
And the event "user.name" equals "test-user-name" | ||
And the event "user.email" equals "test-user-email" | ||
And the event "user.email" equals "test-user-email" |