Skip to content

Commit

Permalink
api/v1/orc: taskPublish handler to return 404 on condition not found
Browse files Browse the repository at this point in the history
  • Loading branch information
joelrebel committed Jul 31, 2024
1 parent 9b19e5d commit e231e65
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/api/v1/orchestrator/routes/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ func (r *Routes) taskPublish(c *gin.Context) (int, *v1types.ServerResponse) {
activeCond, err := r.repository.GetActiveCondition(ctx, serverID)
if err != nil {
if errors.Is(err, store.ErrConditionNotFound) {
return http.StatusBadRequest, &v1types.ServerResponse{
return http.StatusNotFound, &v1types.ServerResponse{
Message: err.Error(),
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/v1/orchestrator/routes/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ func TestTaskPublish(t *testing.T) {
return request
},
assertResponse: func(t *testing.T, r *httptest.ResponseRecorder) {
assert.Equal(t, http.StatusBadRequest, r.Code)
assert.Equal(t, http.StatusNotFound, r.Code)
assert.Contains(t, string(asBytes(t, r.Body)), "expected an active condition: condition not found")
},
},
Expand Down

0 comments on commit e231e65

Please sign in to comment.