[ARVADOS] updated: 2.1.0-2452-ge30b7ec30

Git user git at public.arvados.org
Fri May 13 15:09:42 UTC 2022


Summary of changes:
 cmd/arvados-client/container_gateway_test.go     | 15 ++++++---------
 lib/controller/localdb/container_gateway_test.go | 11 +++++------
 lib/crunchrun/container_gateway.go               |  7 +++++++
 lib/crunchrun/executor_test.go                   |  2 +-
 4 files changed, 19 insertions(+), 16 deletions(-)

       via  e30b7ec3040cac89a2e134fddf8cb47c1905ea82 (commit)
      from  2a21ea7ddc0739f9ce54589600be7f136ddd83fa (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 e30b7ec3040cac89a2e134fddf8cb47c1905ea82
Author: Tom Clegg <tom at curii.com>
Date:   Fri May 13 11:08:20 2022 -0400

    19099: Update tests to new crunchrun.Gateway fields.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/cmd/arvados-client/container_gateway_test.go b/cmd/arvados-client/container_gateway_test.go
index 89e926f59..f4a140c40 100644
--- a/cmd/arvados-client/container_gateway_test.go
+++ b/cmd/arvados-client/container_gateway_test.go
@@ -49,16 +49,14 @@ func (s *ClientSuite) TestShellGateway(c *check.C) {
 	h := hmac.New(sha256.New, []byte(arvadostest.SystemRootToken))
 	fmt.Fprint(h, uuid)
 	authSecret := fmt.Sprintf("%x", h.Sum(nil))
-	dcid := "theperthcountyconspiracy"
 	gw := crunchrun.Gateway{
-		DockerContainerID: &dcid,
-		ContainerUUID:     uuid,
-		Address:           "0.0.0.0:0",
-		AuthSecret:        authSecret,
+		ContainerUUID: uuid,
+		Address:       "0.0.0.0:0",
+		AuthSecret:    authSecret,
 		// Just forward connections to localhost instead of a
 		// container, so we can test without running a
 		// container.
-		ContainerIPAddress: func() (string, error) { return "0.0.0.0", nil },
+		Target: crunchrun.GatewayTargetStub{},
 	}
 	err := gw.Start()
 	c.Assert(err, check.IsNil)
@@ -88,9 +86,8 @@ func (s *ClientSuite) TestShellGateway(c *check.C) {
 	cmd.Env = append(cmd.Env, "ARVADOS_API_TOKEN="+arvadostest.ActiveTokenV2)
 	cmd.Stdout = &stdout
 	cmd.Stderr = &stderr
-	c.Check(cmd.Run(), check.NotNil)
-	c.Log(stderr.String())
-	c.Check(stderr.String(), check.Matches, `(?ms).*(No such container: theperthcountyconspiracy|exec: \"docker\": executable file not found in \$PATH).*`)
+	c.Check(cmd.Run(), check.IsNil)
+	c.Check(stdout.String(), check.Equals, "ok\n")
 
 	// Set up an http server, and try using "arvados-client shell"
 	// to forward traffic to it.
diff --git a/lib/controller/localdb/container_gateway_test.go b/lib/controller/localdb/container_gateway_test.go
index 70037cc50..271760420 100644
--- a/lib/controller/localdb/container_gateway_test.go
+++ b/lib/controller/localdb/container_gateway_test.go
@@ -56,12 +56,11 @@ func (s *ContainerGatewaySuite) SetUpSuite(c *check.C) {
 	authKey := fmt.Sprintf("%x", h.Sum(nil))
 
 	s.gw = &crunchrun.Gateway{
-		DockerContainerID:  new(string),
-		ContainerUUID:      s.ctrUUID,
-		AuthSecret:         authKey,
-		Address:            "localhost:0",
-		Log:                ctxlog.TestLogger(c),
-		ContainerIPAddress: func() (string, error) { return "localhost", nil },
+		ContainerUUID: s.ctrUUID,
+		AuthSecret:    authKey,
+		Address:       "localhost:0",
+		Log:           ctxlog.TestLogger(c),
+		Target:        crunchrun.GatewayTargetStub{},
 	}
 	c.Assert(s.gw.Start(), check.IsNil)
 	rootctx := auth.NewContext(context.Background(), &auth.Credentials{Tokens: []string{s.cluster.SystemRootToken}})
diff --git a/lib/crunchrun/container_gateway.go b/lib/crunchrun/container_gateway.go
index 62979da21..01457015e 100644
--- a/lib/crunchrun/container_gateway.go
+++ b/lib/crunchrun/container_gateway.go
@@ -36,6 +36,13 @@ type GatewayTarget interface {
 	IPAddress() (string, error)
 }
 
+type GatewayTargetStub struct{}
+
+func (GatewayTargetStub) IPAddress() (string, error) { return "127.0.0.1", nil }
+func (GatewayTargetStub) InjectCommand(ctx context.Context, detachKeys, username string, usingTTY bool, cmd []string) (*exec.Cmd, error) {
+	return exec.CommandContext(ctx, cmd[0], cmd[1:]...), nil
+}
+
 type Gateway struct {
 	ContainerUUID string
 	Address       string // listen host:port; if port=0, Start() will change it to the selected port
diff --git a/lib/crunchrun/executor_test.go b/lib/crunchrun/executor_test.go
index ea8eedaa1..c516a8b98 100644
--- a/lib/crunchrun/executor_test.go
+++ b/lib/crunchrun/executor_test.go
@@ -183,7 +183,7 @@ func (s *executorSuite) TestIPAddress(c *C) {
 	c.Assert(s.executor.Start(), IsNil)
 	starttime := time.Now()
 
-	ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(2*time.Second))
+	ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(10*time.Second))
 	defer cancel()
 
 	for ctx.Err() == nil {

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list