[ARVADOS] updated: 1.3.0-906-g67c59cd7b

Git user git at public.curoverse.com
Thu May 16 14:56:12 UTC 2019


Summary of changes:
 .../controllers/application_controller_test.rb     |  4 +--
 lib/controller/router/request.go                   | 13 ++++++++
 lib/controller/router/request_test.go              | 38 ++++++++++++++++++++++
 lib/controller/router/router.go                    |  7 ++++
 lib/controller/rpc/conn.go                         |  3 ++
 sdk/go/arvados/api.go                              |  2 +-
 services/api/test/fixtures/collections.yml         |  2 +-
 7 files changed, 65 insertions(+), 4 deletions(-)

       via  67c59cd7bd3906f559b9a571821b426fe10dfcb2 (commit)
       via  a69691cd906202ad4a4d61021f79c443f76c3327 (commit)
       via  e99fc3e3e4a996e5a6ead330a60f639b5c9fbd29 (commit)
      from  8d60b124aba24724a0ace90872276e1f1c5a09f3 (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 67c59cd7bd3906f559b9a571821b426fe10dfcb2
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Thu May 16 10:55:35 2019 -0400

    14287: Accept order param as string or array.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/lib/controller/router/request.go b/lib/controller/router/request.go
index aa2cd636c..f9eb3e76d 100644
--- a/lib/controller/router/request.go
+++ b/lib/controller/router/request.go
@@ -100,6 +100,19 @@ func (rtr *router) loadRequestParams(req *http.Request, attrsKey string) (map[st
 		params["attrs"] = v
 		delete(params, attrsKey)
 	}
+
+	if order, ok := params["order"].(string); ok {
+		// We must accept strings ("foo, bar desc") and arrays
+		// (["foo", "bar desc"]) because RailsAPI does.
+		// Convert to an array here before trying to unmarshal
+		// into options structs.
+		if order == "" {
+			delete(params, "order")
+		} else {
+			params["order"] = strings.Split(order, ",")
+		}
+	}
+
 	return params, nil
 }
 
diff --git a/lib/controller/router/request_test.go b/lib/controller/router/request_test.go
index 02cc9ce3f..89238f656 100644
--- a/lib/controller/router/request_test.go
+++ b/lib/controller/router/request_test.go
@@ -166,3 +166,41 @@ func (s *RouterSuite) TestBoolParam(c *check.C) {
 		c.Check(params[testKey], check.Equals, true)
 	}
 }
+
+func (s *RouterSuite) TestOrderParam(c *check.C) {
+	for i, tr := range []testReq{
+		{method: "POST", param: map[string]interface{}{"order": ""}, json: true},
+		{method: "POST", param: map[string]interface{}{"order": ""}, json: false},
+		{method: "POST", param: map[string]interface{}{"order": []string{}}, json: true},
+		{method: "POST", param: map[string]interface{}{"order": []string{}}, json: false},
+		{method: "POST", param: map[string]interface{}{}, json: true},
+		{method: "POST", param: map[string]interface{}{}, json: false},
+	} {
+		c.Logf("#%d, tr: %#v", i, tr)
+		req := tr.Request()
+		params, err := s.rtr.loadRequestParams(req, tr.attrsKey)
+		c.Assert(err, check.IsNil)
+		c.Assert(params, check.NotNil)
+		if order, ok := params["order"]; ok && order != nil {
+			c.Check(order, check.DeepEquals, []interface{}{})
+		}
+	}
+
+	for i, tr := range []testReq{
+		{method: "POST", param: map[string]interface{}{"order": "foo,bar desc"}, json: true},
+		{method: "POST", param: map[string]interface{}{"order": "foo,bar desc"}, json: false},
+		{method: "POST", param: map[string]interface{}{"order": "[\"foo\", \"bar desc\"]"}, json: false},
+		{method: "POST", param: map[string]interface{}{"order": []string{"foo", "bar desc"}}, json: true},
+		{method: "POST", param: map[string]interface{}{"order": []string{"foo", "bar desc"}}, json: false},
+	} {
+		c.Logf("#%d, tr: %#v", i, tr)
+		req := tr.Request()
+		params, err := s.rtr.loadRequestParams(req, tr.attrsKey)
+		c.Assert(err, check.IsNil)
+		if _, ok := params["order"].([]string); ok {
+			c.Check(params["order"], check.DeepEquals, []string{"foo", "bar desc"})
+		} else {
+			c.Check(params["order"], check.DeepEquals, []interface{}{"foo", "bar desc"})
+		}
+	}
+}
diff --git a/sdk/go/arvados/api.go b/sdk/go/arvados/api.go
index 874e9e517..597f47a95 100644
--- a/sdk/go/arvados/api.go
+++ b/sdk/go/arvados/api.go
@@ -45,7 +45,7 @@ type ListOptions struct {
 	Where   map[string]interface{} `json:"where"`
 	Limit   int                    `json:"limit"`
 	Offset  int                    `json:"offset"`
-	Order   string                 `json:"order"`
+	Order   []string               `json:"order"`
 	Count   string                 `json:"count"`
 }
 

commit a69691cd906202ad4a4d61021f79c443f76c3327
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Thu May 16 09:56:53 2019 -0400

    14287: Propagate reader_tokens to Rails API.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/lib/controller/router/router.go b/lib/controller/router/router.go
index 179436034..3dba53edd 100644
--- a/lib/controller/router/router.go
+++ b/lib/controller/router/router.go
@@ -198,6 +198,13 @@ func (rtr *router) addRoutes(cluster *arvados.Cluster) {
 				}
 
 				creds := auth.CredentialsFromRequest(req)
+				if rt, _ := params["reader_tokens"].([]interface{}); len(rt) > 0 {
+					for _, t := range rt {
+						if t, ok := t.(string); ok {
+							creds.Tokens = append(creds.Tokens, t)
+						}
+					}
+				}
 				ctx := req.Context()
 				ctx = context.WithValue(ctx, auth.ContextKeyCredentials, creds)
 				ctx = arvados.ContextWithRequestID(ctx, req.Header.Get("X-Request-Id"))
diff --git a/lib/controller/rpc/conn.go b/lib/controller/rpc/conn.go
index e74e870ad..4533bfa1e 100644
--- a/lib/controller/rpc/conn.go
+++ b/lib/controller/rpc/conn.go
@@ -103,6 +103,9 @@ func (conn *Conn) requestAndDecode(ctx context.Context, dst interface{}, ep arva
 		// remove it entirely.
 		delete(params, "limit")
 	}
+	if len(tokens) > 1 {
+		params["reader_tokens"] = tokens[1:]
+	}
 	path := ep.Path
 	if strings.Contains(ep.Path, "/:uuid") {
 		uuid, _ := params["uuid"].(string)

commit e99fc3e3e4a996e5a6ead330a60f639b5c9fbd29
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Wed May 15 14:41:23 2019 -0400

    14287: Fix test fixture PDH.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/apps/workbench/test/controllers/application_controller_test.rb b/apps/workbench/test/controllers/application_controller_test.rb
index 45952ceba..6870adb34 100644
--- a/apps/workbench/test/controllers/application_controller_test.rb
+++ b/apps/workbench/test/controllers/application_controller_test.rb
@@ -325,9 +325,9 @@ class ApplicationControllerTest < ActionController::TestCase
     # Each pdh has more than one collection; however, we should get only one for each
     assert collections.size == 2, 'Expected two objects in the preloaded collection hash'
     assert collections[pdh1], 'Expected collections for the passed in pdh #{pdh1}'
-    assert_equal collections[pdh1].size, 1, 'Expected one collection for the passed in pdh #{pdh1}'
+    assert_equal collections[pdh1].size, 1, "Expected one collection for the passed in pdh #{pdh1}"
     assert collections[pdh2], 'Expected collections for the passed in pdh #{pdh2}'
-    assert_equal collections[pdh2].size, 1, 'Expected one collection for the passed in pdh #{pdh2}'
+    assert_equal collections[pdh2].size, 1, "Expected one collection for the passed in pdh #{pdh2}"
   end
 
   test "requesting a nonexistent object returns 404" do
diff --git a/services/api/test/fixtures/collections.yml b/services/api/test/fixtures/collections.yml
index 5024ecc96..47a0950ae 100644
--- a/services/api/test/fixtures/collections.yml
+++ b/services/api/test/fixtures/collections.yml
@@ -101,7 +101,7 @@ baz_file:
 w_a_z_file:
   uuid: zzzzz-4zz18-25k12570yk134b3
   current_version_uuid: zzzzz-4zz18-25k12570yk134b3
-  portable_data_hash: 8706aadd12a0ebc07d74cae88762ba9e+56
+  portable_data_hash: 44a8da9ec82098323895cd14e178386f+56
   owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
   created_at: 2015-02-09T10:53:38Z
   modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list