6
6
from sentry .testutils .helpers import with_feature
7
7
from sentry .uptime .endpoints .validators import MAX_REQUEST_SIZE_BYTES
8
8
from sentry .uptime .models import ProjectUptimeSubscription , ProjectUptimeSubscriptionMode
9
- from sentry .uptime .subscriptions .subscriptions import DEFAULT_SUBSCRIPTION_TIMEOUT_MS
10
9
from tests .sentry .uptime .endpoints import UptimeAlertBaseEndpointTest
11
10
12
11
@@ -25,6 +24,7 @@ def test_no_feature(self):
25
24
owner = f"user:{ self .user .id } " ,
26
25
url = "http://sentry.io" ,
27
26
interval_seconds = 60 ,
27
+ timeout_ms = 1000 ,
28
28
status_code = 404 ,
29
29
)
30
30
@@ -38,6 +38,7 @@ def test(self):
38
38
owner = f"user:{ self .user .id } " ,
39
39
url = "http://sentry.io" ,
40
40
interval_seconds = 60 ,
41
+ timeout_ms = 1500 ,
41
42
body = None ,
42
43
)
43
44
uptime_monitor = ProjectUptimeSubscription .objects .get (id = resp .data ["id" ])
@@ -51,7 +52,7 @@ def test(self):
51
52
assert uptime_monitor .mode == ProjectUptimeSubscriptionMode .MANUAL
52
53
assert uptime_subscription .url == "http://sentry.io"
53
54
assert uptime_subscription .interval_seconds == 60
54
- assert uptime_subscription .timeout_ms == DEFAULT_SUBSCRIPTION_TIMEOUT_MS
55
+ assert uptime_subscription .timeout_ms == 1500
55
56
assert uptime_subscription .body is None
56
57
57
58
@with_feature ("organizations:uptime-api-create-update" )
@@ -63,6 +64,7 @@ def test_no_environment(self):
63
64
owner = f"user:{ self .user .id } " ,
64
65
url = "http://sentry.io" ,
65
66
interval_seconds = 60 ,
67
+ timeout_ms = 1000 ,
66
68
body = None ,
67
69
)
68
70
uptime_monitor = ProjectUptimeSubscription .objects .get (id = resp .data ["id" ])
@@ -74,7 +76,7 @@ def test_no_environment(self):
74
76
assert uptime_monitor .mode == ProjectUptimeSubscriptionMode .MANUAL
75
77
assert uptime_subscription .url == "http://sentry.io"
76
78
assert uptime_subscription .interval_seconds == 60
77
- assert uptime_subscription .timeout_ms == DEFAULT_SUBSCRIPTION_TIMEOUT_MS
79
+ assert uptime_subscription .timeout_ms == 1000
78
80
assert uptime_subscription .body is None
79
81
80
82
@with_feature ("organizations:uptime-api-create-update" )
@@ -87,6 +89,7 @@ def test_no_owner(self):
87
89
url = "http://sentry.io" ,
88
90
owner = None ,
89
91
interval_seconds = 60 ,
92
+ timeout_ms = 1000 ,
90
93
)
91
94
uptime_monitor = ProjectUptimeSubscription .objects .get (id = resp .data ["id" ])
92
95
uptime_subscription = uptime_monitor .uptime_subscription
@@ -96,7 +99,7 @@ def test_no_owner(self):
96
99
assert uptime_monitor .mode == ProjectUptimeSubscriptionMode .MANUAL
97
100
assert uptime_subscription .url == "http://sentry.io"
98
101
assert uptime_subscription .interval_seconds == 60
99
- assert uptime_subscription .timeout_ms == DEFAULT_SUBSCRIPTION_TIMEOUT_MS
102
+ assert uptime_subscription .timeout_ms == 1000
100
103
101
104
# Test without passing the owner
102
105
resp = self .get_success_response (
@@ -106,6 +109,7 @@ def test_no_owner(self):
106
109
name = "test" ,
107
110
url = "http://getsentry.com" ,
108
111
interval_seconds = 60 ,
112
+ timeout_ms = 1000 ,
109
113
)
110
114
uptime_monitor = ProjectUptimeSubscription .objects .get (id = resp .data ["id" ])
111
115
assert uptime_monitor .owner_user_id is None
@@ -121,6 +125,7 @@ def test_mode_no_superadmin(self):
121
125
owner = f"user:{ self .user .id } " ,
122
126
url = "http://sentry.io" ,
123
127
interval_seconds = 60 ,
128
+ timeout_ms = 1000 ,
124
129
mode = ProjectUptimeSubscriptionMode .AUTO_DETECTED_ACTIVE ,
125
130
status_code = 400 ,
126
131
)
@@ -139,6 +144,7 @@ def test_mode_superadmin(self):
139
144
owner = f"user:{ self .user .id } " ,
140
145
url = "http://sentry.io" ,
141
146
interval_seconds = 60 ,
147
+ timeout_ms = 1000 ,
142
148
mode = ProjectUptimeSubscriptionMode .AUTO_DETECTED_ACTIVE ,
143
149
)
144
150
uptime_monitor = ProjectUptimeSubscription .objects .get (id = resp .data ["id" ])
@@ -149,7 +155,7 @@ def test_mode_superadmin(self):
149
155
assert uptime_monitor .mode == ProjectUptimeSubscriptionMode .AUTO_DETECTED_ACTIVE
150
156
assert uptime_subscription .url == "http://sentry.io"
151
157
assert uptime_subscription .interval_seconds == 60
152
- assert uptime_subscription .timeout_ms == DEFAULT_SUBSCRIPTION_TIMEOUT_MS
158
+ assert uptime_subscription .timeout_ms == 1000
153
159
154
160
@with_feature ("organizations:uptime-api-create-update" )
155
161
def test_headers_body_method (self ):
@@ -161,6 +167,7 @@ def test_headers_body_method(self):
161
167
owner = f"user:{ self .user .id } " ,
162
168
url = "http://sentry.io" ,
163
169
interval_seconds = 60 ,
170
+ timeout_ms = 1000 ,
164
171
method = "POST" ,
165
172
body = '{"key": "value"}' ,
166
173
headers = [["header" , "value" ]],
@@ -173,7 +180,7 @@ def test_headers_body_method(self):
173
180
assert uptime_monitor .mode == ProjectUptimeSubscriptionMode .MANUAL
174
181
assert uptime_subscription .url == "http://sentry.io"
175
182
assert uptime_subscription .interval_seconds == 60
176
- assert uptime_subscription .timeout_ms == DEFAULT_SUBSCRIPTION_TIMEOUT_MS
183
+ assert uptime_subscription .timeout_ms == 1000
177
184
assert uptime_subscription .body == '{"key": "value"}'
178
185
assert uptime_subscription .headers == [["header" , "value" ]]
179
186
@@ -187,6 +194,7 @@ def test_headers_body_method_already_exists(self):
187
194
owner = f"user:{ self .user .id } " ,
188
195
url = "http://sentry.io" ,
189
196
interval_seconds = 60 ,
197
+ timeout_ms = 1000 ,
190
198
method = "POST" ,
191
199
body = '{"key": "value"}' ,
192
200
headers = [["header" , "value" ]],
@@ -201,6 +209,7 @@ def test_headers_body_method_already_exists(self):
201
209
owner = f"user:{ self .user .id } " ,
202
210
url = "http://sentry.io" ,
203
211
interval_seconds = 60 ,
212
+ timeout_ms = 1000 ,
204
213
method = "POST" ,
205
214
body = '{"key": "value"}' ,
206
215
headers = [["header" , "value" ]],
@@ -216,6 +225,7 @@ def test_headers_body_method_already_exists(self):
216
225
owner = f"user:{ self .user .id } " ,
217
226
url = "http://sentry.io" ,
218
227
interval_seconds = 60 ,
228
+ timeout_ms = 1000 ,
219
229
method = "POST" ,
220
230
body = '{"key": "value"}' ,
221
231
headers = [["header" , "different value" ]],
@@ -235,6 +245,7 @@ def test_headers_invalid_format(self):
235
245
owner = f"user:{ self .user .id } " ,
236
246
url = "http://sentry.io" ,
237
247
interval_seconds = 60 ,
248
+ timeout_ms = 1000 ,
238
249
method = "POST" ,
239
250
body = '{"key": "value"}' ,
240
251
headers = {"header" , "value" },
@@ -254,6 +265,7 @@ def test_size_too_big(self):
254
265
owner = f"user:{ self .user .id } " ,
255
266
url = "http://sentry.io" ,
256
267
interval_seconds = 60 ,
268
+ timeout_ms = 1000 ,
257
269
method = "POST" ,
258
270
body = "body" * 250 ,
259
271
headers = [["header" , "value" ]],
@@ -279,6 +291,7 @@ def test_over_limit(self):
279
291
name = "test" ,
280
292
url = "http://sentry.io" ,
281
293
interval_seconds = 60 ,
294
+ timeout_ms = 1000 ,
282
295
owner = f"user:{ self .user .id } " ,
283
296
)
284
297
self .get_error_response (
@@ -288,5 +301,6 @@ def test_over_limit(self):
288
301
name = "test" ,
289
302
url = "http://santry.io" ,
290
303
interval_seconds = 60 ,
304
+ timeout_ms = 1000 ,
291
305
owner = f"user:{ self .user .id } " ,
292
306
)
0 commit comments