test: evict test-user-3's cached role after making them an operator

The fork checks read the role of every caller, so a fork earlier in the same
test process cached test-user-3 as a developer.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Guilhem Lemouel
2026-10-26 04:10:12 -07:00
co-authored by Claude Opus 5.5
parent 0619ede396
commit e2f7385554
@@ -1701,8 +1701,9 @@ async fn an_operator_neither_writes_nor_runs_a_migration(db: Pool<Postgres>) ->
)
.execute(&db)
.await?;
// A token of its own: the auth cache is process-wide, and the other tests here authenticate
// `SECRET_TOKEN_3` in this workspace as a non-operator.
// A token of its own and a fresh role lookup: the auth and member role caches are
// process-wide, and the other tests here act as `test-user-3` in this workspace as a
// non-operator.
sqlx::raw_sql(
"UPDATE usr SET operator = true, role = 'Operator'
WHERE workspace_id = 'test-workspace' AND username = 'test-user-3';
@@ -1712,6 +1713,7 @@ async fn an_operator_neither_writes_nor_runs_a_migration(db: Pool<Postgres>) ->
)
.execute(&db)
.await?;
windmill_common::roles::invalidate_member_role_cache("test-workspace", "test-user-3");
let server = ApiServer::start(db.clone()).await?;
let base = format!(
"http://localhost:{}/api/w/test-workspace/workspaces",