From 2b0932f930bc0e884aaf5069adce02c04940d470 Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Fri, 28 Aug 2026 09:35:12 -0700 Subject: [PATCH] test(access-groups): give each xdist worker its own fixture ids Every test in the file seeds, reads and deletes the same fixed group and team ids, and auth_ui_unit_tests runs pytest with -n 2. Two tests landing on the two workers at once tread on each other: one worker's _clean_db DELETE wipes rows the other just seeded, and its sync writes land in the other's read. Both shapes showed up on 13a0976bb6, a commit that renames a passthrough test and nothing else. test_reconcile_is_idempotent... read back an empty table, and test_reconcile_handles_a_null_array_column read the idempotent test's team on its own second group. Scoping the ids to PYTEST_XDIST_WORKER keeps each worker in its own rows. Tests on one worker still run in sequence, so no isolation is lost. Reproduced against a local Postgres: -n 2 failed 6 out of 6 runs before, passed 6 out of 6 after, and serial runs are green either way. Stripping the COALESCE guard from the mirror's SQL still fails the suite, so the ids are all that changed. --- tests/proxy_admin_ui_tests/test_access_group_team_sync.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/proxy_admin_ui_tests/test_access_group_team_sync.py b/tests/proxy_admin_ui_tests/test_access_group_team_sync.py index b72a1453576..ceb0dbf6749 100644 --- a/tests/proxy_admin_ui_tests/test_access_group_team_sync.py +++ b/tests/proxy_admin_ui_tests/test_access_group_team_sync.py @@ -23,9 +23,10 @@ from litellm.proxy.management_helpers.access_group_team_sync import ( sync_team_access_group_membership, ) -TEAM = "ags-team-a" -OTHER_TEAM = "ags-team-b" -GROUPS = ("ags-group-1", "ags-group-2", "ags-group-3") +_XDIST_WORKER = os.environ.get("PYTEST_XDIST_WORKER", "master") +TEAM = f"ags-team-a-{_XDIST_WORKER}" +OTHER_TEAM = f"ags-team-b-{_XDIST_WORKER}" +GROUPS = tuple(f"ags-group-{n}-{_XDIST_WORKER}" for n in (1, 2, 3)) _DELETE_SEEDED = 'DELETE FROM "LiteLLM_AccessGroupTable" WHERE access_group_id = ANY($1::TEXT[])' _DELETE_TEAMS = 'DELETE FROM "LiteLLM_TeamTable" WHERE team_id = ANY($1::TEXT[])'