Skip to content

Commit 8ce175f

Browse files
authored
Add utilitiy integration test to clean up test users in account (#3665)
## Changes Add utility integration test to clean up test users in account. The test users in the account are not deleted by our clean up system. If there are many users, the API becomes slower, increasing the likelihood of timeouts for our integration tests. This utility test cleans up the test users. Given that it might interfere with other tests and its nature to delete account resource, it is disabled from running by default. ### Linked issues Resolves #3497 Resolves #3547 ### Tests - [x] added utility integration tests
1 parent 4308f0d commit 8ce175f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/integration/account/test_account.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,21 @@
99
from databricks.labs.ucx.account.workspaces import AccountWorkspaces
1010

1111

12+
@pytest.mark.skip(reason="Test tests interferes with other tests")
13+
def test_clean_test_users_in_account(acc: AccountClient) -> None:
14+
"""Run this test to clean up the account from test users.
15+
16+
Watchdog does not clean up the account from test users as it only looks
17+
at the workspace level. This test is not really a test, but a test
18+
utility to clean up the account from test users.
19+
"""
20+
for user in acc.users.list(attributes="id", filter='displayName sw "dummy-"'): # "sw" is short for "starts with"
21+
if user.id:
22+
acc.users.delete(user.id)
23+
# No assert as the API is eventually consistent and this test is skipped
24+
# Verify manually instead
25+
26+
1227
@pytest.fixture
1328
def clean_account_level_groups(acc: AccountClient):
1429
"""Clean test generated account level groups."""

0 commit comments

Comments
 (0)