[ARVADOS] updated: 175c31a1cc695285c035ca2a54d5b964ab4b1d5f

git at public.curoverse.com git at public.curoverse.com
Sat Feb 14 17:17:37 EST 2015


Summary of changes:
 sdk/python/tests/arvados_testutil.py               | 29 ++++++++++++++++------
 sdk/python/tests/test_collections.py               |  4 +--
 .../controllers/arvados/v1/groups_controller.rb    |  2 +-
 .../controllers/arvados/v1/schema_controller.rb    |  5 ++++
 .../api/app/models/api_client_authorization.rb     |  4 +++
 services/api/app/models/arvados_model.rb           |  4 +++
 services/api/lib/load_param.rb                     | 12 ++++-----
 services/api/test/integration/groups_test.rb       | 21 ++++++++++++++--
 8 files changed, 61 insertions(+), 20 deletions(-)

       via  175c31a1cc695285c035ca2a54d5b964ab4b1d5f (commit)
       via  e1999050ade633163524cd9d87d0b77f8b5bdfdc (commit)
       via  d5809a1e62e1b1a3984fff88118e036b1f174ff1 (commit)
       via  50df4956c5b0e93efd781fbb070d9d5d30d39eda (commit)
      from  da298b0d96a1e49a1330a4486dcbe22d92d1d743 (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 175c31a1cc695285c035ca2a54d5b964ab4b1d5f
Author: Tom Clegg <tom at curoverse.com>
Date:   Sat Feb 14 16:54:00 2015 -0500

    Ensure result order is predictable, even if client-provided orders do not specify a complete ordering.
    
    Fixes intermittent test failures. Example (from
    https://ci.curoverse.com/job/arvados-api-server/1305/console):
    
    GroupsTest#test_get_all_pages_of_group-owned_objects [/data/1/jenkins/workspace/arvados-api-server/services/api/test/integration/groups_test.rb:31]:
    Received 'zzzzz-4zz18-fy296fx3hot09f7' again on page 3.
    <nil> expected but was
    <true>.
    
    No issue #

diff --git a/services/api/app/controllers/arvados/v1/groups_controller.rb b/services/api/app/controllers/arvados/v1/groups_controller.rb
index 2356f2e..eae6dca 100644
--- a/services/api/app/controllers/arvados/v1/groups_controller.rb
+++ b/services/api/app/controllers/arvados/v1/groups_controller.rb
@@ -70,7 +70,7 @@ class Arvados::V1::GroupsController < ApplicationController
       # Otherwise, order by recency.
       request_order =
         request_orders.andand.find { |r| r =~ /^#{klass.table_name}\./i } ||
-        "created_at desc"
+        klass.default_orders.join(", ")
 
       @select = nil
       where_conds = {}
diff --git a/services/api/app/controllers/arvados/v1/schema_controller.rb b/services/api/app/controllers/arvados/v1/schema_controller.rb
index bc5a20f..09664da 100644
--- a/services/api/app/controllers/arvados/v1/schema_controller.rb
+++ b/services/api/app/controllers/arvados/v1/schema_controller.rb
@@ -1,6 +1,11 @@
 class Arvados::V1::SchemaController < ApplicationController
+  skip_before_filter :catch_redirect_hint
   skip_before_filter :find_objects_for_index
   skip_before_filter :find_object_by_uuid
+  skip_before_filter :load_filters_param
+  skip_before_filter :load_limit_offset_order_params
+  skip_before_filter :load_read_auths
+  skip_before_filter :load_where_param
   skip_before_filter :render_404_if_no_object
   skip_before_filter :require_auth_scope
 
diff --git a/services/api/app/models/api_client_authorization.rb b/services/api/app/models/api_client_authorization.rb
index 5817ff6..b9442d6 100644
--- a/services/api/app/models/api_client_authorization.rb
+++ b/services/api/app/models/api_client_authorization.rb
@@ -80,6 +80,10 @@ class ApiClientAuthorization < ArvadosModel
     attrs
   end
 
+  def self.default_orders
+    ["#{table_name}.id desc"]
+  end
+
   protected
 
   def permission_to_create
diff --git a/services/api/app/models/arvados_model.rb b/services/api/app/models/arvados_model.rb
index 5fc2d78..cf0aba9 100644
--- a/services/api/app/models/arvados_model.rb
+++ b/services/api/app/models/arvados_model.rb
@@ -102,6 +102,10 @@ class ArvadosModel < ActiveRecord::Base
     api_column_map
   end
 
+  def self.default_orders
+    ["#{table_name}.modified_at desc", "#{table_name}.uuid"]
+  end
+
   # If current user can manage the object, return an array of uuids of
   # users and groups that have permission to write the object. The
   # first two elements are always [self.owner_uuid, current user's
diff --git a/services/api/lib/load_param.rb b/services/api/lib/load_param.rb
index 3f1a3b2..35f1d0b 100644
--- a/services/api/lib/load_param.rb
+++ b/services/api/lib/load_param.rb
@@ -47,10 +47,6 @@ module LoadParam
     end
   end
 
-  def default_orders
-    ["#{table_name}.modified_at desc"]
-  end
-
   # Load params[:limit], params[:offset] and params[:order]
   # into @limit, @offset, @orders
   def load_limit_offset_order_params
@@ -113,9 +109,11 @@ module LoadParam
       end
     end
 
-    if @orders.empty?
-      @orders = default_orders
-    end
+    # If the client-specified orders don't amount to a full ordering
+    # (e.g., [] or ['owner_uuid desc']), fall back on the default
+    # orders to ensure repeating the same request (possibly with
+    # different limit/offset) will return records in the same order.
+    @orders += model_class.default_orders
 
     case params[:select]
     when Array
diff --git a/services/api/test/integration/groups_test.rb b/services/api/test/integration/groups_test.rb
index 5ceb99b..2afece9 100644
--- a/services/api/test/integration/groups_test.rb
+++ b/services/api/test/integration/groups_test.rb
@@ -1,6 +1,25 @@
 require 'test_helper'
 
 class GroupsTest < ActionDispatch::IntegrationTest
+  [[], ['replication_confirmed']].each do |orders|
+    test "results are consistent when provided orders #{orders} is incomplete" do
+      last = nil
+      (0..20).each do
+        get '/arvados/v1/groups/contents', {
+          id: groups(:aproject).uuid,
+          filters: [["uuid", "is_a", "arvados#collection"]].to_json,
+          orders: orders.to_json,
+          format: :json,
+        }, auth(:active)
+        assert_response :success
+        if last.nil?
+          last = json_response['items']
+        else
+          assert_equal last, json_response['items']
+        end
+      end
+    end
+  end
 
   test "get all pages of group-owned objects" do
     limit = 5
@@ -9,8 +28,6 @@ class GroupsTest < ActionDispatch::IntegrationTest
     uuid_received = {}
     owner_received = {}
     while true
-      @json_response = nil
-
       get "/arvados/v1/groups/contents", {
         id: groups(:aproject).uuid,
         limit: limit,

commit e1999050ade633163524cd9d87d0b77f8b5bdfdc
Merge: da298b0 d5809a1
Author: Tom Clegg <tom at curoverse.com>
Date:   Sat Feb 14 17:02:12 2015 -0500

    Merge branch '5011-thread-safe-test' refs #5011


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


hooks/post-receive
-- 




More information about the arvados-commits mailing list