-
Notifications
You must be signed in to change notification settings - Fork 174
/
Copy pathrack.feature
232 lines (220 loc) · 12.1 KB
/
rack.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
Feature: Bugsnag raises errors in Rack
Scenario: An unhandled RuntimeError sends a report
Given I start the rack service
When I navigate to the route "/unhandled?a=123&b=456" on the rack app
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is true
And the event "severity" equals "error"
And the event "severityReason.type" equals "unhandledExceptionMiddleware"
And the event "severityReason.attributes.framework" equals "Rack"
And the event "app.type" equals "rack"
And the exception "errorClass" equals "RuntimeError"
And the event "metaData.request.body" is null
And the event "metaData.request.clientIp" is not null
And the event "metaData.request.cookies" is null
And the event "metaData.request.headers.Host" is not null
And the event "metaData.request.headers.User-Agent" is not null
And the event "metaData.request.httpMethod" equals "GET"
And the event "metaData.request.httpVersion" matches "^HTTP/\d\.\d$"
And the event "metaData.request.params.a" equals "123"
And the event "metaData.request.params.b" equals "456"
And the event "metaData.request.referer" is null
And the event "metaData.request.url" ends with "/unhandled?a=123&b=456"
Scenario: A handled RuntimeError sends a report
Given I start the rack service
When I navigate to the route "/handled?a=123&b=456" on the rack app
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is false
And the event "severity" equals "warning"
And the event "severityReason.type" equals "handledException"
And the event "app.type" equals "rack"
And the exception "errorClass" equals "RuntimeError"
And the event "metaData.request.body" is null
And the event "metaData.request.clientIp" is not null
And the event "metaData.request.cookies" is null
And the event "metaData.request.headers.Host" is not null
And the event "metaData.request.headers.User-Agent" is not null
And the event "metaData.request.httpMethod" equals "GET"
And the event "metaData.request.httpVersion" matches "^HTTP/\d\.\d$"
And the event "metaData.request.params.a" equals "123"
And the event "metaData.request.params.b" equals "456"
And the event "metaData.request.referer" is null
And the event "metaData.request.url" ends with "/handled?a=123&b=456"
Scenario: A POST request with form data sends a report with the parsed request body attached
Given I start the rack service
When I send a POST request to "/unhandled?a=123&b=456" in the rack app with the following form data:
| name | baba |
| favourite_letter | z |
| password | password1 |
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "metaData.request.body.name" equals "baba"
And the event "metaData.request.body.favourite_letter" equals "z"
And the event "metaData.request.body.password" equals "[FILTERED]"
And the event "metaData.request.clientIp" is not null
And the event "metaData.request.cookies" is null
And the event "metaData.request.headers.Host" is not null
And the event "metaData.request.headers.User-Agent" is not null
And the event "metaData.request.httpMethod" equals "POST"
And the event "metaData.request.httpVersion" matches "^HTTP/\d\.\d$"
And the event "metaData.request.params.a" equals "123"
And the event "metaData.request.params.b" equals "456"
And the event "metaData.request.params.name" equals "baba"
And the event "metaData.request.params.favourite_letter" equals "z"
And the event "metaData.request.params.password" equals "[FILTERED]"
And the event "metaData.request.referer" is null
And the event "metaData.request.url" ends with "/unhandled?a=123&b=456"
Scenario: A POST request with JSON sends a report with the parsed request body attached
Given I start the rack service
When I send a POST request to "/unhandled?a=123&b=456" in the rack app with the following JSON:
| name | baba |
| favourite_letter | z |
| password | password1 |
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "metaData.request.body.name" equals "baba"
And the event "metaData.request.body.favourite_letter" equals "z"
And the event "metaData.request.body.password" equals "[FILTERED]"
And the event "metaData.request.clientIp" is not null
And the event "metaData.request.cookies" is null
And the event "metaData.request.headers.Host" is not null
And the event "metaData.request.headers.User-Agent" is not null
And the event "metaData.request.httpMethod" equals "POST"
And the event "metaData.request.httpVersion" matches "^HTTP/\d\.\d$"
And the event "metaData.request.params.a" equals "123"
And the event "metaData.request.params.b" equals "456"
And the event "metaData.request.params.name" is null
And the event "metaData.request.params.favourite_letter" is null
And the event "metaData.request.params.password" is null
And the event "metaData.request.referer" is null
And the event "metaData.request.url" ends with "/unhandled?a=123&b=456"
Scenario: A request with cookies will be filtered out by default
Given I start the rack service
When I navigate to the route "/unhandled?a=123&b=456" on the rack app with these cookies:
| a | b |
| c | d |
| e | f |
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "metaData.request.cookie" is null
And the event "metaData.request.headers.Cookie" equals "[FILTERED]"
And the event "metaData.request.clientIp" is not null
And the event "metaData.request.headers.Host" is not null
And the event "metaData.request.headers.User-Agent" is not null
And the event "metaData.request.httpMethod" equals "GET"
And the event "metaData.request.httpVersion" matches "^HTTP/\d\.\d$"
And the event "metaData.request.params.a" equals "123"
And the event "metaData.request.params.b" equals "456"
And the event "metaData.request.referer" is null
And the event "metaData.request.url" ends with "/unhandled?a=123&b=456"
Scenario: A request with cookies and no matching filter will set cookies in metadata
Given I set environment variable "BUGSNAG_METADATA_FILTERS" to '["password"]'
And I start the rack service
When I navigate to the route "/unhandled?a=123&b=456" on the rack app with these cookies:
| a | b |
| c | d |
| e | f |
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "metaData.request.cookies.a" equals "b"
And the event "metaData.request.cookies.c" equals "d"
And the event "metaData.request.cookies.e" equals "f"
And the event "metaData.request.headers.Cookie" equals "a=b;c=d;e=f"
And the event "metaData.request.clientIp" is not null
And the event "metaData.request.headers.Host" is not null
And the event "metaData.request.headers.User-Agent" is not null
And the event "metaData.request.httpMethod" equals "GET"
And the event "metaData.request.httpVersion" matches "^HTTP/\d\.\d$"
And the event "metaData.request.params.a" equals "123"
And the event "metaData.request.params.b" equals "456"
And the event "metaData.request.referer" is null
And the event "metaData.request.url" ends with "/unhandled?a=123&b=456"
Scenario: adding feature flags for an unhandled error
Given I start the rack service
When I navigate to the route "/feature-flags/unhandled" on the rack app
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event contains the following feature flags:
| featureFlag | variant |
| from config 1 | |
| from config 2 | abc xyz |
| a | 1 |
| b | |
| c | 3 |
| d | |
Scenario: adding feature flags for a handled error
Given I start the rack service
When I navigate to the route "/feature-flags/handled" on the rack app
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event contains the following feature flags:
| featureFlag | variant |
| from config 1 | |
| from config 2 | abc xyz |
| x | |
| y | 1234 |
| z | |
Scenario: clearing feature flags for an unhandled error
Given I start the rack service
When I navigate to the route "/feature-flags/unhandled?clear_all_flags=1" on the rack app
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event has no feature flags
Scenario: clearing feature flags for a handled error
Given I start the rack service
When I navigate to the route "/feature-flags/handled?clear_all_flags=1" on the rack app
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event has no feature flags
@not-rack-1
@not-rack-2
Scenario: An unrewindable POST request with form data does not attach request body
Given I set environment variable "BUGSNAG_RACK_NO_REWIND" to "true"
And I start the rack service
When I send a POST request to "/unhandled?a=123&b=456" in the rack app with the following form data:
| name | baba |
| favourite_letter | z |
| password | password1 |
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "metaData.request.body" is null
And the event "metaData.request.clientIp" is not null
And the event "metaData.request.cookies" is null
And the event "metaData.request.headers.Host" is not null
And the event "metaData.request.headers.User-Agent" is not null
And the event "metaData.request.httpMethod" equals "POST"
And the event "metaData.request.httpVersion" matches "^HTTP/\d\.\d$"
And the event "metaData.request.params.a" equals "123"
And the event "metaData.request.params.b" equals "456"
And the event "metaData.request.params.name" is null
And the event "metaData.request.params.favourite_letter" is null
And the event "metaData.request.params.password" is null
And the event "metaData.request.referer" is null
And the event "metaData.request.url" ends with "/unhandled?a=123&b=456"
@not-rack-1
@not-rack-2
Scenario: An unrewindable POST request with JSON does not attach request body
Given I set environment variable "BUGSNAG_RACK_NO_REWIND" to "true"
And I start the rack service
When I send a POST request to "/unhandled?a=123&b=456" in the rack app with the following JSON:
| name | baba |
| favourite_letter | z |
| password | password1 |
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "metaData.request.body" is null
And the event "metaData.request.clientIp" is not null
And the event "metaData.request.cookies" is null
And the event "metaData.request.headers.Host" is not null
And the event "metaData.request.headers.User-Agent" is not null
And the event "metaData.request.httpMethod" equals "POST"
And the event "metaData.request.httpVersion" matches "^HTTP/\d\.\d$"
And the event "metaData.request.params.a" equals "123"
And the event "metaData.request.params.b" equals "456"
And the event "metaData.request.params.name" is null
And the event "metaData.request.params.favourite_letter" is null
And the event "metaData.request.params.password" is null
And the event "metaData.request.referer" is null
And the event "metaData.request.url" ends with "/unhandled?a=123&b=456"