[ARVADOS] updated: 1.3.0-2394-g57bdcaa07

Git user git at public.arvados.org
Mon Apr 13 14:40:53 UTC 2020


Summary of changes:
 lib/controller/federation/user_test.go | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

       via  57bdcaa0749776dc23dc56429d026edc28d64350 (commit)
      from  ffc9447728e42dcd1e45b56b1164443e1744b281 (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 57bdcaa0749776dc23dc56429d026edc28d64350
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Mon Apr 13 10:25:11 2020 -0400

    16263: Add test for BypassFederation
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/lib/controller/federation/user_test.go b/lib/controller/federation/user_test.go
index c55ec24d4..09aa5086d 100644
--- a/lib/controller/federation/user_test.go
+++ b/lib/controller/federation/user_test.go
@@ -5,6 +5,7 @@
 package federation
 
 import (
+	"context"
 	"encoding/json"
 	"errors"
 	"math"
@@ -15,6 +16,8 @@ import (
 	"git.arvados.org/arvados.git/lib/controller/rpc"
 	"git.arvados.org/arvados.git/sdk/go/arvados"
 	"git.arvados.org/arvados.git/sdk/go/arvadostest"
+	"git.arvados.org/arvados.git/sdk/go/auth"
+	"git.arvados.org/arvados.git/sdk/go/ctxlog"
 	check "gopkg.in/check.v1"
 )
 
@@ -114,6 +117,36 @@ func (s *UserSuite) TestLoginClusterUserList(c *check.C) {
 	}
 }
 
+func (s *UserSuite) TestLoginClusterUserListBypassFederation(c *check.C) {
+	s.cluster.ClusterID = "local"
+	s.cluster.Login.LoginCluster = "zzzzz"
+	s.fed = New(s.cluster)
+	s.addDirectRemote(c, "zzzzz", rpc.NewConn("zzzzz", &url.URL{Scheme: "https", Host: os.Getenv("ARVADOS_API_HOST")},
+		true, rpc.PassthroughTokenProvider))
+
+	spy := arvadostest.NewProxy(c, s.cluster.Services.RailsAPI)
+	s.fed.local = rpc.NewConn(s.cluster.ClusterID, spy.URL, true, rpc.PassthroughTokenProvider)
+
+	_, err := s.fed.UserList(s.ctx, arvados.ListOptions{Offset: 0, Limit: math.MaxInt64, Select: nil, BypassFederation: true})
+	// this will fail because it is not using a root token
+	c.Check(err.(*arvados.TransactionError).StatusCode, check.Equals, 403)
+
+	// Now use SystemRootToken
+	ctx := context.Background()
+	ctx = ctxlog.Context(ctx, ctxlog.TestLogger(c))
+	ctx = auth.NewContext(ctx, &auth.Credentials{Tokens: []string{arvadostest.SystemRootToken}})
+
+	// Assert that it did not try to batch update users.
+	_, err = s.fed.UserList(ctx, arvados.ListOptions{Offset: 0, Limit: math.MaxInt64, Select: nil, BypassFederation: true})
+	for _, d := range spy.RequestDumps {
+		d := string(d)
+		if strings.Contains(d, "PATCH /arvados/v1/users/batch") {
+			c.Fail()
+		}
+	}
+	c.Check(err, check.IsNil)
+}
+
 // userAttrsCachedFromLoginCluster must have an entry for every field
 // in the User struct.
 func (s *UserSuite) TestUserAttrsUpdateWhitelist(c *check.C) {

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list