Repository navigation
Commit d4ac7c8
fix(tests): Fix flakes from cross-worker FLUSHALL and recycled project IDs (#128317)
This fixes three flaky backend tests that fail on master and then pass
on retry. There are two root causes, and each one has its own commit.
**FLUSHALL from other xdist workers.** The xdist workers, and the
per-worker Snuba instances, each use their own DB on one Redis server.
`test_circuit_breaker2.py`, `utils/sentry_apps/test_webhooks.py` and
`test_artifact_bundles.py` called `flushall()` on the single-host
client, and FLUSHALL deletes every DB on the server. That wipes the
state of the tests that other workers are running at the same moment:
- The snowflake counters reset in the middle of a test. The worker then
generates IDs that it already used, and five collisions in a row raise
`MaxSnowflakeRetryError`. Tests that create a lot of orgs or projects
hit this most, for example `CursoredSchedulerTest`,
`test_organization_trace::test_with_missing_group` and
`test_backfill_group_action_log`.
- The reprocessing state is deleted while an event is reprocessed.
`test_minidump_full::test_reprocessing_objectstore` then gets the
unsymbolicated event back and its snapshot does not match.
These tests now use `flushdb()`. The test plugin also makes `flushall()`
on a single-host Redis client raise, so a new test cannot bring the
problem back. Prefixed redis-cluster clients still allow it, because
they already delete only their own worker's keys.
**Recycled snowflake project IDs.**
`test_replay_data_export_no_replay_data` expects Snuba to have no
replays, but it never reset the replays dataset. Redis is flushed after
each test, so when the test runs in the same second as the test before
it, `default_project` gets the same ID. The replay that the earlier test
stored then gets exported. The test now uses the `replay_store` fixture,
which drops the dataset.
Not covered: the `assert None is not None` failure in
`test_reprocessing_objectstore` and the Kafka `_MAX_POLL_EXCEEDED` in
`test_full_minidump_invalid_extra`. I could not reproduce either one
locally.
<!-- junior-request-attribution:start -->
via @joshuarli.
<!-- junior-request-attribution:end -->
<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3A4fe45e7cb5955bf5a36ba1ff0d1eb304 -->
--
[View Junior
Session](https://junior-prod.sentry.dev/conversations/agent%3A4fe45e7cb5955bf5a36ba1ff0d1eb304)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A4fe45e7cb5955bf5a36ba1ff0d1eb304/?project=4510944073809921)
<!-- junior-session-footer:end -->
---------
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Joshua Li <14209781+joshuarli@users.noreply.github.com>1 parent 3065324 commit d4ac7c8
6 files changed
Lines changed: 46 additions & 11 deletions
File tree
- src/sentry/testutils/pytest
- tests/sentry
- debug_files
- replays
- testutils/pytest
- utils
- sentry_apps
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
152 | 173 | | |
153 | 174 | | |
154 | 175 | | |
| |||
169 | 190 | | |
170 | 191 | | |
171 | 192 | | |
| 193 | + | |
| 194 | + | |
172 | 195 | | |
173 | 196 | | |
174 | 197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | | - | |
| 218 | + | |
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
125 | 127 | | |
126 | 128 | | |
127 | 129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | | - | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
| 247 | + | |
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
| 264 | + | |
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| |||
435 | 435 | | |
436 | 436 | | |
437 | 437 | | |
438 | | - | |
| 438 | + | |
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
| |||
516 | 516 | | |
517 | 517 | | |
518 | 518 | | |
519 | | - | |
| 519 | + | |
520 | 520 | | |
521 | 521 | | |
522 | 522 | | |
| |||
689 | 689 | | |
690 | 690 | | |
691 | 691 | | |
692 | | - | |
| 692 | + | |
693 | 693 | | |
694 | 694 | | |
695 | 695 | | |
| |||
0 commit comments