Codebase list golang-github-bugsnag-bugsnag-go / 157ff2b
[chore] Quick fixes following review comments - Delete commented Go code - Remove unused commented revel conf properties - Explain what's going on with config file revel maze tests - Remove commented maze code - Clarify that auto notify doesn't protect - Fix incorrect framework names in features/scenarios - Format features consistently - Configure revel from properties file explicitly only once - Fix typos - Remove unused hooks Roger Guldbrandsen 5 years ago
41 changed file(s) with 58 addition(s) and 200 deletion(s). Raw diff Collapse all Expand all
194194
195195 time.Sleep(200 * time.Millisecond)
196196 }
197
198 // func caseSynchronous() {
199 // config := newDefaultConfig()
200 // sync, err := strconv.ParseBool(os.Getenv("SYNCHRONOUS"))
201 // if err != nil {
202 // panic("Unknown synchronous flag: " + err.Error())
203 // }
204 // config.Synchronous = sync
205 // bugsnag.Configure(config)
206
207 // notifier := bugsnag.New()
208 // notifier.Notify(fmt.Errorf("Generic error"))
209 // }
210
211 // func caseUserData() {
212 // config := newDefaultConfig()
213 // bugsnag.Configure(config)
214
215 // notifier := bugsnag.New()
216 // notifier.NotifySync(fmt.Errorf("oops"), true, bugsnag.User{
217 // Id: os.Getenv("USER_ID"),
218 // Name: os.Getenv("USER_NAME"),
219 // Email: os.Getenv("USER_EMAIL"),
220 // })
221 // }
134134 - AUTO_CAPTURE_SESSIONS
135135 - SYNCHRONOUS
136136 - SERVER_PORT
137 - USE_CODE_CONFIG
137 - USE_PROPERTIES_FILE_CONFIG
138138 restart: "no"
139139 command: ./test/run.sh
4747
4848 bugsnag.DefaultSessionPublishInterval = time.Millisecond * 300
4949
50 if os.Getenv("USE_CODE_CONFIG") == "" {
50 if os.Getenv("USE_PROPERTIES_FILE_CONFIG") != "" {
5151 return
5252 }
5353
118118 # Allows Routes like this:
119119 # `Static.ServeModule("modulename","public")`
120120 module.static = github.com/revel/modules/static
121
122
123 #bugsnag.apikey=
124 #bugsnag.apptype=
125 #bugsnag.appversion=
126 #bugsnag.autocapturesessions=
127 #bugsnag.endpoint=
128 #bugsnag.endpoints.notify=
129 #bugsnag.endpoints.sessions=
130 #bugsnag.hostname=
131 #bugsnag.notifyreleasestages=
132 #bugsnag.paramsfilters=
133 #bugsnag.projectpackages=
134 #bugsnag.releasestage=
135 #bugsnag.sourceroot=
136 #bugsnag.synchronous=
137121
138122 ################################################################################
139123
243227 log.request.output = log/%(app.name)s-requests.json
244228
245229
230 # This profile will only be used when the USE_PROPERTIES_FILE_CONFIG environment variable is set
231
246232 [configfile]
247233 mode.dev = true
248234 watch = true
11
22 set -e
33
4 if [ -z "${USE_CODE_CONFIG}" ]
4 # Use the [configfile] profile declared in conf/app.conf if the USE_PROPERTIES_FILE_CONFIG is set
5 if [ -z "${USE_PROPERTIES_FILE_CONFIG}" ]
56 then
7 $GOPATH/bin/revel run test
8 else
69 $GOPATH/bin/revel run test configfile
7 else
8 $GOPATH/bin/revel run test
910 fi
33 Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
44 And I configure the bugsnag endpoint
55 And I set environment variable "SERVER_PORT" to "4511"
6
6
77 Scenario: An error report is sent when an unhandled crash occurs
88 Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false"
99 When I start the service "gin"
1616 And the exception "errorClass" equals "*runtime.TypeAssertionError"
1717 And the exception "message" matches "interface conversion: interface ({} )?is struct {}, not string"
1818
19 Scenario: An error report is sent when a go routine crashes which is protected by auto notify
19 Scenario: An error report is sent when a go routine crashes which is reported through auto notify
2020 When I start the service "gin"
2121 And I wait for the app to open port "4511"
2222 And I wait for 2 seconds
2323 And I open the URL "http://localhost:4511/autonotify"
2424 And I wait for 3 seconds
25 # Then I wait to receive 3 requests
2625 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
2726 And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
28 # And the request 2 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
2927 And the event "unhandled" is true for request 0
3028 And the exception "errorClass" equals "*errors.errorString" for request 0
3129 And the exception "message" equals "Go routine killed with auto notify" for request 0
32 # And the event "unhandled" is true for request 2
33 # And the exception "errorClass" equals "panic" for request 2
34 # And the exception "message" equals "Go routine killed with auto notify [recovered]" for request 2
3530 And the event unhandled sessions count equals 1 for request 0
36 And the number of sessions started equals 1 for request 1
31 And the number of sessions started equals 1 for request 1
0 Feature: Plain handled errors
0 Feature: Handled errors
11
22 Background:
33 Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
1111 And I wait for 2 seconds
1212 And I open the URL "http://localhost:4511/onbeforenotify"
1313 Then I wait to receive 2 requests
14
1514 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
1615 And the exception "message" equals "Don't ignore this error" for request 0
17
1816 And the request 1 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
1917 And the exception "message" equals "Error message was changed" for request 1
20
1111 And I open the URL "http://localhost:4511/recover"
1212 Then I wait to receive 2 requests
1313 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
14
1514 And the exception "errorClass" equals "*errors.errorString" for request 0
1615 And the exception "message" equals "Request killed but recovered" for request 0
17
1816 And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
19
2017 And the event handled sessions count equals 1 for request 0
2118 And the number of sessions started equals 1 for request 1
22
1313 Then I wait to receive 2 requests
1414 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
1515 And the event "app.releaseStage" equals "my-stage" for request 0
16
1716 And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
1817 And the payload field "app.releaseStage" equals "my-stage" for request 1
19
2018 And the event handled sessions count equals 1 for request 0
21 And the number of sessions started equals 1 for request 1
19 And the number of sessions started equals 1 for request 1
33 Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
44 And I configure the bugsnag endpoint
55 And I set environment variable "SERVER_PORT" to "4513"
6
6
77 Scenario: An error report is sent when an unhandled crash occurs
88 Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false"
99 When I start the service "martini"
1212 And I open the URL "http://localhost:4513/unhandled"
1313 Then I wait to receive a request
1414 And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
15 And the event "unhandled" is true
15 And the event "unhandled" is true
1616 And the exception "errorClass" equals "*runtime.TypeAssertionError"
1717 And the exception "message" matches "interface conversion: interface ({} )?is struct {}, not string"
1818
19 Scenario: An error report is sent when a go routine crashes which is protected by auto notify
19 Scenario: An error report is sent when a go routine crashes which is reported through auto notify
2020 When I start the service "martini"
2121 And I wait for the app to open port "4513"
2222 And I wait for 2 seconds
2323 And I open the URL "http://localhost:4513/autonotify"
2424 And I wait for 3 seconds
25 # Then I wait to receive 3 requests
2625 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
2726 And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
28 # And the request 2 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
2927 And the event "unhandled" is true for request 0
3028 And the exception "errorClass" equals "*errors.errorString" for request 0
3129 And the exception "message" equals "Go routine killed with auto notify" for request 0
32 # And the event "unhandled" is true for request 2
33 # And the exception "errorClass" equals "panic" for request 2
34 # And the exception "message" equals "Go routine killed with auto notify [recovered]" for request 2
3530 And the event unhandled sessions count equals 1 for request 0
36 And the number of sessions started equals 1 for request 1
31 And the number of sessions started equals 1 for request 1
0 Feature: Plain handled errors
0 Feature: Handled errors
11
22 Background:
33 Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
1919 And the "file" of stack frame 0 equals "main.go" for request 0
2020 And the event handled sessions count equals 1 for request 0
2121 And the number of sessions started equals 1 for request 1
22
1111 And I wait for 2 seconds
1212 And I open the URL "http://localhost:4513/onbeforenotify"
1313 Then I wait to receive 2 requests
14
1514 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
1615 And the exception "message" equals "Don't ignore this error" for request 0
17
1816 And the request 1 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
19 And the exception "message" equals "Error message was changed" for request 1
17 And the exception "message" equals "Error message was changed" for request 1
1111 And I open the URL "http://localhost:4513/recover"
1212 Then I wait to receive 2 requests
1313 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
14
1514 And the exception "errorClass" equals "*errors.errorString" for request 0
1615 And the exception "message" equals "Request killed but recovered" for request 0
17
1816 And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
19
2017 And the event handled sessions count equals 1 for request 0
2118 And the number of sessions started equals 1 for request 1
1313 Then I wait to receive 2 requests
1414 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
1515 And the event "app.releaseStage" equals "my-stage" for request 0
16
1716 And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
1817 And the payload field "app.releaseStage" equals "my-stage" for request 1
19
2018 And the event handled sessions count equals 1 for request 0
2119 And the number of sessions started equals 1 for request 1
55 And I set environment variable "APP_VERSION" to "3.1.2"
66 And I set environment variable "SERVER_PORT" to "4514"
77
8 Scenario: A error report contains the configured app type when using a gin
8 Scenario: A error report contains the configured app type when using
99 Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false"
1010 When I start the service "negroni"
1111 And I wait for the app to open port "4514"
1515 And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
1616 And the event "app.version" equals "3.1.2"
1717
18 Scenario: A session report contains the configured app type when using gin
18 Scenario: A session report contains the configured app type
1919 When I start the service "negroni"
2020 And I wait for the app to open port "4514"
2121 And I wait for 2 seconds
2222 And I open the URL "http://localhost:4514/session"
2323 Then I wait to receive a request
2424 And the request is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
25 And the payload field "app.version" equals "3.1.2"
25 And the payload field "app.version" equals "3.1.2"
33 Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
44 And I configure the bugsnag endpoint
55 And I set environment variable "SERVER_PORT" to "4514"
6
6
77 Scenario: An error report is sent when an unhandled crash occurs
88 Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false"
99 When I start the service "negroni"
1212 And I open the URL "http://localhost:4514/unhandled"
1313 Then I wait to receive a request
1414 And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
15 And the event "unhandled" is true
15 And the event "unhandled" is true
1616 And the exception "errorClass" equals "*runtime.TypeAssertionError"
1717 And the exception "message" matches "interface conversion: interface ({} )?is struct {}, not string"
1818
19 Scenario: An error report is sent when a go routine crashes which is protected by auto notify
19 Scenario: An error report is sent when a go routine crashes which is reported through auto notify
2020 Given I start the service "negroni"
2121 And I wait for the app to open port "4514"
2222 And I wait for 2 seconds
2323 And I open the URL "http://localhost:4514/autonotify"
2424 And I wait for 3 seconds
25 # Then I wait to receive 3 requests
2625 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
2726 And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
28 # And the request 2 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
2927 And the event "unhandled" is true for request 0
3028 And the exception "errorClass" equals "*errors.errorString" for request 0
3129 And the exception "message" equals "Go routine killed with auto notify" for request 0
32 # And the event "unhandled" is true for request 2
33 # And the exception "errorClass" equals "panic" for request 2
34 # And the exception "message" equals "Go routine killed with auto notify [recovered]" for request 2
3530 And the event unhandled sessions count equals 1 for request 0
36 And the number of sessions started equals 1 for request 1
31 And the number of sessions started equals 1 for request 1
0 Feature: Plain handled errors
0 Feature: Handled errors
11
22 Background:
33 Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
1111 And I wait for 2 seconds
1212 And I open the URL "http://localhost:4514/onbeforenotify"
1313 Then I wait to receive 2 requests
14
1514 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
1615 And the exception "message" equals "Don't ignore this error" for request 0
17
1816 And the request 1 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
19 And the exception "message" equals "Error message was changed" for request 1
17 And the exception "message" equals "Error message was changed" for request 1
1111 And I open the URL "http://localhost:4514/recover"
1212 Then I wait to receive 2 requests
1313 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
14
1514 And the exception "errorClass" equals "*errors.errorString" for request 0
1615 And the exception "message" equals "Request killed but recovered" for request 0
17
1816 And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
19
2017 And the event handled sessions count equals 1 for request 0
2118 And the number of sessions started equals 1 for request 1
22
1313 Then I wait to receive 2 requests
1414 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
1515 And the event "app.releaseStage" equals "my-stage" for request 0
16
1716 And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
1817 And the payload field "app.releaseStage" equals "my-stage" for request 1
19
2018 And the event handled sessions count equals 1 for request 0
21 And the number of sessions started equals 1 for request 1
19 And the number of sessions started equals 1 for request 1
33 Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
44 And I configure the bugsnag endpoint
55 And I set environment variable "SERVER_PORT" to "4512"
6
6
77 Scenario: An error report is sent when an unhandled crash occurs
88 Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false"
99 When I start the service "nethttp"
1616 And the exception "errorClass" equals "*runtime.TypeAssertionError"
1717 And the exception "message" matches "interface conversion: interface ({} )?is struct {}, not string"
1818
19 Scenario: An error report is sent when a go routine crashes which is protected by auto notify
19 Scenario: An error report is sent when a go routine crashes which is reported through auto notify
2020 When I start the service "nethttp"
2121 And I wait for the app to open port "4512"
2222 And I wait for 2 seconds
2323 And I open the URL "http://localhost:4512/autonotify"
2424 And I wait for 3 seconds
25 # Then I wait to receive 3 requests
2625 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
2726 And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
28 # And the request 2 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
2927 And the event "unhandled" is true for request 0
3028 And the exception "errorClass" equals "*errors.errorString" for request 0
3129 And the exception "message" equals "Go routine killed with auto notify" for request 0
32 # And the event "unhandled" is true for request 2
33 # And the exception "errorClass" equals "panic" for request 2
34 # And the exception "message" equals "Go routine killed with auto notify [recovered]" for request 2
3530 And the event unhandled sessions count equals 1 for request 0
36 And the number of sessions started equals 1 for request 1
31 And the number of sessions started equals 1 for request 1
0 Feature: Plain handled errors
0 Feature: Handled errors
11
22 Background:
33 Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
1818 And the exception "errorClass" equals "*os.PathError" for request 0
1919 And the "file" of stack frame 0 equals "main.go" for request 0
2020 And the event handled sessions count equals 1 for request 0
21 And the number of sessions started equals 1 for request 1
21 And the number of sessions started equals 1 for request 1
1111 And I wait for 2 seconds
1212 And I open the URL "http://localhost:4512/onbeforenotify"
1313 Then I wait to receive 2 requests
14
1514 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
1615 And the exception "message" equals "Don't ignore this error" for request 0
17
1816 And the request 1 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
19 And the exception "message" equals "Error message was changed" for request 1
17 And the exception "message" equals "Error message was changed" for request 1
1111 And I open the URL "http://localhost:4512/recover"
1212 Then I wait to receive 2 requests
1313 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
14
1514 And the exception "errorClass" equals "*errors.errorString" for request 0
1615 And the exception "message" equals "Request killed but recovered" for request 0
17
1816 And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
19
2017 And the event handled sessions count equals 1 for request 0
21 And the number of sessions started equals 1 for request 1
18 And the number of sessions started equals 1 for request 1
1313 Then I wait to receive 2 requests
1414 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
1515 And the event "app.releaseStage" equals "my-stage" for request 0
16
1716 And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
1817 And the payload field "app.releaseStage" equals "my-stage" for request 1
19
2018 And the event handled sessions count equals 1 for request 0
2119 And the number of sessions started equals 1 for request 1
44 And I configure the bugsnag endpoint
55 And I have built the service "app"
66
7 # Scenario: An error report is sent when an unhandled crash occurs
8 # When I run the go service "app" with the test case "unhandled"
9 # Then I wait to receive a request
10 # And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
11 # And the exception "errorClass" equals "panic"
12 # And the exception "message" equals "interface conversion: interface {} is struct {}, not string"
13
14 Scenario: An error report is sent when a go routine crashes which is protected by auto notify
7 Scenario: An error report is sent when a go routine crashes which is reported through auto notify
158 When I run the go service "app" with the test case "autonotify"
169 Then I wait for 3 seconds
17 # Then I wait to receive 2 requests
18
1910 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
2011 And the exception "errorClass" equals "*errors.errorString" for request 0
2112 And the exception "message" equals "Go routine killed with auto notify" for request 0
22
23 # And the request 1 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
24 # And the exception "errorClass" equals "panic" for request 1
25 # And the exception "message" equals "Go routine killed with auto notify [recovered]" for request 1
77 Scenario: Send three bugsnags and use on before notify to drop one and modify the message of another
88 When I run the go service "app" with the test case "onbeforenotify"
99 Then I wait to receive 2 requests
10
1110 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
1211 And the exception "message" equals "Don't ignore this error" for request 0
13
1412 And the request 1 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
1513 And the exception "message" equals "Error message was changed" for request 1
16
1818 Then I wait to receive a request
1919 And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
2020 And the event "app.releaseStage" equals "stage2"
21
21
2222 Scenario: An error report is sent regardless of notify release stages if release stage is not set
2323 Given I set environment variable "NOTIFY_RELEASE_STAGES" to "stage1,stage2,stage3"
2424 When I run the go service "app" with the test case "handled"
2525 Then I wait to receive a request
2626 And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
2727
28 Scenario: An error report is not sent if the release stage doesn't match the notify release stages
28 Scenario: An error report is not sent if the release stage does not match the notify release stages
2929 Given I set environment variable "NOTIFY_RELEASE_STAGES" to "stage1,stage2,stage3"
3030 And I set environment variable "RELEASE_STAGE" to "stage4"
3131 When I run the go service "app" with the test case "handled"
3232 And I wait for 3 second
3333 Then I should receive no requests
34
35
3634
3735 Scenario: An session report is sent when release stage matches notify release stages
3836 Given I set environment variable "NOTIFY_RELEASE_STAGES" to "stage1,stage2,stage3"
4846 Then I wait to receive a request
4947 And the request is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
5048 And the payload field "app.releaseStage" equals "stage2"
51
49
5250 Scenario: An session report is sent regardless of notify release stages if release stage is not set
5351 Given I set environment variable "NOTIFY_RELEASE_STAGES" to "stage1,stage2,stage3"
5452 When I run the go service "app" with the test case "session"
5553 Then I wait to receive a request
5654 And the request is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
5755
58 Scenario: An session report is not sent if the release stage doesn't match the notify release stages
56 Scenario: An session report is not sent if the release stage does not match the notify release stages
5957 Given I set environment variable "NOTIFY_RELEASE_STAGES" to "stage1,stage2,stage3"
6058 And I set environment variable "RELEASE_STAGE" to "stage4"
6159 When I run the go service "app" with the test case "session"
44 And I configure the bugsnag endpoint
55 And I set environment variable "APP_VERSION" to "3.1.2"
66 And I set environment variable "SERVER_PORT" to "4515"
7 And I set environment variable "USE_CODE_CONFIG" to "true"
87
9 Scenario: A error report contains the configured app type when using a gin
8 Scenario: A error report contains the configured app type
109 Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false"
1110 When I start the service "revel"
1211 And I wait for the app to open port "4515"
1615 And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
1716 And the event "app.version" equals "3.1.2"
1817
19 Scenario: A session report contains the configured app type when using gin
18 Scenario: A session report contains the configured app type
2019 When I start the service "revel"
2120 And I wait for the app to open port "4515"
2221 And I wait for 4 seconds
2322 And I open the URL "http://localhost:4515/session"
2423 Then I wait to receive a request
2524 And the request is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
26 And the payload field "app.version" equals "3.1.2"
25 And the payload field "app.version" equals "3.1.2"
33 Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
44 And I configure the bugsnag endpoint
55 And I set environment variable "SERVER_PORT" to "4515"
6 And I set environment variable "USE_CODE_CONFIG" to "true"
76
87 Scenario: A session is not sent if auto capture sessions is off
98 Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false"
2120 And I wait for 4 seconds
2221 And I open the URL "http://localhost:4515/session"
2322 Then I wait to receive a request
24 And the request is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
23 And the request is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
33 Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
44 And I configure the bugsnag endpoint
55 And I set environment variable "SERVER_PORT" to "4515"
6 And I set environment variable "USE_CODE_CONFIG" to "true"
7
6
87 Scenario: An error report is sent when an unhandled crash occurs
98 Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false"
109 When I start the service "revel"
1312 And I open the URL "http://localhost:4515/unhandled"
1413 Then I wait to receive a request
1514 And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
16 And the event "unhandled" is true
15 And the event "unhandled" is true
1716 And the exception "errorClass" equals "*runtime.TypeAssertionError"
1817 And the exception "message" matches "interface conversion: interface ({} )?is struct {}, not string"
1918
20 Scenario: An error report is sent when a go routine crashes which is protected by auto notify
19 Scenario: An error report is sent when a go routine crashes which is reported through auto notify
2120 When I start the service "revel"
2221 And I wait for the app to open port "4515"
2322 And I wait for 4 seconds
2423 And I open the URL "http://localhost:4515/autonotify"
2524 And I wait for 3 seconds
26 # Then I wait to receive 3 requests
2725 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
2826 And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
29 # And the request 2 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
3027 And the event "unhandled" is true for request 0
3128 And the exception "errorClass" equals "*errors.errorString" for request 0
3229 And the exception "message" equals "Go routine killed with auto notify" for request 0
33 # And the event "unhandled" is true for request 2
34 # And the exception "errorClass" equals "panic" for request 2
35 # And the exception "message" equals "Go routine killed with auto notify [recovered]" for request 2
3630 And the event unhandled sessions count equals 1 for request 0
37 And the number of sessions started equals 1 for request 1
31 And the number of sessions started equals 1 for request 1
11
22 Background:
33 Given I configure the bugsnag endpoint
4 And I set environment variable "USE_PROPERTIES_FILE_CONFIG" to "true"
45
56 Scenario: A error report contains the variables set in the config file
67 When I start the service "revel"
1213 And the event "app.version" equals "4.5.6"
1314 And the event "app.type" equals "config-file-app-type"
1415 And the event "app.releaseStage" equals "config-test"
15 And the event "device.hostname" equals "config-file-server"
16 And the event "device.hostname" equals "config-file-server"
0 Feature: Plain handled errors
0 Feature: Handled errors
11
22 Background:
33 Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
44 And I configure the bugsnag endpoint
55 And I set environment variable "SERVER_PORT" to "4515"
6 And I set environment variable "USE_CODE_CONFIG" to "true"
76
87 Scenario: A handled error sends a report
98 When I start the service "revel"
44 And I configure the bugsnag endpoint
55 And I set environment variable "SERVER_PORT" to "4515"
66 And I set environment variable "AUTO_CAPTURE_SESSIONS" to "false"
7 And I set environment variable "USE_CODE_CONFIG" to "true"
87
98 Scenario: Send three bugsnags and use on before notify to drop one and modify the message of another
109 When I start the service "revel"
1211 And I wait for 4 seconds
1312 And I open the URL "http://localhost:4515/onbeforenotify"
1413 Then I wait to receive 2 requests
15
1614 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
1715 And the exception "message" equals "Don't ignore this error" for request 0
18
1916 And the request 1 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
20 And the exception "message" equals "Error message was changed" for request 1
17 And the exception "message" equals "Error message was changed" for request 1
33 Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
44 And I configure the bugsnag endpoint
55 And I set environment variable "SERVER_PORT" to "4515"
6 And I set environment variable "USE_CODE_CONFIG" to "true"
76
87 Scenario: An error report and session is sent when request crashes but is recovered
98 When I start the service "revel"
1211 And I open the URL "http://localhost:4515/recover"
1312 Then I wait to receive 2 requests
1413 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
15
1614 And the exception "errorClass" equals "*errors.errorString" for request 0
1715 And the exception "message" equals "Request killed but recovered" for request 0
18
1916 And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
20
2117 And the event handled sessions count equals 1 for request 0
2218 And the number of sessions started equals 1 for request 1
23
33 Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
44 And I configure the bugsnag endpoint
55 And I set environment variable "SERVER_PORT" to "4515"
6 And I set environment variable "USE_CODE_CONFIG" to "true"
76
87 Scenario Outline: An error report and session is sent with configured release stage
98 Given I set environment variable "RELEASE_STAGE" to "my-stage"
1413 Then I wait to receive 2 requests
1514 And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
1615 And the event "app.releaseStage" equals "my-stage" for request 0
17
1816 And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
1917 And the payload field "app.releaseStage" equals "my-stage" for request 1
20
2118 And the event handled sessions count equals 1 for request 0
22 And the number of sessions started equals 1 for request 1
19 And the number of sessions started equals 1 for request 1
33 Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
44 And I configure the bugsnag endpoint
55 And I set environment variable "SERVER_PORT" to "4515"
6 And I set environment variable "USE_CODE_CONFIG" to "true"
76
87 Scenario: An error report will automatically contain request information
98 When I start the service "revel"
33 Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
44 And I configure the bugsnag endpoint
55 And I set environment variable "SERVER_PORT" to "4515"
6 And I set environment variable "USE_CODE_CONFIG" to "true"
76
87 Scenario: An error report contains custom user data
98 Given I set environment variable "USER_ID" to "test-user-id"
44 end
55
66 Then(/^the request(?: (\d+))? is a valid error report with api key "(.*)"$/) do |request_index, api_key|
7 request_index ||= 0
7 request_index ||= 0
88 steps %Q{
99 And the request #{request_index} is valid for the error reporting API
1010 And the "bugsnag-api-key" header equals "#{api_key}" for request #{request_index}
1313 end
1414
1515 Then(/^the request(?: (\d+))? is a valid session report with api key "(.*)"$/) do |request_index, api_key|
16 request_index ||= 0
16 request_index ||= 0
1717 steps %Q{
1818 And the request #{request_index} is valid for the session tracking API
1919 And the "bugsnag-api-key" header equals "#{api_key}" for request #{request_index}
66 FileUtils.rm_rf(testBuildFolder)
77 Dir.mkdir testBuildFolder
88
9 # Copy the existing air
9 # Copy the existing dir
1010 `find . -name '*.go' \
1111 -not -path "./examples/*" \
1212 -not -path "./testutil/*" \
1313 -not -path "./features/*" \
1414 -not -name '*_test.go' | cpio -pdm #{testBuildFolder}`
15
16 # Scenario hooks
17 Before do
18 # Runs before every Scenario
19 end
20
21 After do
22 # Runs after every Scenario
23 end
24
25 at_exit do
26
27 end
2815
2916 def port_open?(ip, port, seconds=1)
3017 Timeout::timeout(seconds) do
4936 sleep 1
5037 end
5138 raise "Port not ready in time!" unless up
52 end
39 end