[ARVADOS] updated: 1.1.1-217-g91dc5aa

Git user git at public.curoverse.com
Wed Dec 13 09:58:30 EST 2017


Summary of changes:
 services/api/lib/record_filters.rb                      | 6 ++++--
 services/api/test/functional/arvados/v1/filters_test.rb | 9 +++++++++
 services/api/test/unit/arvados_model_test.rb            | 2 +-
 3 files changed, 14 insertions(+), 3 deletions(-)

       via  91dc5aafab57c131973244b771392cab083ab469 (commit)
      from  79a2d819d596e610f26c08beee53f5432bfbb360 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 91dc5aafab57c131973244b771392cab083ab469
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Wed Dec 13 09:50:53 2017 -0500

    4019: Improve error checking, add tests for some error cases
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/services/api/lib/record_filters.rb b/services/api/lib/record_filters.rb
index 900b784..50837e1 100644
--- a/services/api/lib/record_filters.rb
+++ b/services/api/lib/record_filters.rb
@@ -109,10 +109,12 @@ module RecordFilters
                                       "for '#{operator}' operator in filters")
             end
           when 'exists'
-          if operand
+          if operand == true
             cond_out << "jsonb_exists(#{ar_table_name}.#{subproperty[0]}, ?)"
-          else
+          elsif operand == false
             cond_out << "(NOT jsonb_exists(#{ar_table_name}.#{subproperty[0]}, ?)) OR #{ar_table_name}.#{subproperty[0]} is NULL"
+          else
+            raise ArgumentError.new("Invalid operand '#{operand}' for '#{operator}' must be true or false")
           end
           param_out << subproperty[1]
           else
diff --git a/services/api/test/functional/arvados/v1/filters_test.rb b/services/api/test/functional/arvados/v1/filters_test.rb
index 677a5f1..4c14d23 100644
--- a/services/api/test/functional/arvados/v1/filters_test.rb
+++ b/services/api/test/functional/arvados/v1/filters_test.rb
@@ -223,6 +223,15 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
     assert_includes(found, collections(:collection_with_prop1_other1).uuid)
   end
 
+  test "jsonb 'exists' must be boolean" do
+    @controller = Arvados::V1::CollectionsController.new
+    authorize_with :admin
+    get :index, {
+      filters: [ ['properties.prop1', 'exists', nil] ]
+    }
+    assert_response 422
+  end
+
   test "replication_desired = 2" do
     @controller = Arvados::V1::CollectionsController.new
     authorize_with :admin
diff --git a/services/api/test/unit/arvados_model_test.rb b/services/api/test/unit/arvados_model_test.rb
index d74cbc5..9230838 100644
--- a/services/api/test/unit/arvados_model_test.rb
+++ b/services/api/test/unit/arvados_model_test.rb
@@ -147,7 +147,7 @@ class ArvadosModelTest < ActiveSupport::TestCase
         search_index_columns = table_class.searchable_columns('ilike')
         # Disappointing, but text columns aren't indexed yet.
         search_index_columns -= table_class.columns.select { |c|
-          c.type == :text or c.name == 'description' or c.name == 'file_names' or c.name == 'properties'
+          c.type == :text or c.name == 'description' or c.name == 'file_names'
         }.collect(&:name)
 
         indexes = ActiveRecord::Base.connection.indexes(table)

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list