[ARVADOS] updated: 1.2.0-354-gc26db1da1

Git user git at public.curoverse.com
Wed Nov 14 14:06:11 EST 2018


Summary of changes:
 lib/controller/federation_test.go | 40 +++++++++++++++++++++++++++++++++------
 1 file changed, 34 insertions(+), 6 deletions(-)

       via  c26db1da1d7bb75edf1579a8647023ee88db816a (commit)
      from  2b30b239c8c66c3a1a7be35c61a9fb707df1e7ee (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 c26db1da1d7bb75edf1579a8647023ee88db816a
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Wed Nov 14 13:53:47 2018 -0500

    14198: Add test that runtime token is set from auth for remote user
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/lib/controller/federation_test.go b/lib/controller/federation_test.go
index da640071c..43cce4c27 100644
--- a/lib/controller/federation_test.go
+++ b/lib/controller/federation_test.go
@@ -575,8 +575,7 @@ func (s *FederationSuite) TestCreateRemoteContainerRequest(c *check.C) {
 
 func (s *FederationSuite) TestCreateRemoteContainerRequestCheckRuntimeToken(c *check.C) {
 	// Send request to zmock and check that outgoing request has
-	// runtime_token sent (because runtime_token isn't returned in
-	// the response).
+	// runtime_token set with a new random v2 token.
 
 	defer s.localServiceReturns404(c).Close()
 	// pass cluster_id via query parameter, this allows arvados-controller
@@ -592,7 +591,7 @@ func (s *FederationSuite) TestCreateRemoteContainerRequestCheckRuntimeToken(c *c
   }
 }
 `))
-	req.Header.Set("Authorization", "Bearer "+arvadostest.ActiveToken)
+	req.Header.Set("Authorization", "Bearer "+arvadostest.ActiveTokenV2)
 	req.Header.Set("Content-type", "application/json")
 
 	np := arvados.NodeProfile{
@@ -609,13 +608,13 @@ func (s *FederationSuite) TestCreateRemoteContainerRequestCheckRuntimeToken(c *c
 		arvados.ContainerRequest `json:"container_request"`
 	}
 	c.Check(json.NewDecoder(s.remoteMockRequests[0].Body).Decode(&cr), check.IsNil)
-	c.Check(strings.HasPrefix(cr.ContainerRequest.RuntimeToken, "v2/"), check.Equals, true)
+	c.Check(strings.HasPrefix(cr.ContainerRequest.RuntimeToken, "v2/zzzzz-gj3su-"), check.Equals, true)
+	c.Check(cr.ContainerRequest.RuntimeToken, check.Not(check.Equals), arvadostest.ActiveTokenV2)
 }
 
 func (s *FederationSuite) TestCreateRemoteContainerRequestCheckSetRuntimeToken(c *check.C) {
 	// Send request to zmock and check that outgoing request has
-	// runtime_token sent (because runtime_token isn't returned in
-	// the response).
+	// runtime_token set with the explicitly provided token.
 
 	defer s.localServiceReturns404(c).Close()
 	// pass cluster_id via query parameter, this allows arvados-controller
@@ -643,6 +642,35 @@ func (s *FederationSuite) TestCreateRemoteContainerRequestCheckSetRuntimeToken(c
 	c.Check(cr.ContainerRequest.RuntimeToken, check.Equals, "xyz")
 }
 
+func (s *FederationSuite) TestCreateRemoteContainerRequestRuntimeTokenFromAuth(c *check.C) {
+	// Send request to zmock and check that outgoing request has
+	// runtime_token set using the Auth token because the user is remote.
+
+	defer s.localServiceReturns404(c).Close()
+	// pass cluster_id via query parameter, this allows arvados-controller
+	// to avoid parsing the body
+	req := httptest.NewRequest("POST", "/arvados/v1/container_requests?cluster_id=zmock",
+		strings.NewReader(`{
+  "container_request": {
+    "name": "hello world",
+    "state": "Uncommitted",
+    "output_path": "/",
+    "container_image": "123",
+    "command": ["abc"]
+  }
+}
+`))
+	req.Header.Set("Authorization", "Bearer "+arvadostest.ActiveTokenV2+"/zzzzz-dz642-parentcontainer")
+	req.Header.Set("Content-type", "application/json")
+	resp := s.testRequest(req)
+	c.Check(resp.StatusCode, check.Equals, http.StatusOK)
+	var cr struct {
+		arvados.ContainerRequest `json:"container_request"`
+	}
+	c.Check(json.NewDecoder(s.remoteMockRequests[0].Body).Decode(&cr), check.IsNil)
+	c.Check(cr.ContainerRequest.RuntimeToken, check.Equals, arvadostest.ActiveTokenV2)
+}
+
 func (s *FederationSuite) TestCreateRemoteContainerRequestError(c *check.C) {
 	defer s.localServiceReturns404(c).Close()
 	// pass cluster_id via query parameter, this allows arvados-controller

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list