[ARVADOS] updated: 2.1.0-1583-g7b7de0ba3

Git user git at public.arvados.org
Fri Nov 5 19:55:24 UTC 2021


Summary of changes:
 lib/controller/federation/conn.go            |  7 +++++--
 lib/controller/federation/federation_test.go |  2 +-
 lib/controller/federation/login_test.go      |  2 +-
 lib/controller/federation/user_test.go       |  6 +++---
 lib/controller/handler.go                    | 13 +++++++------
 5 files changed, 17 insertions(+), 13 deletions(-)

       via  7b7de0ba345c02103bbaa9fb981424c59d440d55 (commit)
      from  36b4a526be01a76eeb2ef2db645598f45f1de992 (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 7b7de0ba345c02103bbaa9fb981424c59d440d55
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date:   Fri Nov 5 16:54:44 2021 -0300

    17944: Fixes tests. Improves health funcs handling.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>

diff --git a/lib/controller/federation/conn.go b/lib/controller/federation/conn.go
index 7efbda8d1..30e1561ee 100644
--- a/lib/controller/federation/conn.go
+++ b/lib/controller/federation/conn.go
@@ -31,7 +31,7 @@ type Conn struct {
 	remotes map[string]backend
 }
 
-func New(cluster *arvados.Cluster, vocHealthFunc *health.Func) *Conn {
+func New(cluster *arvados.Cluster, healthFuncs *map[string]health.Func) *Conn {
 	local := localdb.NewConn(cluster)
 	remotes := map[string]backend{}
 	for id, remote := range cluster.RemoteClusters {
@@ -45,7 +45,10 @@ func New(cluster *arvados.Cluster, vocHealthFunc *health.Func) *Conn {
 		remotes[id] = conn
 	}
 
-	*vocHealthFunc = local.LastVocabularyError
+	if healthFuncs != nil {
+		hf := map[string]health.Func{"vocabulary": local.LastVocabularyError}
+		*healthFuncs = hf
+	}
 
 	return &Conn{
 		cluster: cluster,
diff --git a/lib/controller/federation/federation_test.go b/lib/controller/federation/federation_test.go
index fdc4d96cf..929d09bc8 100644
--- a/lib/controller/federation/federation_test.go
+++ b/lib/controller/federation/federation_test.go
@@ -70,7 +70,7 @@ func (s *FederationSuite) SetUpTest(c *check.C) {
 	ctx = ctrlctx.NewWithTransaction(ctx, s.tx)
 	s.ctx = ctx
 
-	s.fed = New(s.cluster)
+	s.fed = New(s.cluster, nil)
 }
 
 func (s *FederationSuite) TearDownTest(c *check.C) {
diff --git a/lib/controller/federation/login_test.go b/lib/controller/federation/login_test.go
index 5353ebf0f..c05ebfce6 100644
--- a/lib/controller/federation/login_test.go
+++ b/lib/controller/federation/login_test.go
@@ -47,7 +47,7 @@ func (s *LoginSuite) TestLogout(c *check.C) {
 	s.cluster.Login.LoginCluster = "zhome"
 	// s.fed is already set by SetUpTest, but we need to
 	// reinitialize with the above config changes.
-	s.fed = New(s.cluster)
+	s.fed = New(s.cluster, nil)
 
 	returnTo := "https://app.example.com/foo?bar"
 	for _, trial := range []struct {
diff --git a/lib/controller/federation/user_test.go b/lib/controller/federation/user_test.go
index 2812c1f41..064f8ce5d 100644
--- a/lib/controller/federation/user_test.go
+++ b/lib/controller/federation/user_test.go
@@ -30,7 +30,7 @@ type UserSuite struct {
 func (s *UserSuite) TestLoginClusterUserList(c *check.C) {
 	s.cluster.ClusterID = "local"
 	s.cluster.Login.LoginCluster = "zzzzz"
-	s.fed = New(s.cluster)
+	s.fed = New(s.cluster, nil)
 	s.addDirectRemote(c, "zzzzz", rpc.NewConn("zzzzz", &url.URL{Scheme: "https", Host: os.Getenv("ARVADOS_API_HOST")}, true, rpc.PassthroughTokenProvider))
 
 	for _, updateFail := range []bool{false, true} {
@@ -120,7 +120,7 @@ func (s *UserSuite) TestLoginClusterUserList(c *check.C) {
 func (s *UserSuite) TestLoginClusterUserGet(c *check.C) {
 	s.cluster.ClusterID = "local"
 	s.cluster.Login.LoginCluster = "zzzzz"
-	s.fed = New(s.cluster)
+	s.fed = New(s.cluster, nil)
 	s.addDirectRemote(c, "zzzzz", rpc.NewConn("zzzzz", &url.URL{Scheme: "https", Host: os.Getenv("ARVADOS_API_HOST")}, true, rpc.PassthroughTokenProvider))
 
 	opts := arvados.GetOptions{UUID: "zzzzz-tpzed-xurymjxw79nv3jz", Select: []string{"uuid", "email"}}
@@ -174,7 +174,7 @@ func (s *UserSuite) TestLoginClusterUserGet(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.fed = New(s.cluster, nil)
 	s.addDirectRemote(c, "zzzzz", rpc.NewConn("zzzzz", &url.URL{Scheme: "https", Host: os.Getenv("ARVADOS_API_HOST")},
 		true, rpc.PassthroughTokenProvider))
 
diff --git a/lib/controller/handler.go b/lib/controller/handler.go
index 22d2e8329..b51d90911 100644
--- a/lib/controller/handler.go
+++ b/lib/controller/handler.go
@@ -100,21 +100,22 @@ func neverRedirect(*http.Request, []*http.Request) error { return http.ErrUseLas
 
 func (h *Handler) setup() {
 	mux := http.NewServeMux()
-	var vocHealthFunc health.Func
+	healthFuncs := make(map[string]health.Func)
 
 	oidcAuthorizer := localdb.OIDCAccessTokenAuthorizer(h.Cluster, h.db)
-	rtr := router.New(federation.New(h.Cluster, &vocHealthFunc), router.Config{
+	rtr := router.New(federation.New(h.Cluster, &healthFuncs), router.Config{
 		MaxRequestSize: h.Cluster.API.MaxRequestSize,
 		WrapCalls:      api.ComposeWrappers(ctrlctx.WrapCallsInTransactions(h.db), oidcAuthorizer.WrapCalls),
 	})
 
+	healthRoutes := health.Routes{"ping": func() error { _, err := h.db(context.TODO()); return err }}
+	for name, f := range healthFuncs {
+		healthRoutes[name] = f
+	}
 	mux.Handle("/_health/", &health.Handler{
 		Token:  h.Cluster.ManagementToken,
 		Prefix: "/_health/",
-		Routes: health.Routes{
-			"ping":       func() error { _, err := h.db(context.TODO()); return err },
-			"vocabulary": vocHealthFunc,
-		},
+		Routes: healthRoutes,
 	})
 	mux.Handle("/arvados/v1/config", rtr)
 	mux.Handle("/arvados/v1/vocabulary", rtr)

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list