X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/bd855b0c92549d5cdcabc7a312166e4a6b556697..18292fffce3fcfe1c65121bc89deb38168bd840d:/cmd/arvados-client/container_gateway_test.go diff --git a/cmd/arvados-client/container_gateway_test.go b/cmd/arvados-client/container_gateway_test.go index 89e926f594..743b91d69b 100644 --- a/cmd/arvados-client/container_gateway_test.go +++ b/cmd/arvados-client/container_gateway_test.go @@ -25,6 +25,7 @@ import ( "git.arvados.org/arvados.git/lib/crunchrun" "git.arvados.org/arvados.git/sdk/go/arvados" "git.arvados.org/arvados.git/sdk/go/arvadostest" + "git.arvados.org/arvados.git/sdk/go/ctxlog" "git.arvados.org/arvados.git/sdk/go/httpserver" check "gopkg.in/check.v1" ) @@ -49,16 +50,15 @@ 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, + Log: ctxlog.TestLogger(c), // 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 +88,15 @@ 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).*`) + stdin, err := cmd.StdinPipe() + c.Assert(err, check.IsNil) + go fmt.Fprintln(stdin, "data appears on stdin, but stdin does not close; cmd should exit anyway, not hang") + time.AfterFunc(5*time.Second, func() { + c.Errorf("timed out -- remote end is probably hung waiting for us to close stdin") + stdin.Close() + }) + 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.