Skip to content

Commit

Permalink
Handle SourceRoot env in all fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
DariaKunoichi committed Mar 1, 2024
1 parent 8aff37c commit 0da6720
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
12 changes: 12 additions & 0 deletions features/fixtures/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ services:
- PARAMS_FILTERS
- SYNCHRONOUS
- SERVER_PORT
- BUGSNAG_SOURCE_ROOT
- BUGSNAG_PROJECT_PACKAGES
restart: "no"

autoconfigure:
Expand Down Expand Up @@ -72,6 +74,8 @@ services:
- AUTO_CAPTURE_SESSIONS
- SYNCHRONOUS
- SERVER_PORT
- BUGSNAG_SOURCE_ROOT
- BUGSNAG_PROJECT_PACKAGES
restart: "no"
command: go run main.go

Expand All @@ -97,6 +101,8 @@ services:
- AUTO_CAPTURE_SESSIONS
- SYNCHRONOUS
- SERVER_PORT
- BUGSNAG_SOURCE_ROOT
- BUGSNAG_PROJECT_PACKAGES
restart: "no"
command: go run main.go

Expand All @@ -121,6 +127,8 @@ services:
- AUTO_CAPTURE_SESSIONS
- SYNCHRONOUS
- SERVER_PORT
- BUGSNAG_SOURCE_ROOT
- BUGSNAG_PROJECT_PACKAGES
restart: "no"
command: go run main.go

Expand All @@ -146,6 +154,8 @@ services:
- AUTO_CAPTURE_SESSIONS
- SYNCHRONOUS
- SERVER_PORT
- BUGSNAG_SOURCE_ROOT
- BUGSNAG_PROJECT_PACKAGES
restart: "no"
command: go run main.go

Expand Down Expand Up @@ -173,5 +183,7 @@ services:
- SYNCHRONOUS
- SERVER_PORT
- USE_PROPERTIES_FILE_CONFIG
- BUGSNAG_SOURCE_ROOT
- BUGSNAG_PROJECT_PACKAGES
restart: "no"
command: ./test/run.sh
15 changes: 8 additions & 7 deletions features/handled.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Feature: Plain 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 have built the service "app"
And I set environment variable "AUTO_CAPTURE_SESSIONS" to "false"
Expand All @@ -14,7 +15,7 @@ Scenario: A handled error sends a report
And the event "severity" equals "warning"
And the event "severityReason.type" equals "handledError"
And the exception is a PathError for request 0
And the "file" of stack frame 0 ends with "main.go"
And the "file" of stack frame 0 equals "main.go"

Scenario: A handled error sends a report with a custom name
Given I set environment variable "ERROR_CLASS" to "MyCustomErrorClass"
Expand All @@ -25,7 +26,7 @@ Scenario: A handled error sends a report with a custom name
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 ends with "main.go"
And the "file" of stack frame 0 equals "main.go"

Scenario: Sending an event using a callback to modify report contents
When I run the go service "app" with the test case "handled-with-callback"
Expand All @@ -35,7 +36,7 @@ Scenario: Sending an event using a callback to modify report contents
And the event "severity" equals "info"
And the event "severityReason.type" equals "userCallbackSetSeverity"
And the event "context" equals "nonfatal.go:14"
And the "file" of stack frame 0 ends with "main.go"
And the "file" of stack frame 0 equals "main.go"
And stack frame 0 contains a local function spanning 242 to 248
And the "file" of stack frame 1 equals ">insertion<"
And the "lineNumber" of stack frame 1 equals 0
Expand All @@ -48,7 +49,7 @@ Scenario: Marking an error as unhandled in a callback
And the event "severity" equals "error"
And the event "severityReason.type" equals "userCallbackSetSeverity"
And the event "severityReason.unhandledOverridden" is true
And the "file" of stack frame 0 ends with "main.go"
And the "file" of stack frame 0 equals "main.go"
And stack frame 0 contains a local function spanning 254 to 257

Scenario: Unwrapping the causes of a handled error
Expand All @@ -59,11 +60,11 @@ Scenario: Unwrapping the causes of a handled error
And the event "severity" equals "warning"
And the event "exceptions.0.message" equals "terminate process"
And the "lineNumber" of stack frame 0 equals 292
And the "file" of stack frame 0 ends with "main.go"
And the "file" of stack frame 0 equals "main.go"
And the "method" of stack frame 0 equals "nestedHandledError"
And the event "exceptions.1.message" equals "login failed"
And the event "exceptions.1.stacktrace.0.file" ends with "main.go"
And the event "exceptions.1.stacktrace.0.file" equals "main.go"
And the event "exceptions.1.stacktrace.0.lineNumber" equals 312
And the event "exceptions.2.message" equals "invalid token"
And the event "exceptions.2.stacktrace.0.file" ends with "main.go"
And the event "exceptions.2.stacktrace.0.file" equals "main.go"
And the event "exceptions.2.stacktrace.0.lineNumber" equals 320
5 changes: 3 additions & 2 deletions features/net-http/handled.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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"
Expand All @@ -17,7 +18,7 @@ Scenario: A handled error sends a report
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 ends with "main.go" for request 0
And the "file" of stack frame 0 equals "main.go" for request 0

Scenario: A handled error sends a report with a custom name
Given I set environment variable "ERROR_CLASS" to "MyCustomErrorClass"
Expand All @@ -31,4 +32,4 @@ Scenario: A handled error sends a report with a custom name
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 ends with "main.go" for request 0
And the "file" of stack frame 0 equals "main.go" for request 0
9 changes: 5 additions & 4 deletions features/plain_features/panics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Feature: Panic handling

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 have built the service "app"
And I set environment variable "AUTO_CAPTURE_SESSIONS" to "false"
Expand All @@ -17,7 +18,7 @@ Feature: Panic handling
And the exception "message" is one of:
| interface conversion: interface is struct {}, not string |
| interface conversion: interface {} is struct {}, not string |
And the "method" of stack frame 0 equals "unhandledCrash.func1"
And the "file" of stack frame 0 ends with "main.go"
And the "method" of stack frame 1 equals "unhandledCrash"
And the "file" of stack frame 1 ends with "main.go"
And the in-project frames of the stacktrace are:
| file | method |
| main.go | unhandledCrash.func1 |
| main.go | unhandledCrash |

0 comments on commit 0da6720

Please sign in to comment.