fix(tests): Clean up auth.allow-registration in system options tests#108296
fix(tests): Clean up auth.allow-registration in system options tests#108296
Conversation
… tests Three tests in SystemOptionsTest set `auth.allow-registration` to `1` via the API without cleaning up, causing test pollution. This leaked option made `has_user_registration()` return True in subsequent tests, breaking login redirect behavior in OAuthAuthorizeCustomSchemeTest.
611da5f to
cc43e32
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.
| == options.UpdateChannel.APPLICATION | ||
| ) | ||
| options.delete("auth.allow-registration") | ||
| assert response.status_code == 200 |
There was a problem hiding this comment.
Cleanup skipped if preceding assertion fails in test
Medium Severity
In test_update_channel, options.delete("auth.allow-registration") is placed after the get_last_update_channel assertion (lines 117–120). If that assertion fails, the cleanup never executes and the test pollution this PR aims to fix still occurs. In contrast, the other two tests (test_put_self_hosted_superuser_access_allowed, test_put_int_for_boolean) correctly place options.delete immediately after the PUT, before any assertions. Additionally, moving assert response.status_code == 200 to the very end means a failed PUT would produce a confusing error from the get_last_update_channel check instead of a clear status code failure.


found in this shuffle-tests-across-shards run https://github.com/getsentry/sentry/actions/runs/22010195505/job/63602406261
this consistently fails:
and was bisected here https://github.com/getsentry/sentry/actions/runs/22013373357/job/63611146322
SystemOptionsTesttests setauth.allow-registrationto1via the API without cleaning up afterwardhas_user_registration()to returnTruein subsequent tests, breaking login redirect behavior (returning 200 instead of 302) inOAuthAuthorizeCustomSchemeTest::test_code_flow_unauthenticated_custom_schemeoptions.delete("auth.allow-registration")cleanup in three tests:test_put_self_hosted_superuser_access_allowed,test_put_int_for_boolean, andtest_update_channel