[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
194 | 194 | |
195 | 195 | time.Sleep(200 * time.Millisecond) |
196 | 196 | } |
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 | // } |
134 | 134 | - AUTO_CAPTURE_SESSIONS |
135 | 135 | - SYNCHRONOUS |
136 | 136 | - SERVER_PORT |
137 | - USE_CODE_CONFIG | |
137 | - USE_PROPERTIES_FILE_CONFIG | |
138 | 138 | restart: "no" |
139 | 139 | command: ./test/run.sh |
47 | 47 | |
48 | 48 | bugsnag.DefaultSessionPublishInterval = time.Millisecond * 300 |
49 | 49 | |
50 | if os.Getenv("USE_CODE_CONFIG") == "" { | |
50 | if os.Getenv("USE_PROPERTIES_FILE_CONFIG") != "" { | |
51 | 51 | return |
52 | 52 | } |
53 | 53 |
118 | 118 | # Allows Routes like this: |
119 | 119 | # `Static.ServeModule("modulename","public")` |
120 | 120 | 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= | |
137 | 121 | |
138 | 122 | ################################################################################ |
139 | 123 | |
243 | 227 | log.request.output = log/%(app.name)s-requests.json |
244 | 228 | |
245 | 229 | |
230 | # This profile will only be used when the USE_PROPERTIES_FILE_CONFIG environment variable is set | |
231 | ||
246 | 232 | [configfile] |
247 | 233 | mode.dev = true |
248 | 234 | watch = true |
1 | 1 | |
2 | 2 | set -e |
3 | 3 | |
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}" ] | |
5 | 6 | then |
7 | $GOPATH/bin/revel run test | |
8 | else | |
6 | 9 | $GOPATH/bin/revel run test configfile |
7 | else | |
8 | $GOPATH/bin/revel run test | |
9 | 10 | fi |
3 | 3 | Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" |
4 | 4 | And I configure the bugsnag endpoint |
5 | 5 | And I set environment variable "SERVER_PORT" to "4511" |
6 | ||
6 | ||
7 | 7 | Scenario: An error report is sent when an unhandled crash occurs |
8 | 8 | Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false" |
9 | 9 | When I start the service "gin" |
16 | 16 | And the exception "errorClass" equals "*runtime.TypeAssertionError" |
17 | 17 | And the exception "message" matches "interface conversion: interface ({} )?is struct {}, not string" |
18 | 18 | |
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 | |
20 | 20 | When I start the service "gin" |
21 | 21 | And I wait for the app to open port "4511" |
22 | 22 | And I wait for 2 seconds |
23 | 23 | And I open the URL "http://localhost:4511/autonotify" |
24 | 24 | And I wait for 3 seconds |
25 | # Then I wait to receive 3 requests | |
26 | 25 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
27 | 26 | 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" | |
29 | 27 | And the event "unhandled" is true for request 0 |
30 | 28 | And the exception "errorClass" equals "*errors.errorString" for request 0 |
31 | 29 | 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 | |
35 | 30 | 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 | |
1 | 1 | |
2 | 2 | Background: |
3 | 3 | Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" |
11 | 11 | And I wait for 2 seconds |
12 | 12 | And I open the URL "http://localhost:4511/onbeforenotify" |
13 | 13 | Then I wait to receive 2 requests |
14 | ||
15 | 14 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
16 | 15 | And the exception "message" equals "Don't ignore this error" for request 0 |
17 | ||
18 | 16 | And the request 1 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
19 | 17 | And the exception "message" equals "Error message was changed" for request 1 |
20 | ⏎ |
11 | 11 | And I open the URL "http://localhost:4511/recover" |
12 | 12 | Then I wait to receive 2 requests |
13 | 13 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
14 | ||
15 | 14 | And the exception "errorClass" equals "*errors.errorString" for request 0 |
16 | 15 | And the exception "message" equals "Request killed but recovered" for request 0 |
17 | ||
18 | 16 | And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
19 | ||
20 | 17 | And the event handled sessions count equals 1 for request 0 |
21 | 18 | And the number of sessions started equals 1 for request 1 |
22 |
13 | 13 | Then I wait to receive 2 requests |
14 | 14 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
15 | 15 | And the event "app.releaseStage" equals "my-stage" for request 0 |
16 | ||
17 | 16 | And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
18 | 17 | And the payload field "app.releaseStage" equals "my-stage" for request 1 |
19 | ||
20 | 18 | 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 |
3 | 3 | Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" |
4 | 4 | And I configure the bugsnag endpoint |
5 | 5 | And I set environment variable "SERVER_PORT" to "4513" |
6 | ||
6 | ||
7 | 7 | Scenario: An error report is sent when an unhandled crash occurs |
8 | 8 | Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false" |
9 | 9 | When I start the service "martini" |
12 | 12 | And I open the URL "http://localhost:4513/unhandled" |
13 | 13 | Then I wait to receive a request |
14 | 14 | 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 | |
16 | 16 | And the exception "errorClass" equals "*runtime.TypeAssertionError" |
17 | 17 | And the exception "message" matches "interface conversion: interface ({} )?is struct {}, not string" |
18 | 18 | |
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 | |
20 | 20 | When I start the service "martini" |
21 | 21 | And I wait for the app to open port "4513" |
22 | 22 | And I wait for 2 seconds |
23 | 23 | And I open the URL "http://localhost:4513/autonotify" |
24 | 24 | And I wait for 3 seconds |
25 | # Then I wait to receive 3 requests | |
26 | 25 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
27 | 26 | 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" | |
29 | 27 | And the event "unhandled" is true for request 0 |
30 | 28 | And the exception "errorClass" equals "*errors.errorString" for request 0 |
31 | 29 | 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 | |
35 | 30 | 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 | |
1 | 1 | |
2 | 2 | Background: |
3 | 3 | Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" |
19 | 19 | And the "file" of stack frame 0 equals "main.go" for request 0 |
20 | 20 | And the event handled sessions count equals 1 for request 0 |
21 | 21 | And the number of sessions started equals 1 for request 1 |
22 | ⏎ |
11 | 11 | And I wait for 2 seconds |
12 | 12 | And I open the URL "http://localhost:4513/onbeforenotify" |
13 | 13 | Then I wait to receive 2 requests |
14 | ||
15 | 14 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
16 | 15 | And the exception "message" equals "Don't ignore this error" for request 0 |
17 | ||
18 | 16 | 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 |
11 | 11 | And I open the URL "http://localhost:4513/recover" |
12 | 12 | Then I wait to receive 2 requests |
13 | 13 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
14 | ||
15 | 14 | And the exception "errorClass" equals "*errors.errorString" for request 0 |
16 | 15 | And the exception "message" equals "Request killed but recovered" for request 0 |
17 | ||
18 | 16 | And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
19 | ||
20 | 17 | And the event handled sessions count equals 1 for request 0 |
21 | 18 | And the number of sessions started equals 1 for request 1 |
13 | 13 | Then I wait to receive 2 requests |
14 | 14 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
15 | 15 | And the event "app.releaseStage" equals "my-stage" for request 0 |
16 | ||
17 | 16 | And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
18 | 17 | And the payload field "app.releaseStage" equals "my-stage" for request 1 |
19 | ||
20 | 18 | And the event handled sessions count equals 1 for request 0 |
21 | 19 | And the number of sessions started equals 1 for request 1 |
5 | 5 | And I set environment variable "APP_VERSION" to "3.1.2" |
6 | 6 | And I set environment variable "SERVER_PORT" to "4514" |
7 | 7 | |
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 | |
9 | 9 | Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false" |
10 | 10 | When I start the service "negroni" |
11 | 11 | And I wait for the app to open port "4514" |
15 | 15 | And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
16 | 16 | And the event "app.version" equals "3.1.2" |
17 | 17 | |
18 | Scenario: A session report contains the configured app type when using gin | |
18 | Scenario: A session report contains the configured app type | |
19 | 19 | When I start the service "negroni" |
20 | 20 | And I wait for the app to open port "4514" |
21 | 21 | And I wait for 2 seconds |
22 | 22 | And I open the URL "http://localhost:4514/session" |
23 | 23 | Then I wait to receive a request |
24 | 24 | 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" |
3 | 3 | Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" |
4 | 4 | And I configure the bugsnag endpoint |
5 | 5 | And I set environment variable "SERVER_PORT" to "4514" |
6 | ||
6 | ||
7 | 7 | Scenario: An error report is sent when an unhandled crash occurs |
8 | 8 | Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false" |
9 | 9 | When I start the service "negroni" |
12 | 12 | And I open the URL "http://localhost:4514/unhandled" |
13 | 13 | Then I wait to receive a request |
14 | 14 | 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 | |
16 | 16 | And the exception "errorClass" equals "*runtime.TypeAssertionError" |
17 | 17 | And the exception "message" matches "interface conversion: interface ({} )?is struct {}, not string" |
18 | 18 | |
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 | |
20 | 20 | Given I start the service "negroni" |
21 | 21 | And I wait for the app to open port "4514" |
22 | 22 | And I wait for 2 seconds |
23 | 23 | And I open the URL "http://localhost:4514/autonotify" |
24 | 24 | And I wait for 3 seconds |
25 | # Then I wait to receive 3 requests | |
26 | 25 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
27 | 26 | 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" | |
29 | 27 | And the event "unhandled" is true for request 0 |
30 | 28 | And the exception "errorClass" equals "*errors.errorString" for request 0 |
31 | 29 | 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 | |
35 | 30 | 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 | |
1 | 1 | |
2 | 2 | Background: |
3 | 3 | Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" |
11 | 11 | And I wait for 2 seconds |
12 | 12 | And I open the URL "http://localhost:4514/onbeforenotify" |
13 | 13 | Then I wait to receive 2 requests |
14 | ||
15 | 14 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
16 | 15 | And the exception "message" equals "Don't ignore this error" for request 0 |
17 | ||
18 | 16 | 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 |
11 | 11 | And I open the URL "http://localhost:4514/recover" |
12 | 12 | Then I wait to receive 2 requests |
13 | 13 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
14 | ||
15 | 14 | And the exception "errorClass" equals "*errors.errorString" for request 0 |
16 | 15 | And the exception "message" equals "Request killed but recovered" for request 0 |
17 | ||
18 | 16 | And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
19 | ||
20 | 17 | And the event handled sessions count equals 1 for request 0 |
21 | 18 | And the number of sessions started equals 1 for request 1 |
22 |
13 | 13 | Then I wait to receive 2 requests |
14 | 14 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
15 | 15 | And the event "app.releaseStage" equals "my-stage" for request 0 |
16 | ||
17 | 16 | And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
18 | 17 | And the payload field "app.releaseStage" equals "my-stage" for request 1 |
19 | ||
20 | 18 | 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 |
3 | 3 | Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" |
4 | 4 | And I configure the bugsnag endpoint |
5 | 5 | And I set environment variable "SERVER_PORT" to "4512" |
6 | ||
6 | ||
7 | 7 | Scenario: An error report is sent when an unhandled crash occurs |
8 | 8 | Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false" |
9 | 9 | When I start the service "nethttp" |
16 | 16 | And the exception "errorClass" equals "*runtime.TypeAssertionError" |
17 | 17 | And the exception "message" matches "interface conversion: interface ({} )?is struct {}, not string" |
18 | 18 | |
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 | |
20 | 20 | When I start the service "nethttp" |
21 | 21 | And I wait for the app to open port "4512" |
22 | 22 | And I wait for 2 seconds |
23 | 23 | And I open the URL "http://localhost:4512/autonotify" |
24 | 24 | And I wait for 3 seconds |
25 | # Then I wait to receive 3 requests | |
26 | 25 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
27 | 26 | 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" | |
29 | 27 | And the event "unhandled" is true for request 0 |
30 | 28 | And the exception "errorClass" equals "*errors.errorString" for request 0 |
31 | 29 | 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 | |
35 | 30 | 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 | |
1 | 1 | |
2 | 2 | Background: |
3 | 3 | Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" |
18 | 18 | And the exception "errorClass" equals "*os.PathError" for request 0 |
19 | 19 | And the "file" of stack frame 0 equals "main.go" for request 0 |
20 | 20 | 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 |
11 | 11 | And I wait for 2 seconds |
12 | 12 | And I open the URL "http://localhost:4512/onbeforenotify" |
13 | 13 | Then I wait to receive 2 requests |
14 | ||
15 | 14 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
16 | 15 | And the exception "message" equals "Don't ignore this error" for request 0 |
17 | ||
18 | 16 | 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 |
11 | 11 | And I open the URL "http://localhost:4512/recover" |
12 | 12 | Then I wait to receive 2 requests |
13 | 13 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
14 | ||
15 | 14 | And the exception "errorClass" equals "*errors.errorString" for request 0 |
16 | 15 | And the exception "message" equals "Request killed but recovered" for request 0 |
17 | ||
18 | 16 | And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
19 | ||
20 | 17 | 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 |
13 | 13 | Then I wait to receive 2 requests |
14 | 14 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
15 | 15 | And the event "app.releaseStage" equals "my-stage" for request 0 |
16 | ||
17 | 16 | And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
18 | 17 | And the payload field "app.releaseStage" equals "my-stage" for request 1 |
19 | ||
20 | 18 | And the event handled sessions count equals 1 for request 0 |
21 | 19 | And the number of sessions started equals 1 for request 1 |
4 | 4 | And I configure the bugsnag endpoint |
5 | 5 | And I have built the service "app" |
6 | 6 | |
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 | |
15 | 8 | When I run the go service "app" with the test case "autonotify" |
16 | 9 | Then I wait for 3 seconds |
17 | # Then I wait to receive 2 requests | |
18 | ||
19 | 10 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
20 | 11 | And the exception "errorClass" equals "*errors.errorString" for request 0 |
21 | 12 | 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⏎ |
7 | 7 | Scenario: Send three bugsnags and use on before notify to drop one and modify the message of another |
8 | 8 | When I run the go service "app" with the test case "onbeforenotify" |
9 | 9 | Then I wait to receive 2 requests |
10 | ||
11 | 10 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
12 | 11 | And the exception "message" equals "Don't ignore this error" for request 0 |
13 | ||
14 | 12 | And the request 1 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
15 | 13 | And the exception "message" equals "Error message was changed" for request 1 |
16 |
18 | 18 | Then I wait to receive a request |
19 | 19 | And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
20 | 20 | And the event "app.releaseStage" equals "stage2" |
21 | ||
21 | ||
22 | 22 | Scenario: An error report is sent regardless of notify release stages if release stage is not set |
23 | 23 | Given I set environment variable "NOTIFY_RELEASE_STAGES" to "stage1,stage2,stage3" |
24 | 24 | When I run the go service "app" with the test case "handled" |
25 | 25 | Then I wait to receive a request |
26 | 26 | And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
27 | 27 | |
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 | |
29 | 29 | Given I set environment variable "NOTIFY_RELEASE_STAGES" to "stage1,stage2,stage3" |
30 | 30 | And I set environment variable "RELEASE_STAGE" to "stage4" |
31 | 31 | When I run the go service "app" with the test case "handled" |
32 | 32 | And I wait for 3 second |
33 | 33 | Then I should receive no requests |
34 | ||
35 | ||
36 | 34 | |
37 | 35 | Scenario: An session report is sent when release stage matches notify release stages |
38 | 36 | Given I set environment variable "NOTIFY_RELEASE_STAGES" to "stage1,stage2,stage3" |
48 | 46 | Then I wait to receive a request |
49 | 47 | And the request is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
50 | 48 | And the payload field "app.releaseStage" equals "stage2" |
51 | ||
49 | ||
52 | 50 | Scenario: An session report is sent regardless of notify release stages if release stage is not set |
53 | 51 | Given I set environment variable "NOTIFY_RELEASE_STAGES" to "stage1,stage2,stage3" |
54 | 52 | When I run the go service "app" with the test case "session" |
55 | 53 | Then I wait to receive a request |
56 | 54 | And the request is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
57 | 55 | |
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 | |
59 | 57 | Given I set environment variable "NOTIFY_RELEASE_STAGES" to "stage1,stage2,stage3" |
60 | 58 | And I set environment variable "RELEASE_STAGE" to "stage4" |
61 | 59 | When I run the go service "app" with the test case "session" |
4 | 4 | And I configure the bugsnag endpoint |
5 | 5 | And I set environment variable "APP_VERSION" to "3.1.2" |
6 | 6 | And I set environment variable "SERVER_PORT" to "4515" |
7 | And I set environment variable "USE_CODE_CONFIG" to "true" | |
8 | 7 | |
9 | Scenario: A error report contains the configured app type when using a gin | |
8 | Scenario: A error report contains the configured app type | |
10 | 9 | Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false" |
11 | 10 | When I start the service "revel" |
12 | 11 | And I wait for the app to open port "4515" |
16 | 15 | And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
17 | 16 | And the event "app.version" equals "3.1.2" |
18 | 17 | |
19 | Scenario: A session report contains the configured app type when using gin | |
18 | Scenario: A session report contains the configured app type | |
20 | 19 | When I start the service "revel" |
21 | 20 | And I wait for the app to open port "4515" |
22 | 21 | And I wait for 4 seconds |
23 | 22 | And I open the URL "http://localhost:4515/session" |
24 | 23 | Then I wait to receive a request |
25 | 24 | 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" |
3 | 3 | Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" |
4 | 4 | And I configure the bugsnag endpoint |
5 | 5 | And I set environment variable "SERVER_PORT" to "4515" |
6 | And I set environment variable "USE_CODE_CONFIG" to "true" | |
7 | 6 | |
8 | 7 | Scenario: A session is not sent if auto capture sessions is off |
9 | 8 | Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false" |
21 | 20 | And I wait for 4 seconds |
22 | 21 | And I open the URL "http://localhost:4515/session" |
23 | 22 | 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" |
3 | 3 | Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" |
4 | 4 | And I configure the bugsnag endpoint |
5 | 5 | And I set environment variable "SERVER_PORT" to "4515" |
6 | And I set environment variable "USE_CODE_CONFIG" to "true" | |
7 | ||
6 | ||
8 | 7 | Scenario: An error report is sent when an unhandled crash occurs |
9 | 8 | Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false" |
10 | 9 | When I start the service "revel" |
13 | 12 | And I open the URL "http://localhost:4515/unhandled" |
14 | 13 | Then I wait to receive a request |
15 | 14 | 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 | |
17 | 16 | And the exception "errorClass" equals "*runtime.TypeAssertionError" |
18 | 17 | And the exception "message" matches "interface conversion: interface ({} )?is struct {}, not string" |
19 | 18 | |
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 | |
21 | 20 | When I start the service "revel" |
22 | 21 | And I wait for the app to open port "4515" |
23 | 22 | And I wait for 4 seconds |
24 | 23 | And I open the URL "http://localhost:4515/autonotify" |
25 | 24 | And I wait for 3 seconds |
26 | # Then I wait to receive 3 requests | |
27 | 25 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
28 | 26 | 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" | |
30 | 27 | And the event "unhandled" is true for request 0 |
31 | 28 | And the exception "errorClass" equals "*errors.errorString" for request 0 |
32 | 29 | 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 | |
36 | 30 | 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 |
1 | 1 | |
2 | 2 | Background: |
3 | 3 | Given I configure the bugsnag endpoint |
4 | And I set environment variable "USE_PROPERTIES_FILE_CONFIG" to "true" | |
4 | 5 | |
5 | 6 | Scenario: A error report contains the variables set in the config file |
6 | 7 | When I start the service "revel" |
12 | 13 | And the event "app.version" equals "4.5.6" |
13 | 14 | And the event "app.type" equals "config-file-app-type" |
14 | 15 | 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 | |
1 | 1 | |
2 | 2 | Background: |
3 | 3 | Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" |
4 | 4 | And I configure the bugsnag endpoint |
5 | 5 | And I set environment variable "SERVER_PORT" to "4515" |
6 | And I set environment variable "USE_CODE_CONFIG" to "true" | |
7 | 6 | |
8 | 7 | Scenario: A handled error sends a report |
9 | 8 | When I start the service "revel" |
4 | 4 | And I configure the bugsnag endpoint |
5 | 5 | And I set environment variable "SERVER_PORT" to "4515" |
6 | 6 | And I set environment variable "AUTO_CAPTURE_SESSIONS" to "false" |
7 | And I set environment variable "USE_CODE_CONFIG" to "true" | |
8 | 7 | |
9 | 8 | Scenario: Send three bugsnags and use on before notify to drop one and modify the message of another |
10 | 9 | When I start the service "revel" |
12 | 11 | And I wait for 4 seconds |
13 | 12 | And I open the URL "http://localhost:4515/onbeforenotify" |
14 | 13 | Then I wait to receive 2 requests |
15 | ||
16 | 14 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
17 | 15 | And the exception "message" equals "Don't ignore this error" for request 0 |
18 | ||
19 | 16 | 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 |
3 | 3 | Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" |
4 | 4 | And I configure the bugsnag endpoint |
5 | 5 | And I set environment variable "SERVER_PORT" to "4515" |
6 | And I set environment variable "USE_CODE_CONFIG" to "true" | |
7 | 6 | |
8 | 7 | Scenario: An error report and session is sent when request crashes but is recovered |
9 | 8 | When I start the service "revel" |
12 | 11 | And I open the URL "http://localhost:4515/recover" |
13 | 12 | Then I wait to receive 2 requests |
14 | 13 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
15 | ||
16 | 14 | And the exception "errorClass" equals "*errors.errorString" for request 0 |
17 | 15 | And the exception "message" equals "Request killed but recovered" for request 0 |
18 | ||
19 | 16 | And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
20 | ||
21 | 17 | And the event handled sessions count equals 1 for request 0 |
22 | 18 | And the number of sessions started equals 1 for request 1 |
23 |
3 | 3 | Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" |
4 | 4 | And I configure the bugsnag endpoint |
5 | 5 | And I set environment variable "SERVER_PORT" to "4515" |
6 | And I set environment variable "USE_CODE_CONFIG" to "true" | |
7 | 6 | |
8 | 7 | Scenario Outline: An error report and session is sent with configured release stage |
9 | 8 | Given I set environment variable "RELEASE_STAGE" to "my-stage" |
14 | 13 | Then I wait to receive 2 requests |
15 | 14 | And the request 0 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
16 | 15 | And the event "app.releaseStage" equals "my-stage" for request 0 |
17 | ||
18 | 16 | And the request 1 is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa" |
19 | 17 | And the payload field "app.releaseStage" equals "my-stage" for request 1 |
20 | ||
21 | 18 | 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 |
3 | 3 | Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" |
4 | 4 | And I configure the bugsnag endpoint |
5 | 5 | And I set environment variable "SERVER_PORT" to "4515" |
6 | And I set environment variable "USE_CODE_CONFIG" to "true" | |
7 | 6 | |
8 | 7 | Scenario: An error report will automatically contain request information |
9 | 8 | When I start the service "revel" |
3 | 3 | Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa" |
4 | 4 | And I configure the bugsnag endpoint |
5 | 5 | And I set environment variable "SERVER_PORT" to "4515" |
6 | And I set environment variable "USE_CODE_CONFIG" to "true" | |
7 | 6 | |
8 | 7 | Scenario: An error report contains custom user data |
9 | 8 | Given I set environment variable "USER_ID" to "test-user-id" |
4 | 4 | end |
5 | 5 | |
6 | 6 | 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 | |
8 | 8 | steps %Q{ |
9 | 9 | And the request #{request_index} is valid for the error reporting API |
10 | 10 | And the "bugsnag-api-key" header equals "#{api_key}" for request #{request_index} |
13 | 13 | end |
14 | 14 | |
15 | 15 | 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 | |
17 | 17 | steps %Q{ |
18 | 18 | And the request #{request_index} is valid for the session tracking API |
19 | 19 | And the "bugsnag-api-key" header equals "#{api_key}" for request #{request_index} |
6 | 6 | FileUtils.rm_rf(testBuildFolder) |
7 | 7 | Dir.mkdir testBuildFolder |
8 | 8 | |
9 | # Copy the existing air | |
9 | # Copy the existing dir | |
10 | 10 | `find . -name '*.go' \ |
11 | 11 | -not -path "./examples/*" \ |
12 | 12 | -not -path "./testutil/*" \ |
13 | 13 | -not -path "./features/*" \ |
14 | 14 | -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 | |
28 | 15 | |
29 | 16 | def port_open?(ip, port, seconds=1) |
30 | 17 | Timeout::timeout(seconds) do |
49 | 36 | sleep 1 |
50 | 37 | end |
51 | 38 | raise "Port not ready in time!" unless up |
52 | end⏎ | |
39 | end |