Skip to content

feat: notify on workspace creation #15934

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 6 commits into from
Dec 20, 2024

Conversation

DanielleMaywood
Copy link
Contributor

@DanielleMaywood DanielleMaywood commented Dec 19, 2024

Relates to #15845

This PR introduces notifications for when workspaces are created.

Each notification contains some metadata about the workspace that has been created. I've intentionally limited this information to just IDs and names, as we can always add more data if requested/desired.

Adding the new notification caused other unrelated tests to fail due to how they were checking for the right notification. I've updated these tests to use a new helper function SentWithTemplateID to hopefully reduce the likelihood of further notifications to cause a cascade of test failures.

@DanielleMaywood DanielleMaywood marked this pull request as ready for review December 19, 2024 21:31
Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

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

LGTM, some suggestions below but nothing blocking:

  • Regarding your coderd tests, it's good practice to "drop privileges" by creating a separate user with the minimum permission set for the behaviour you want to test, and testing with that user. This will catch RBAC-related bugs.
  • As it's also possible to create workspaces on behalf of other users, we should also test the behaviour in this workflow.

Copy link
Member

Choose a reason for hiding this comment

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

Obligatory prod to double-check migration number before merging :-)

Comment on lines +118 to +121
func WithTemplateID(id uuid.UUID) func(*FakeNotification) bool {
return func(n *FakeNotification) bool {
return n.TemplateID == id
}
Copy link
Member

Choose a reason for hiding this comment

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

Nice :-)

@DanielleMaywood DanielleMaywood merged commit f0e81ab into main Dec 20, 2024
30 checks passed
@DanielleMaywood DanielleMaywood deleted the dm-notify-on-workspace-creation branch December 20, 2024 13:53
@github-actions github-actions bot locked and limited conversation to collaborators Dec 20, 2024
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