Annotate tests based on staff.ga-rollout status#107368
Annotate tests based on staff.ga-rollout status#107368michelletran-sentry merged 2 commits intomasterfrom
staff.ga-rollout status#107368Conversation
326db5f to
0a9c38e
Compare
0a9c38e to
07be529
Compare
07be529 to
48561c4
Compare
48561c4 to
8ea54a4
Compare
8ea54a4 to
8dcc35a
Compare
cathteng
left a comment
There was a problem hiding this comment.
Looks like we can get rid of a lot of tests! I was mostly looking for cases we would delete
8dcc35a to
6da0779
Compare
6da0779 to
fddcdb6
Compare
fddcdb6 to
f6931ee
Compare
This is to prepare the option for removal
Add @override_options({"staff.ga-rollout": True/False}) decorators to
tests in tests/sentry/users/api/endpoints/ to ensure tests run with
appropriate feature flag configuration.
f6931ee to
7b2cba2
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| response = self.get_success_response(qs_params={"query": "is:superuser"}) | ||
| assert len(response.data) == 1 | ||
| assert response.data[0]["id"] == str(self.superuser.id) | ||
| assert len(response.data) == 0 |
There was a problem hiding this comment.
Renamed test doesn't verify meaningful functionality
Medium Severity
The test test_staff_query was renamed from test_superuser_query but still queries is:superuser and now asserts 0 results. The original test verified the is:superuser query filter worked correctly by finding 1 superuser. The new test doesn't verify any query functionality - it just confirms that querying for non-existent users returns empty results, which provides no meaningful test coverage.
Similar to #107368, where I'm trying to convert and mark tests that depends on superusers who should be migrated to staff. This ensures all tests work with staff.ga-rollout=True while maintaining test coverage during the transition. Superuser tests in duplicate pairs can be easily identified and removed later. This is part of the effort to remove the staff.ga-rollout flag and migrate to staff-only mode. Changes: - Converted 5 superuser-only tests to staff in test_sentry_app_details.py: - test_staff_can_set_publish_request_inprogress_status - test_staff_delete_unpublished_app - test_staff_delete_unpublished_app_with_installs - test_staff_cannot_delete_published_app - test_staff_cannot_delete_partner_apps - Converted 1 superuser-only test to staff in test_sentry_apps_stats.py: - test_per_page - Updated DeleteSentryAppDetailsTest setUp to use staff user by default: - Creates staff user as org member in setUp - Logs in as staff instead of superuser - Simplifies individual test methods (no repeated membership creation) - Added decorators to ALL tests (47 total): - False decorator on superuser tests in duplicate pairs - True decorator on all other tests (staff and general tests) Co-authored-by: Claude <noreply@anthropic.com>
My attempt to clean up the feature flag resulted in a lot of changed files (#106966) . I'm opening up smaller PRs to migrate the tests more slowly. Then end goal is to change as many of the tests' functionality to use the staff flag (to preserve test coverage), then tag the tests that I can just delete in the migration (specific `superuser` tests). I'm starting with tests in the following directories: - `tests/sentry/relocation` - `tests/sentry/users/api` I'll probably have followups to do the tagging more slowly. ### Legal Boilerplate Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
Similar to #107368, where I'm trying to convert and mark tests that depends on superusers who should be migrated to staff. This ensures all tests work with staff.ga-rollout=True while maintaining test coverage during the transition. Superuser tests in duplicate pairs can be easily identified and removed later. This is part of the effort to remove the staff.ga-rollout flag and migrate to staff-only mode. Changes: - Converted 5 superuser-only tests to staff in test_sentry_app_details.py: - test_staff_can_set_publish_request_inprogress_status - test_staff_delete_unpublished_app - test_staff_delete_unpublished_app_with_installs - test_staff_cannot_delete_published_app - test_staff_cannot_delete_partner_apps - Converted 1 superuser-only test to staff in test_sentry_apps_stats.py: - test_per_page - Updated DeleteSentryAppDetailsTest setUp to use staff user by default: - Creates staff user as org member in setUp - Logs in as staff instead of superuser - Simplifies individual test methods (no repeated membership creation) - Added decorators to ALL tests (47 total): - False decorator on superuser tests in duplicate pairs - True decorator on all other tests (staff and general tests) Co-authored-by: Claude <noreply@anthropic.com>


My attempt to clean up the feature flag resulted in a lot of changed files (#106966) . I'm opening up smaller PRs to migrate the tests more slowly. Then end goal is to change as many of the tests' functionality to use the staff flag (to preserve test coverage), then tag the tests that I can just delete in the migration (specific
superusertests).I'm starting with tests in the following directories:
tests/sentry/relocationtests/sentry/users/apiI'll probably have followups to do the tagging more slowly.
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.