From: Lucas Di Pentima Date: Thu, 28 Jul 2022 14:11:47 +0000 (-0300) Subject: 19297: Fixes error check for edge case of limit=0, count=none. Adds test. X-Git-Tag: 2.5.0~107^2 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/3e95703e7444c1d2077eba748740ebe3df94b1d5 19297: Fixes error check for edge case of limit=0, count=none. Adds test. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- diff --git a/services/api/app/controllers/arvados/v1/groups_controller.rb b/services/api/app/controllers/arvados/v1/groups_controller.rb index de0c43a77e..e9bc006a36 100644 --- a/services/api/app/controllers/arvados/v1/groups_controller.rb +++ b/services/api/app/controllers/arvados/v1/groups_controller.rb @@ -365,7 +365,7 @@ class Arvados::V1::GroupsController < ApplicationController end # Only error out when every searchable object type errored out - if !any_success + if !any_success && error_by_class.size > 0 error_msg = error_by_class.collect do |klass, err| "#{err} on object type #{klass}" end.join("\n") diff --git a/services/api/test/functional/arvados/v1/filters_test.rb b/services/api/test/functional/arvados/v1/filters_test.rb index 7eac477716..3916d63c5e 100644 --- a/services/api/test/functional/arvados/v1/filters_test.rb +++ b/services/api/test/functional/arvados/v1/filters_test.rb @@ -271,13 +271,23 @@ class Arvados::V1::FiltersTest < ActionController::TestCase filters: [ ['properties', 'exists', 'foo'], ['uuid', 'is_a', ["arvados#workflow"]], - ], - limit: 1 + ] } assert_response 422 assert_match(/Invalid attribute 'properties' for operator 'exists'.*on object type Workflow/, json_response['errors'].join(' ')) end + test "groups contents without filters and limit=0, count=none" do + @controller = Arvados::V1::GroupsController.new + authorize_with :admin + get :contents, params: { + limit: 0, + count: 'none', + } + assert_response 200 + assert json_response['items'].length == 0 + end + test "replication_desired = 2" do @controller = Arvados::V1::CollectionsController.new authorize_with :admin