Skip to content

test: add tests for updating workspace acl #19240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 7, 2025

Conversation

aslilac
Copy link
Member

@aslilac aslilac commented Aug 7, 2025

Adds missing tests for the /acl [patch] route

@aslilac aslilac requested a review from Emyrk August 7, 2025 16:57
Comment on lines +4839 to +4846
ctx := testutil.Context(t, testutil.WaitMedium)
err := client.UpdateWorkspaceACL(ctx, ws.ID, codersdk.UpdateWorkspaceACL{
UserRoles: map[string]codersdk.WorkspaceRole{
friend.ID.String(): codersdk.WorkspaceRoleAdmin,
},
})
require.NoError(t, err)
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you test the friend can access the workspace with some friendClient call?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanna go a step farther and do that as part of some e2e tests in a coming pr

Comment on lines +3559 to +3567
err := client.UpdateWorkspaceACL(ctx, ws.ID, codersdk.UpdateWorkspaceACL{
UserRoles: map[string]codersdk.WorkspaceRole{
friend.ID.String(): codersdk.WorkspaceRoleAdmin,
},
GroupRoles: map[string]codersdk.WorkspaceRole{
group.ID.String(): codersdk.WorkspaceRoleAdmin,
},
})
require.NoError(t, err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as user comment. Maybe try to access the workspace via the new acl. And not use the UserRoles

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here. I'll also do an e2e test for making sure multiple users in a group can access a shared workspace.

@aslilac aslilac merged commit 7bb52e1 into main Aug 7, 2025
33 checks passed
@aslilac aslilac deleted the lilac/add-tests-for-update-workspace-acl branch August 7, 2025 23:09
@github-actions github-actions bot locked and limited conversation to collaborators Aug 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants