[ARVADOS] updated: 2.1.0-116-ge6852ae4b

Git user git at public.arvados.org
Thu Dec 10 19:09:08 UTC 2020


Summary of changes:
 lib/controller/federation_test.go | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

       via  e6852ae4b41e66c661316e8d5e78fe87aa26d53d (commit)
      from  67ac5dcd79fa6f0549bb4f7646cb624e0baa60e5 (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 e6852ae4b41e66c661316e8d5e78fe87aa26d53d
Author: Nico Cesar <nico at nicocesar.com>
Date:   Thu Dec 10 14:04:55 2020 -0500

    Changed the way we test mock
    
    After a long discussion as a result of https://dev.arvados.org/issues/17014#note-18
    Tom Clegg and Nico Cesar agreed that TestCreateRemoteContainerRequestCheckRuntimeToken
    was expecting the same sent json object in the mock
    
    the process is
    client -> zzzzz cluster -> zmock
    
    and we expect to have a random runtime_token in the zmock cluster
    
    Arvados-DCO-1.1-Signed-off-by: Nico Cesar <nico at curii.com>

diff --git a/lib/controller/federation_test.go b/lib/controller/federation_test.go
index 94c0a0aac..07ed3c8bc 100644
--- a/lib/controller/federation_test.go
+++ b/lib/controller/federation_test.go
@@ -652,6 +652,11 @@ func (s *FederationSuite) TestCreateRemoteContainerRequestCheckRuntimeToken(c *c
 	req.Header.Set("Authorization", "Bearer "+arvadostest.ActiveTokenV2)
 	req.Header.Set("Content-type", "application/json")
 
+	// We replace zhome with zzzzz values (RailsAPI, ClusterID, SystemRootToken)
+	// SystemRoot token is needed because we check the
+	// https://[RailsAPI]/arvados/v1/api_client_authorizations/current
+	// https://[RailsAPI]/arvados/v1/users/current and
+	// https://[RailsAPI]/auth/controller/callback
 	arvadostest.SetServiceURL(&s.testHandler.Cluster.Services.RailsAPI, "https://"+os.Getenv("ARVADOS_TEST_API_HOST"))
 	s.testHandler.Cluster.ClusterID = "zzzzz"
 	s.testHandler.Cluster.SystemRootToken = arvadostest.SystemRootToken
@@ -661,8 +666,19 @@ func (s *FederationSuite) TestCreateRemoteContainerRequestCheckRuntimeToken(c *c
 	var cr struct {
 		arvados.ContainerRequest `json:"container_request"`
 	}
-	c.Check(json.NewDecoder(s.remoteMockRequests[0].Body).Decode(&cr), check.IsNil)
+
+	// Body can be a json formated or something like:
+	//  cluster_id=zmock&container_request=%7B%22command%22%3A%5B%22abc%22%5D%2C%22container_image%22%3A%22123%22%2C%22...7D
+	data, err := ioutil.ReadAll(s.remoteMockRequests[0].Body)
+	c.Check(err, check.IsNil)
+	// decodedValue is somethikng like:
+	//  {"container_request":{"command":["abc"],"container_image":"123","name":"hello world",...}
+	decodedValue, err := url.QueryUnescape(string(data))
+	c.Check(err, check.IsNil)
+	c.Check(json.Unmarshal([]byte(decodedValue), &cr), check.IsNil)
+	// let's make sure the Runtime token is there
 	c.Check(strings.HasPrefix(cr.ContainerRequest.RuntimeToken, "v2/zzzzz-gj3su-"), check.Equals, true)
+	// the Runtimetoken should be a different one than than the Token we originally did the request with.
 	c.Check(cr.ContainerRequest.RuntimeToken, check.Not(check.Equals), arvadostest.ActiveTokenV2)
 }
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list