(t *testing.T)
| 123 | } |
| 124 | |
| 125 | func TestStatusForTaskError(t *testing.T) { |
| 126 | t.Parallel() |
| 127 | |
| 128 | testCases := []struct { |
| 129 | name string |
| 130 | err error |
| 131 | want int |
| 132 | }{ |
| 133 | {name: "validation", err: core.NewTaskValidationError(context.Canceled), want: http.StatusBadRequest}, |
| 134 | {name: "payload too large", err: taskpkg.ErrPayloadTooLarge, want: http.StatusRequestEntityTooLarge}, |
| 135 | {name: "permission denied", err: taskpkg.ErrPermissionDenied, want: http.StatusForbidden}, |
| 136 | {name: "task not found", err: taskpkg.ErrTaskNotFound, want: http.StatusNotFound}, |
| 137 | {name: "workspace missing", err: workspacepkg.ErrWorkspaceNotFound, want: http.StatusNotFound}, |
| 138 | {name: "invalid transition", err: taskpkg.ErrInvalidStatusTransition, want: http.StatusConflict}, |
| 139 | {name: "stale network channel", err: taskpkg.ErrStaleNetworkChannel, want: http.StatusConflict}, |
| 140 | } |
| 141 | |
| 142 | for _, tc := range testCases { |
| 143 | t.Run(tc.name, func(t *testing.T) { |
| 144 | t.Parallel() |
| 145 | |
| 146 | if got := core.StatusForTaskError(tc.err); got != tc.want { |
| 147 | t.Fatalf("StatusForTaskError(%v) = %d, want %d", tc.err, got, tc.want) |
| 148 | } |
| 149 | }) |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | func TestBaseHandlersTaskExecutionProfileEndpoints(t *testing.T) { |
| 154 | t.Parallel() |
nothing calls this directly
no test coverage detected