getsentry / getsentry/sentry

Flaky test: tests/sentry/api/test_permissions.py::IsAuthenticatedPermissionsTest::test_has_object_permission

Open
#108,886 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

flaky-test Tests
Dominant language
Python
Stars
44.8k
Forks
4.9k
Avg merge
21h 23m
Merged PRs (30d)
607

Description

Failing test: tests/sentry/api/test_permissions.py::IsAuthenticatedPermissionsTest::test_has_object_permission
Sentry sha: ab471d2d1ede60c8a8c1e3911b78a71a83261eae
Run: https://github.com/getsentry/sentry/actions/runs/22271635213

tests/sentry/api/test_permissions.py:54: in setUp
    self.normal_user = self.create_user(id=1)
src/sentry/testutils/fixtures.py:308: in create_user
    return Factories.create_user(*args, **kwargs)
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/contextlib.py:85: in inner
    return func(*args, **kwds)
src/sentry/testutils/factories.py:1086: in create_user
    assert UserEmail.objects.filter(user=user, email=email).update(is_verified=True)
E   AssertionError: assert 0
E    +  where 0 = <bound method BaseQuerySet.update of <BaseQuerySet []>>(is_verified=True)
E    +    where <bound method BaseQuerySet.update of <BaseQuerySet []>> = <BaseQuerySet []>.update
E    +      where <BaseQuerySet []> = <bound method QuerySet.filter of <sentry.db.models.manager.base.UserEmailManager object at 0x7f5397512cf0>>(user=<User at 0x7f537c6fc3b0: id=1>, email='4a99d970fdc54c0ab4ccc8e2b98f740d@example.com')
E    +        where <bound method QuerySet.filter of <sentry.db.models.manager.base.UserEmailManager object at 0x7f5397512cf0>> = <sentry.db.models.manager.base.UserEmailManager object at 0x7f5397512cf0>.filter
E    +          where <sentry.db.models.manager.base.UserEmailManager object at 0x7f5397512cf0> = UserEmail.objects

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tests/sentry/api/test_permissions.py::IsAuthenticatedPermissionsTest::test_has_object_permission and the failing setup in src/sentry/testutils/factories.py:create_user. Run the named test, then trace why the UserEmail query is empty when the user is created. Done means the test passes reliably without the intermittent assertion failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.