getsentry / getsentry/sentry

Flaky test: tests/sentry/dashboards/endpoints/test_organization_dashboard_details.py::OrganizationDashboardDetailsPutTest::test_all_users_can_edit_dashboard_with_edit_permissions_disabled

Open
#108,880 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/dashboards/endpoints/test_organization_dashboard_details.py::OrganizationDashboardDetailsPutTest::test_all_users_can_edit_dashboard_with_edit_permissions_disabled
Sentry sha: ab471d2d1ede60c8a8c1e3911b78a71a83261eae
Run: https://github.com/getsentry/sentry/actions/runs/22271634857

.venv/lib/python3.13/site-packages/django/db/backends/utils.py:105: in _execute
    return self.cursor.execute(sql, params)
src/sentry/db/postgres/decorators.py:16: in inner
    return func(self, *args, **kwargs)
src/sentry/db/postgres/base.py:95: in execute
    return self.cursor.execute(sql, params)
E   psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "sentry_dashboard_pkey"
E   DETAIL:  Key (id)=(67) already exists.

The above exception was the direct cause of the following exception:
tests/sentry/dashboards/endpoints/test_organization_dashboard_details.py:2645: in test_all_users_can_edit_dashboard_with_edit_permissions_disabled
    dashboard = Dashboard.objects.create(
src/sentry/silo/base.py:158: in override
    return original_method(*args, **kwargs)
.venv/lib/python3.13/site-packages/django/db/models/manager.py:87: in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
src/sentry/silo/base.py:158: in override
    return original_method(*args, **kwargs)
.venv/lib/python3.13/site-packages/django/db/models/query.py:665: in create
    obj.save(force_insert=True, using=self.db)
src/sentry/silo/base.py:158: in override
    return original_method(*args, **kwargs)
.venv/lib/python3.13/site-packages/django/db/models/base.py:902: in save
    self.save_base(
src/sentry/silo/base.py:158: in override
    return original_method(*args, **kwargs)
.venv/lib/python3.13/site-packages/django/db/models/base.py:1008: in save_base
    updated = self._save_table(
.venv/lib/python3.13/site-packages/django/db/models/base.py:1169: in _save_table
    results = self._do_insert(
.venv/lib/python3.13/site-packages/django/db/models/base.py:1210: in _do_insert
    return manager._insert(
.venv/lib/python3.13/site-packages/django/db/models/manager.py:87: in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
.venv/lib/python3.13/site-packages/django/db/models/query.py:1873: in _insert
    return query.get_compiler(using=using).execute_sql(returning_fields)
.venv/lib/python3.13/site-packages/django/db/models/sql/compiler.py:1882: in execute_sql
    cursor.execute(sql, params)
.venv/lib/python3.13/site-packages/django/db/backends/utils.py:122: in execute
    return super().execute(sql, params)
.venv/lib/python3.13/site-packages/sentry_sdk/utils.py:1870: in runner
    return original_function(*args, **kwargs)
.venv/lib/python3.13/site-packages/django/db/backends/utils.py:79: in execute
    return self._execute_with_wrappers(
.venv/lib/python3.13/site-packages/django/db/backends/utils.py:92: in _execute_with_wrappers
    return executor(sql, params, many, context)
src/sentry/db/postgres/base.py:70: in _execute__include_sql_in_error
    return execute(sql, params, many, context)
src/sentry/db/postgres/base.py:58: in _execute__clean_params
    return execute(sql, clean_bad_params(params), many, context)
src/sentry/testutils/hybrid_cloud.py:133: in __call__
    return execute(*params)
.venv/lib/python3.13/site-packages/django/db/backends/utils.py:100: in _execute
    with self.db.wrap_database_errors:
.venv/lib/python3.13/site-packages/django/db/utils.py:91: in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
.venv/lib/python3.13/site-packages/django/db/backends/utils.py:105: in _execute
    return self.cursor.execute(sql, params)
src/sentry/db/postgres/decorators.py:16: in inner
    return func(self, *args, **kwargs)
src/sentry/db/postgres/base.py:95: in execute
    return self.cursor.execute(sql, params)
E   django.db.utils.IntegrityError: duplicate key value violates unique constraint "sentry_dashboard_pkey"
E   DETAIL:  Key (id)=(67) already exists.
E   
E   SQL: INSERT INTO "sentry_dashboard" ("id", "title", "created_by_id", "organization_id", "date_added", "visits", "last_visited", "filters", "prebuilt_id") VALUES (%s, %s, %s, %s, %s, %s, %s, %s, DEFAULT) RETURNING "sentry_dashboard"."id", "sentry_dashboard"."prebuilt_id"

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 by running tests/sentry/dashboards/endpoints/test_organization_dashboard_details.py::OrganizationDashboardDetailsPutTest::test_all_users_can_edit_dashboard_with_edit_permissions_disabled and inspect the Dashboard.objects.create call at line 2645. Use the reported sentry_dashboard_pkey duplicate-key failure as the initial clue. Done means the test passes reliably without duplicate primary-key errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, postgresql, python
Domain
databases, 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.