Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e6a5aef

Browse files
committed
fix: build reason
1 parent 42a1c69 commit e6a5aef

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

coderd/provisionerdserver/provisionerdserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ func (s *server) notifyWorkspaceBuildFailed(ctx context.Context, workspace datab
11001100
if build.Reason.Valid() && build.Reason == database.BuildReasonInitiator {
11011101
return // failed workspace build initiated by a user should not notify
11021102
}
1103-
reason = "initiated by autobuild"
1103+
reason = string(build.Reason)
11041104
initiator := "autobuild"
11051105

11061106
if _, err := s.NotificationEnqueuer.Enqueue(ctx, workspace.OwnerID, notifications.WorkspaceAutobuildFailed,

coderd/provisionerdserver/provisionerdserver_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,9 +1702,8 @@ func TestNotifications(t *testing.T) {
17021702
tests := []struct {
17031703
name string
17041704

1705-
buildReason database.BuildReason
1706-
shouldNotify bool
1707-
shouldDeleteWorkspace bool
1705+
buildReason database.BuildReason
1706+
shouldNotify bool
17081707
}{
17091708
{
17101709
name: "initiated by owner",
@@ -1793,7 +1792,6 @@ func TestNotifications(t *testing.T) {
17931792

17941793
workspace, err = db.GetWorkspaceByID(ctx, workspace.ID)
17951794
require.NoError(t, err)
1796-
require.Equal(t, tc.shouldDeleteWorkspace, workspace.Deleted)
17971795

17981796
if tc.shouldNotify {
17991797
// Validate that the notification was sent and contained the expected values.

0 commit comments

Comments
 (0)