- Notifications
You must be signed in to change notification settings - Fork928
chore(coderd/notifications): expand golden file testing for notifications#15032
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
49 commits Select commitHold shift + click to select a range
70f3486
feat(notifications): Improve notification format consistency
SasSwart7e31a34
chore(coderd/notifications): regenerate notification testdata from th…
SasSwartcf3afd4
Merge remote-tracking branch 'origin/main' into jjs/consistent-notifi…
SasSwart4b85f2b
chore(coderd/database): renumber migration
SasSwarte8ad3ac
chore(coderd/notifications): regenerate testdata
SasSwart2a4d740
fix(coderd/notifications): remove duplicate function signature
SasSwarte741c43
chore: remove redundant escaping in migration
SasSwartadffe60
chore(coderd/notifications): improve failed test feedback
SasSwart41ed54a
feat(coderd/database): add new information to the account activated n…
SasSwart5541331
Merge remote-tracking branch 'origin/main' into jjs/additional-notifi…
SasSwartfe94f0d
chore(coderd/database): rework migration for legibility
SasSwart98e7501
feat(coderd): send newly required information to notification templates
SasSwartd8e00c2
feat(coderd/notifications): provide additional context to workspace n…
SasSwartd6a339f
fix(coderd/notifications): add a missing call to fmt.Sprintf
SasSwart920ad31
fix(coderd/notifications): fix oversights in template migration
SasSwart9e938e5
chore(coderd/provisionerdserver): set the displayname in TestNotifica…
SasSwart59e57ac
chore(coderd): add more robust testing assertions to TestNotifyDelete…
SasSwartc907238
chore(coderd/notifications): fix migration indentation
SasSwart2493556
chore(coderd/notifications): regenerate golden files
SasSwartfc18142
Merge remote-tracking branch 'origin/main' into jjs/consistent-notifi…
SasSwarteccef1c
chore(coderd/notifications): expand golden file testing for notificat…
SasSwart0036006
chore(coderd/notifications): ensure that notification golden files ar…
SasSwarte9eebf3
chore(coderd/notifications): remove defunct test assertions
SasSwart78f2787
chore(coderd/notifications): lint notifications_test
SasSwartaa7658b
Merge remote-tracking branch 'origin/main' into jjs/14913
SasSwart02535bb
feat(coderd/notifications): demonstrate the concept of smtp golden files
SasSwart7e013d8
chore(coderd/notifications): move mock smtp server into its own package
SasSwarta3b240d
chore(coderd/notifications): new golden files for smtp and wehbook
SasSwart8989a44
chore(coderd/notifications): replace sleep with require.eventually in…
SasSwartff18208
Merge remote-tracking branch 'origin/main' into jjs/14913
SasSwarted91226
chore(coderd/notifications): rename and regenerate notifications files
SasSwart91e3f94
chore(coderd/notifications): remove defunct test
SasSwart3430580
chore(coderd/notifications): half the number of db containers needed …
SasSwart9d47785
chore(coderd/notifications): ensure that all rendered golden files ar…
SasSwart7ab1664
chore(coderd/notifications): ensure that all rendered golden files ar…
SasSwart8f3ed16
chore(coderd/notifications): ensure that all rendered golden files ar…
SasSwartca9b130
fix(coderd/notifications): use consistent labels throughout notificat…
SasSwartff620e5
exempt notifications testdata from typo checking
SasSwartb08587c
chore(coderd/notifications) TestSMTP
SasSwart9927434
chore(coderd/notifications) rename mock_smtp package to match linting…
SasSwartf6ef5c4
chore(coderd/notifications) remove a defunct type conversion
SasSwartdadad9f
chore(coderd/notifications) rename mock_smtp package to match linting…
SasSwartf93135a
chore(coderd/notifications): fix golden file test
SasSwart55e3d02
chore(coderd/notifications): fix linting
SasSwartbe00f59
chore(coderd/notifications): fix golden file test
SasSwart4991c33
chore(coderd/notifications): remove defunct test sleep
SasSwart464b244
chore(coderd/notifications): rename a test package
SasSwart3eb9c1e
chore(coderd/notifications): handle test assertions in the correct go…
SasSwartf049c05
chore(coderd/notifications): reformat imports and remove dead code
SasSwartFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
2 changes: 2 additions & 0 deletions.github/workflows/typos.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletionscoderd/database/migrations/000263_consistent_notification_initiator_naming.down.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
-- UserAccountCreated | ||
UPDATE notification_templates | ||
SET | ||
body_template = E'Hi {{.UserName}},\n\n' || | ||
E'New user account **{{.Labels.created_account_name}}** has been created.\n\n' || | ||
-- Mention the real name of the user who created the account: | ||
E'This new user account was created for **{{.Labels.created_account_user_name}}** by **{{.Labels.account_creator}}**.' | ||
WHERE | ||
id = '4e19c0ac-94e1-4532-9515-d1801aa283b2'; | ||
-- UserAccountDeleted | ||
UPDATE notification_templates | ||
SET | ||
body_template = E'Hi {{.UserName}},\n\n' || | ||
E'User account **{{.Labels.deleted_account_name}}** has been deleted.\n\n' || | ||
-- Mention the real name of the user who deleted the account: | ||
E'The deleted account belonged to **{{.Labels.deleted_account_user_name}}** and was deleted by **{{.Labels.account_deleter_user_name}}**.' | ||
SasSwart marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
WHERE | ||
id = 'f44d9314-ad03-4bc8-95d0-5cad491da6b6'; | ||
-- UserAccountSuspended | ||
UPDATE notification_templates | ||
SET | ||
body_template = E'Hi {{.UserName}},\n\n' || -- Add a \n | ||
E'User account **{{.Labels.suspended_account_name}}** has been suspended.\n\n' || | ||
-- Mention the real name of the user who suspended the account: | ||
E'The newly suspended account belongs to **{{.Labels.suspended_account_user_name}}** and was suspended by **{{.Labels.account_suspender_user_name}}**.' | ||
WHERE | ||
id = 'b02ddd82-4733-4d02-a2d7-c36f3598997d'; | ||
-- YourAccountSuspended | ||
UPDATE notification_templates | ||
SET | ||
body_template = E'Hi {{.UserName}},\n\n' || -- Add a \n | ||
E'Your account **{{.Labels.suspended_account_name}}** has been suspended by **{{.Labels.account_suspender_user_name}}**.' | ||
WHERE | ||
id = '6a2f0609-9b69-4d36-a989-9f5925b6cbff'; | ||
-- UserAccountActivated | ||
UPDATE notification_templates | ||
SET | ||
body_template = E'Hi {{.UserName}},\n\n' || -- Add a \n | ||
E'User account **{{.Labels.activated_account_name}}** has been activated.\n\n' || | ||
E'The newly activated account belongs to **{{.Labels.activated_account_user_name}}** and was activated by **{{.Labels.account_activator_user_name}}**.' | ||
WHERE | ||
id = '9f5af851-8408-4e73-a7a1-c6502ba46689'; | ||
-- YourAccountActivated | ||
UPDATE notification_templates | ||
SET | ||
body_template = E'Hi {{.UserName}},\n\n' || -- Add a \n | ||
E'Your account **{{.Labels.activated_account_name}}** has been activated by **{{.Labels.account_activator_user_name}}**.' | ||
WHERE | ||
id = '1a6a6bea-ee0a-43e2-9e7c-eabdb53730e4'; |
57 changes: 57 additions & 0 deletionscoderd/database/migrations/000263_consistent_notification_initiator_naming.up.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
-- UserAccountCreated | ||
UPDATE notification_templates | ||
SET | ||
body_template = E'Hi {{.UserName}},\n\n' || | ||
E'New user account **{{.Labels.created_account_name}}** has been created.\n\n' || | ||
-- Use the conventional initiator label: | ||
E'This new user account was created for **{{.Labels.created_account_user_name}}** by **{{.Labels.initiator}}**.' | ||
WHERE | ||
id = '4e19c0ac-94e1-4532-9515-d1801aa283b2'; | ||
-- UserAccountDeleted | ||
UPDATE notification_templates | ||
SET | ||
body_template = E'Hi {{.UserName}},\n\n' || | ||
E'User account **{{.Labels.deleted_account_name}}** has been deleted.\n\n' || | ||
-- Use the conventional initiator label: | ||
E'The deleted account belonged to **{{.Labels.deleted_account_user_name}}** and was deleted by **{{.Labels.initiator}}**.' | ||
WHERE | ||
id = 'f44d9314-ad03-4bc8-95d0-5cad491da6b6'; | ||
-- UserAccountSuspended | ||
UPDATE notification_templates | ||
SET | ||
body_template = E'Hi {{.UserName}},\n\n' || -- Add a \n | ||
E'User account **{{.Labels.suspended_account_name}}** has been suspended.\n\n' || | ||
-- Use the conventional initiator label: | ||
E'The newly suspended account belongs to **{{.Labels.suspended_account_user_name}}** and was suspended by **{{.Labels.initiator}}**.' | ||
WHERE | ||
id = 'b02ddd82-4733-4d02-a2d7-c36f3598997d'; | ||
-- YourAccountSuspended | ||
UPDATE notification_templates | ||
SET | ||
body_template = E'Hi {{.UserName}},\n\n' || -- Add a \n | ||
-- Use the conventional initiator label: | ||
E'Your account **{{.Labels.suspended_account_name}}** has been suspended by **{{.Labels.initiator}}**.' | ||
WHERE | ||
id = '6a2f0609-9b69-4d36-a989-9f5925b6cbff'; | ||
-- UserAccountActivated | ||
UPDATE notification_templates | ||
SET | ||
body_template = E'Hi {{.UserName}},\n\n' || -- Add a \n | ||
E'User account **{{.Labels.activated_account_name}}** has been activated.\n\n' || | ||
-- Use the conventional initiator label: | ||
E'The newly activated account belongs to **{{.Labels.activated_account_user_name}}** and was activated by **{{.Labels.initiator}}**.' | ||
WHERE | ||
id = '9f5af851-8408-4e73-a7a1-c6502ba46689'; | ||
-- YourAccountActivated | ||
UPDATE notification_templates | ||
SET | ||
body_template = E'Hi {{.UserName}},\n\n' || -- Add a \n | ||
-- Use the conventional initiator label: | ||
E'Your account **{{.Labels.activated_account_name}}** has been activated by **{{.Labels.initiator}}**.' | ||
WHERE | ||
id = '1a6a6bea-ee0a-43e2-9e7c-eabdb53730e4'; |
42 changes: 12 additions & 30 deletionscoderd/notifications/dispatch/smtp_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 18 additions & 2 deletions.../notifications/dispatch/smtp_util_test.go → ...notifications/dispatch/smtptest/server.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.