|
5 | 5 |
|
6 | 6 | import pytest
|
7 | 7 |
|
8 |
| -from sentry.event_manager import EventManager, _save_aggregate |
| 8 | +from sentry.event_manager import _save_aggregate |
9 | 9 | from sentry.eventstore.models import Event
|
10 | 10 | from sentry.grouping.result import CalculatedHashes
|
11 | 11 | from sentry.models.group import Group
|
12 | 12 | from sentry.models.grouphash import GroupHash
|
13 |
| -from sentry.testutils.cases import TestCase |
14 | 13 | from sentry.testutils.pytest.fixtures import django_db_all
|
15 | 14 |
|
16 | 15 |
|
@@ -199,98 +198,3 @@ def test_partial_move(default_project, fast_save):
|
199 | 198 | assert not new_group_info.is_new
|
200 | 199 | assert not new_group_info.is_regression
|
201 | 200 | assert new_group_info.group.id == group_info.group.id
|
202 |
| - |
203 |
| - |
204 |
| -class EventManagerGroupingTest(TestCase): |
205 |
| - def test_can_upgrade_to_hierarchical_config(self): |
206 |
| - self.set_options("legacy:2019-03-12") # Starting configuration |
207 |
| - |
208 |
| - event = self.save_event() |
209 |
| - |
210 |
| - self.transition_to_new_config("mobile:2021-02-12") |
211 |
| - |
212 |
| - # This event will have two sets of hashes |
213 |
| - event2 = self.save_event() |
214 |
| - |
215 |
| - # The hashes property between the two events do not intersect |
216 |
| - assert not set(event.get_hashes().hashes) & set(event2.get_hashes().hashes) |
217 |
| - # They are both grouped together |
218 |
| - assert event.group_id == event2.group_id |
219 |
| - |
220 |
| - group = Group.objects.get(id=event.group_id) |
221 |
| - |
222 |
| - assert group.times_seen == 2 |
223 |
| - assert group.last_seen == event2.datetime |
224 |
| - |
225 |
| - # After expiry, new events are still assigned to the same group: |
226 |
| - self.project.update_option("sentry:secondary_grouping_expiry", 0) |
227 |
| - event3 = self.save_event() |
228 |
| - assert event3.group_id == event2.group_id |
229 |
| - |
230 |
| - def test_can_downgrade_from_hierarchical_config(self): |
231 |
| - self.set_options("mobile:2021-02-12") # Starting configuration |
232 |
| - |
233 |
| - event = self.save_event() |
234 |
| - |
235 |
| - self.transition_to_new_config("legacy:2019-03-12") |
236 |
| - |
237 |
| - # This event will have two sets of hashes |
238 |
| - event2 = self.save_event() |
239 |
| - |
240 |
| - # The hashes property between the two events do not intersect |
241 |
| - assert not set(event.get_hashes().hashes) & set(event2.get_hashes().hashes) |
242 |
| - # They are both grouped together |
243 |
| - assert event.group_id == event2.group_id |
244 |
| - |
245 |
| - group = Group.objects.get(id=event.group_id) |
246 |
| - |
247 |
| - group_hashes = GroupHash.objects.filter( |
248 |
| - project=self.project, hash__in=event.get_hashes().hashes |
249 |
| - ) |
250 |
| - assert group_hashes |
251 |
| - for hash in group_hashes: |
252 |
| - assert hash.group_id == event.group_id |
253 |
| - |
254 |
| - assert group.times_seen == 2 |
255 |
| - assert group.last_seen == event2.datetime |
256 |
| - |
257 |
| - # After expiry, new events are still assigned to the same group: |
258 |
| - self.project.update_option("sentry:secondary_grouping_expiry", 0) |
259 |
| - event3 = self.save_event() |
260 |
| - assert event3.group_id == event2.group_id |
261 |
| - |
262 |
| - def save_event(self): |
263 |
| - manager = EventManager( |
264 |
| - make_event( |
265 |
| - message="foo 123", |
266 |
| - event_id=hex(2**127)[-32:], |
267 |
| - exception={ |
268 |
| - "values": [ |
269 |
| - { |
270 |
| - "type": "Hello", |
271 |
| - "stacktrace": { |
272 |
| - "frames": [ |
273 |
| - {"function": "not_in_app_function"}, |
274 |
| - {"function": "in_app_function"}, |
275 |
| - ] |
276 |
| - }, |
277 |
| - } |
278 |
| - ] |
279 |
| - }, |
280 |
| - ) |
281 |
| - ) |
282 |
| - manager.normalize() |
283 |
| - with self.tasks(): |
284 |
| - return manager.save(self.project.id) |
285 |
| - |
286 |
| - def set_options(self, primary_config): |
287 |
| - self.project.update_option("sentry:grouping_config", primary_config) |
288 |
| - self.project.update_option("sentry:secondary_grouping_expiry", 0) |
289 |
| - |
290 |
| - def transition_to_new_config(self, new_config): |
291 |
| - original_config = self.project.get_option("sentry:grouping_config") |
292 |
| - self.project.update_option("sentry:grouping_config", new_config) |
293 |
| - self.project.update_option("sentry:secondary_grouping_config", original_config) |
294 |
| - self.project.update_option( |
295 |
| - "sentry:secondary_grouping_expiry", time.time() + (24 * 90 * 3600) |
296 |
| - ) |
0 commit comments