Skip to content

Commit d3409fc

Browse files
thetruecpaulJesse-Box
authored andcommitted
chore(snuba): test no mutating filter_keys (#103181)
Hotlined the fix in #103177 because it was causing problems. Best practice is to add a test here to ensure we don't regress in the future.
1 parent cbc3a08 commit d3409fc

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/sentry/utils/test_snuba.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,18 @@ def test_preprocess_group_redirects(self) -> None:
360360
assert params.conditions[0] == ["foo", "=", "bar"]
361361
assert len(params.conditions) == 1
362362

363+
# Should not mutate inputs
364+
filter_keys = {"group_id": {g4.id}}
365+
conditions = [["group_id", "IN", [g1.id, g4.id]]]
366+
367+
SnubaQueryParams(
368+
dataset=Dataset.Events,
369+
filter_keys=filter_keys,
370+
conditions=conditions,
371+
)
372+
assert filter_keys == {"group_id": {g4.id}}
373+
assert conditions == [["group_id", "IN", [g1.id, g4.id]]]
374+
363375

364376
class QuantizeTimeTest(unittest.TestCase):
365377
def setUp(self) -> None:

0 commit comments

Comments
 (0)