Skip to content

Add test for user and password hash deletion after silo delete#10400

Open
izuzak wants to merge 1 commit intooxidecomputer:mainfrom
izuzak:izuzak/silo-removal-users-passwords
Open

Add test for user and password hash deletion after silo delete#10400
izuzak wants to merge 1 commit intooxidecomputer:mainfrom
izuzak:izuzak/silo-removal-users-passwords

Conversation

@izuzak
Copy link
Copy Markdown

@izuzak izuzak commented May 7, 2026

Hello! 👋 After getting the tests to run, I wanted to dip my toes into the codebase by implementing a TODO from the code.

This PR implements a small test coverage TODO from nexus/tests/integration_tests/password_login.rs:

// TODO-coverage verify that deleting a Silo deletes all the users and their
// password hashes

Initially, I added the test to that same integration_tests/password_login.rs file, but later realized that there were a few other after-silo-delete cleanup tests in integration_tests/silos.rs so I moved the test there. Happy to move it back to integration_tests/password_login.rs if that wasn't the right call.

I think I understood what the TODO proposed and, after reading about soft deletions and password hashes, and after looking at tests like test_silo_delete_clean_up_groups, I came up with this rough idea:

  1. create a silo
  2. create 3 users (2 with passwords, 1 without)
  3. verify that the users and password hashes exist, both via fetching the created users directly by id and by listing all silo users.
  4. delete the silo
  5. verify that the users and password hashes no longer exist, both via fetching the created users directly by id and by listing all silo users.

I'm curious if testing both is too much (directly fetching users and listing all silo users) -- I added both since they take different paths and might catch different problems. Happy to simplify if one of these feels unnecessary. 💭

Other than the test, I added a delete_silo helper in nexus/test-utils/src/resource_helpers.rs similar to the create_silo helper that was already there. And then used the new helper in a bunch of tests in integration_tests/silos.rs.

Since this is just a small test coverage TODO, it's far from urgent in terms of review (and I know you all are super busy). Still, to avoid it being completely missed, I'll give a friendly cc to @davepacheco who wrote the original TODO in #1841. ✌️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant