[ARVADOS] created: 1.3.0-2142-g7d1970e46
Git user
git at public.arvados.org
Fri Feb 7 23:41:23 UTC 2020
at 7d1970e46ed5dab65e1eaa28b3ddfe609ffe6e4e (commit)
commit 7d1970e46ed5dab65e1eaa28b3ddfe609ffe6e4e
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date: Fri Feb 7 20:40:51 2020 -0300
16141: Adds missing collection fields to GoSDK.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>
diff --git a/sdk/go/arvados/collection.go b/sdk/go/arvados/collection.go
index 5ac35e229..94390bc01 100644
--- a/sdk/go/arvados/collection.go
+++ b/sdk/go/arvados/collection.go
@@ -37,6 +37,13 @@ type Collection struct {
IsTrashed bool `json:"is_trashed"`
Properties map[string]interface{} `json:"properties"`
WritableBy []string `json:"writable_by,omitempty"`
+ FileCount *int `json:"file_count"`
+ FileSizeTotal *int `json:"file_size_total"`
+ Version *int `json:"version"`
+ PreserveVersion bool `json:"preserve_version"`
+ CurrentVersionUUID string `json:"current_version_uuid"`
+ Description string `json:"description"`
+ Href string `json:"href"`
}
func (c Collection) resourceName() string {
commit def8257f4e2a9db0ce772f3155125b3fd6f26368
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date: Fri Feb 7 20:40:17 2020 -0300
16141: Exposes the bug.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>
diff --git a/lib/controller/handler_test.go b/lib/controller/handler_test.go
index c20d0e77e..53f5e65c6 100644
--- a/lib/controller/handler_test.go
+++ b/lib/controller/handler_test.go
@@ -6,7 +6,9 @@ package controller
import (
"context"
+ "crypto/tls"
"encoding/json"
+ "io/ioutil"
"net/http"
"net/http/httptest"
"net/url"
@@ -216,3 +218,47 @@ func (s *HandlerSuite) TestCreateAPIToken(c *check.C) {
c.Check(user.UUID, check.Equals, arvadostest.ActiveUserUUID)
c.Check(user.Authorization.TokenV2(), check.Equals, auth.TokenV2())
}
+
+func (s *HandlerSuite) TestGetCollection(c *check.C) {
+ var proxied, direct map[string]interface{}
+ var err error
+
+ // Get collection from controller
+ fooURL := "/arvados/v1/collections/" + arvadostest.FooCollection
+ req := httptest.NewRequest("GET", fooURL, nil)
+ req.Header.Set("Authorization", "Bearer "+arvadostest.ActiveToken)
+ resp := httptest.NewRecorder()
+ s.handler.ServeHTTP(resp, req)
+ c.Check(resp.Code, check.Equals, http.StatusOK)
+ err = json.Unmarshal(resp.Body.Bytes(), &proxied)
+ c.Check(err, check.Equals, nil)
+
+ // Get collection directly from railsAPI
+ client := &http.Client{
+ Transport: &http.Transport{
+ TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
+ },
+ }
+ resp2, err := client.Get(s.cluster.Services.RailsAPI.ExternalURL.String() + fooURL + "/?api_token=" + arvadostest.ActiveToken)
+ c.Check(err, check.Equals, nil)
+ defer resp2.Body.Close()
+ db, err := ioutil.ReadAll(resp2.Body)
+ c.Check(err, check.Equals, nil)
+ err = json.Unmarshal(db, &direct)
+ c.Check(err, check.Equals, nil)
+
+ // Check that all railsAPI provided keys exist on the controller response
+ // and their non-nil values are equal.
+ for k := range direct {
+ if val, ok := proxied[k]; ok {
+ if k == "manifest_text" {
+ // Tokens differ from request to request
+ c.Check(strings.Split(val.(string), "+A")[0], check.Equals, strings.Split(direct[k].(string), "+A")[0])
+ } else if direct[k] != nil {
+ c.Check(val, check.DeepEquals, direct[k])
+ }
+ } else {
+ c.Errorf("Key %q missing", k)
+ }
+ }
+}
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list