Repository navigation
test(e2e): cover the user delete check end to end - #2028
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Blockers and organization cleanup test/e2e/regression/api_test.go, test/e2e/regression/billing_test.go |
Tests cover organization, billing balance, resource, and active-subscription blockers. They also check organization and membership cleanup. The billing suite seeds support_credits and configures the enterprise_yearly plan for the subscription test. |
Retries after deletion failures test/e2e/regression/api_test.go |
Tests inject failures at project, membership-policy, and user deletion steps. They check cleanup state and session validity after each failure, then verify that a retry succeeds. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Other
Suggested reviewers: rohilsurana
Merge Risk: 
Minimal · up to 8bdeb
-
The added deletion tests have no identified merge-blocking issue and are ready for normal checks.
Pre-merge checks: 
2
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Coverage Report for CI Build 40834879712Coverage remained the same at 55.922%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
1d4bf3c to
56bcc6a
Compare
e75f617 to
bf85b84
Compare
bf85b84 to
16df0ba
Compare
The admin user delete is refused with one violation per blocker across the user's orgs, including a negative token balance and a paid subscription, and nothing changes until the blockers are cleared. Orgs where the user is the only member are deleted with the user, including a disabled org and one whose only other member is a service user. A failure injected at the org delete, the removal from another org and the user row stops the delete, and each retry continues from where the last one stopped.
16df0ba to
8bdebc5
Compare
Stacked on #2027. Merge #2027 first.
Summary
End-to-end tests for the user delete check in #2027. The admin user delete is refused while anything blocks it, and nothing changes. It deletes the orgs where the user is the only member. After a failed step, the next try continues from where the last one stopped.
Changes
test/e2e/regression/api_test.go:TestUserDeleteWithOrgs, six cases:SOLE_OWNER_WITH_MEMBERSandNEGATIVE_TOKEN_BALANCE. The user, the orgs, the balance and the user's membership stay as they were. Once that org has a second owner and the usage is refunded, the delete goes through: the orgs where the user was alone are deleted, and the shared org stays without the user.RESOURCES_EXIST, and the message names the org:user cannot be deleted yet: organization[user-delete-check-disk]: RESOURCES_EXIST. The user's other, empty org is not deleted. Once the disk is gone, the delete goes through.test/e2e/regression/billing_test.go:TestUserDeleteRefusedWhileAnOrgHasAPaidSubscription. A paid subscription in an org where the user is the only member refuses the delete withACTIVE_SUBSCRIPTION. The user, the org and the subscription stay.signUpUserandrequireDeleteRefusedare shared by both suites.Technical Details
orgHasUserlooks at both lists ofListOrganizationUsers.usershides deleted users, whilerole_pairscomes from the org's live policies, so onlyrole_pairswould still show a policy left behind after the delete.ListOrganizationUsersrefuses a disabled org, so the disabled org case counts the user's live policies on it in the database.TestUserDeleteLeavesNoAccessAndNoLivePolicy, from fix(deleter): user delete removes every policy the user holds #2022.UNPAID_INVOICE. The test only checks thatACTIVE_SUBSCRIPTIONis among the violations. An unpaid invoice cannot be set up locally for the delete.TestConsentInsertFailureRollsBackTheUser: fixed names and emails in the function bodies, no SQL built from strings, and a deferred cleanup that drops them even when the test fails. The trigger onusersmatches both a delete and a soft delete, so it keeps working after feat(store): user delete keeps the row #2023.project.Service.DeleteModelremoves a project's relations before its row. After the injected failure on the row, the API answers permission denied for that project, even to an admin, until a retry finishes the delete. The test checks the project row in the database instead.Test Plan
role_pairs; theuserslist alone misses it), the removal from a disabled org failing, and an injected failure moved one step earlier (the project's policies, or the sessions).go test ./test/e2e/...passes.make lintreports no issues.