Skip to content

Commit

Permalink
Fix createOrUpdate environment with no manager enabled
Browse files Browse the repository at this point in the history
Previously, the abstract manager would still return a successful response of 204, even if the environment was not stored at all. Now, we return a "proper" 500 code if no environment manager is able to handle the request.
  • Loading branch information
MrSerth committed Sep 28, 2024
1 parent 6573a8a commit 11b18aa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/api/environments.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ func (e *EnvironmentController) createOrUpdate(writer http.ResponseWriter, reque
})
if err != nil {
writeInternalServerError(request.Context(), writer, err, dto.ErrorUnknown)
return
}

if created {
Expand Down
2 changes: 1 addition & 1 deletion internal/environment/abstract_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (n *AbstractManager) Get(_ context.Context, _ dto.EnvironmentID, _ bool) (r
func (n *AbstractManager) CreateOrUpdate(_ context.Context, _ dto.EnvironmentID, _ dto.ExecutionEnvironmentRequest) (
bool, error,
) {
return false, nil
return false, dto.ErrNotSupported

Check warning on line 52 in internal/environment/abstract_manager.go

View check run for this annotation

Codecov / codecov/patch

internal/environment/abstract_manager.go#L52

Added line #L52 was not covered by tests
}

func (n *AbstractManager) Delete(environmentID dto.EnvironmentID) (bool, error) {
Expand Down

0 comments on commit 11b18aa

Please sign in to comment.