X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/6c3c7b2a8c6491e2ddc585ac194abaf685acec41..903b27b2f4b8b00c11525ff6c2f4eb383709d074:/lib/controller/handler_test.go diff --git a/lib/controller/handler_test.go b/lib/controller/handler_test.go index 746b9242f2..96110ea858 100644 --- a/lib/controller/handler_test.go +++ b/lib/controller/handler_test.go @@ -5,6 +5,7 @@ package controller import ( + "context" "encoding/json" "net/http" "net/http/httptest" @@ -16,6 +17,7 @@ import ( "git.curoverse.com/arvados.git/sdk/go/arvados" "git.curoverse.com/arvados.git/sdk/go/arvadostest" + "git.curoverse.com/arvados.git/sdk/go/ctxlog" "git.curoverse.com/arvados.git/sdk/go/httpserver" check "gopkg.in/check.v1" ) @@ -30,9 +32,13 @@ var _ = check.Suite(&HandlerSuite{}) type HandlerSuite struct { cluster *arvados.Cluster handler http.Handler + ctx context.Context + cancel context.CancelFunc } func (s *HandlerSuite) SetUpTest(c *check.C) { + s.ctx, s.cancel = context.WithCancel(context.Background()) + s.ctx = ctxlog.Context(s.ctx, ctxlog.New(os.Stderr, "json", "debug")) s.cluster = &arvados.Cluster{ ClusterID: "zzzzz", PostgreSQL: integrationTestCluster().PostgreSQL, @@ -44,7 +50,11 @@ func (s *HandlerSuite) SetUpTest(c *check.C) { }, } node := s.cluster.NodeProfiles["*"] - s.handler = newHandler(s.cluster, &node) + s.handler = newHandler(s.ctx, s.cluster, &node, "") +} + +func (s *HandlerSuite) TearDownTest(c *check.C) { + s.cancel() } func (s *HandlerSuite) TestProxyDiscoveryDoc(c *check.C) { @@ -128,7 +138,7 @@ func (s *HandlerSuite) TestProxyRedirect(c *check.C) { resp := httptest.NewRecorder() s.handler.ServeHTTP(resp, req) c.Check(resp.Code, check.Equals, http.StatusFound) - c.Check(resp.Header().Get("Location"), check.Matches, `https://0.0.0.0:1/auth/joshid\?return_to=foo&?`) + c.Check(resp.Header().Get("Location"), check.Matches, `https://0.0.0.0:1/auth/joshid\?return_to=%2Cfoo&?`) } func (s *HandlerSuite) TestValidateV1APIToken(c *check.C) {