mirror of
https://github.com/coder/coder.git
synced 2025-07-18 14:17:22 +00:00
feat: notify owner about failed autobuild (#13891)
This commit is contained in:
@ -38,6 +38,23 @@ func TestGoTemplate(t *testing.T) {
|
||||
expectedOutput: userEmail,
|
||||
expectedErr: nil,
|
||||
},
|
||||
{
|
||||
name: "render workspace URL",
|
||||
in: `[{
|
||||
"label": "View workspace",
|
||||
"url": "{{ base_url }}/@{{.UserName}}/{{.Labels.name}}"
|
||||
}]`,
|
||||
payload: types.MessagePayload{
|
||||
UserName: "johndoe",
|
||||
Labels: map[string]string{
|
||||
"name": "my-workspace",
|
||||
},
|
||||
},
|
||||
expectedOutput: `[{
|
||||
"label": "View workspace",
|
||||
"url": "https://mocked-server-address/@johndoe/my-workspace"
|
||||
}]`,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
@ -46,7 +63,9 @@ func TestGoTemplate(t *testing.T) {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
out, err := render.GoTemplate(tc.in, tc.payload, nil)
|
||||
out, err := render.GoTemplate(tc.in, tc.payload, map[string]any{
|
||||
"base_url": func() string { return "https://mocked-server-address" },
|
||||
})
|
||||
if tc.expectedErr == nil {
|
||||
require.NoError(t, err)
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user