Skip to content

feat: generate golden files for notification templates #14537

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 24 commits into from
Sep 4, 2024
Merged
Prev Previous commit
Next Next commit
WIP
  • Loading branch information
mtojek committed Sep 4, 2024
commit 7c7e0f95a95ff6797565ad45d9e7e1dfc27de6fa
4 changes: 1 addition & 3 deletions coderd/database/migrations/000249_email_reports.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ INSERT INTO notification_templates (id, name, title_template, body_template, "gr
VALUES ('bc0d9b9c-6dca-40a7-a209-fb2681e3341a', 'Report: Workspace Builds Failed For Template', E'Workspace builds failed for template "{{.Labels.template_display_name}}"',
E'Hi {{.UserName}},

Template {{.Labels.template_display_name}} has failed to build {{.Data.failed_builds}}/{{.Data.total_builds}} times over the last {{.Data.report_frequency}} and may be unstable.
Template **{{.Labels.template_display_name}}** has failed to build {{.Data.failed_builds}}/{{.Data.total_builds}} times over the last {{.Data.report_frequency}} and may be unstable.

**Report:**

{{range $version := .Data.template_versions}}
**{{$version.template_version_name}}** failed {{$version.failed_count}} time{{if gt $version.failed_count 1}}s{{end}}:
{{range $build := $version.failed_builds}}
* [{{$build.workspace_owner_username}} / {{$build.workspace_name}} / #{{$build.build_number}}]({{base_url}}/@{{$build.workspace_owner_username}}/{{$build.workspace_name}}/builds/{{$build.build_number}})
{{- end}}
{{end}}

We recommend reviewing these issues to ensure future builds are successful.',
'Template Events', '[
{
Expand Down
2 changes: 1 addition & 1 deletion coderd/notifications/notifications_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import (
)

// updateGoldenFiles is a flag that can be set to update golden files.
var updateGoldenFiles = flag.Bool("update", false, "Update golden files")
var updateGoldenFiles = flag.Bool("update", true, "Update golden files")

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
Hi bobby,

Template Bobby First Template has failed to build 4/55 times over the last week and may be unstable.
Template **Bobby First Template** has failed to build 4/55 times over the last week and may be unstable.

**Report:**


**bobby-template-version-1** failed 3 times:

* [mtojek / workspace-1 / #1234](http://test.com/@mtojek/workspace-1/builds/1234)
Expand All @@ -15,5 +14,4 @@ Template Bobby First Template has failed to build 4/55 times over the last week

* [ben / cool-workspace / #8888](http://test.com/@ben/cool-workspace/builds/8888)


We recommend reviewing these issues to ensure future builds are successful.
Loading