[ARVADOS] updated: 2.1.0-2167-g08d681a8b

Git user git at public.arvados.org
Mon Mar 28 15:24:14 UTC 2022


Summary of changes:
 lib/controller/handler_test.go | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

       via  08d681a8b0aa1d4785ecbd97f40c0cc5c2cebb91 (commit)
      from  382074344ae9cae97739ec333203a7c688fbc5f3 (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 08d681a8b0aa1d4785ecbd97f40c0cc5c2cebb91
Author: Tom Clegg <tom at curii.com>
Date:   Mon Mar 28 11:23:09 2022 -0400

    18896: Test token UUID logging.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/lib/controller/handler_test.go b/lib/controller/handler_test.go
index 817cff796..5e467cb05 100644
--- a/lib/controller/handler_test.go
+++ b/lib/controller/handler_test.go
@@ -5,9 +5,11 @@
 package controller
 
 import (
+	"bytes"
 	"context"
 	"crypto/tls"
 	"encoding/json"
+	"io"
 	"io/ioutil"
 	"net/http"
 	"net/http/httptest"
@@ -36,13 +38,15 @@ var _ = check.Suite(&HandlerSuite{})
 type HandlerSuite struct {
 	cluster *arvados.Cluster
 	handler *Handler
+	logbuf  *bytes.Buffer
 	ctx     context.Context
 	cancel  context.CancelFunc
 }
 
 func (s *HandlerSuite) SetUpTest(c *check.C) {
+	s.logbuf = &bytes.Buffer{}
 	s.ctx, s.cancel = context.WithCancel(context.Background())
-	s.ctx = ctxlog.Context(s.ctx, ctxlog.New(os.Stderr, "json", "debug"))
+	s.ctx = ctxlog.Context(s.ctx, ctxlog.New(io.MultiWriter(os.Stderr, s.logbuf), "json", "debug"))
 	s.cluster = &arvados.Cluster{
 		ClusterID:  "zzzzz",
 		PostgreSQL: integrationTestCluster().PostgreSQL,
@@ -317,6 +321,16 @@ func (s *HandlerSuite) TestValidateRemoteToken(c *check.C) {
 	}
 }
 
+func (s *HandlerSuite) TestLogTokenUUID(c *check.C) {
+	req := httptest.NewRequest("GET", "https://0.0.0.0/arvados/v1/users/current", nil)
+	req.Header.Set("Authorization", "Bearer "+arvadostest.ActiveTokenV2)
+	req = req.WithContext(s.ctx)
+	resp := httptest.NewRecorder()
+	httpserver.LogRequests(s.handler).ServeHTTP(resp, req)
+	c.Check(resp.Code, check.Equals, http.StatusOK)
+	c.Check(s.logbuf.String(), check.Matches, `(?ms).*"tokenUUIDs":\["`+strings.Split(arvadostest.ActiveTokenV2, "/")[1]+`"\].*`)
+}
+
 func (s *HandlerSuite) TestCreateAPIToken(c *check.C) {
 	req := httptest.NewRequest("GET", "/arvados/v1/users/current", nil)
 	auth, err := s.handler.createAPItoken(req, arvadostest.ActiveUserUUID, nil)

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list