X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/5b8dfb5d5f4b34fa730e69c45c517f0cfb3fdc9f..23ce820aad666f5ad897ffe106f8b5f7e4baac33:/services/crunch-dispatch-local/crunch-dispatch-local_test.go diff --git a/services/crunch-dispatch-local/crunch-dispatch-local_test.go b/services/crunch-dispatch-local/crunch-dispatch-local_test.go index 6da17ea86c..92b8d2adcd 100644 --- a/services/crunch-dispatch-local/crunch-dispatch-local_test.go +++ b/services/crunch-dispatch-local/crunch-dispatch-local_test.go @@ -16,11 +16,11 @@ import ( "testing" "time" - "git.curoverse.com/arvados.git/sdk/go/arvados" - "git.curoverse.com/arvados.git/sdk/go/arvadosclient" - "git.curoverse.com/arvados.git/sdk/go/arvadostest" - "git.curoverse.com/arvados.git/sdk/go/dispatch" - "github.com/Sirupsen/logrus" + "git.arvados.org/arvados.git/sdk/go/arvados" + "git.arvados.org/arvados.git/sdk/go/arvadosclient" + "git.arvados.org/arvados.git/sdk/go/arvadostest" + "git.arvados.org/arvados.git/sdk/go/dispatch" + "github.com/sirupsen/logrus" . "gopkg.in/check.v1" ) @@ -73,18 +73,21 @@ func (s *TestSuite) TestIntegration(c *C) { dispatcher := dispatch.Dispatcher{ Arv: arv, PollPeriod: time.Second, - RunContainer: func(d *dispatch.Dispatcher, c arvados.Container, s <-chan arvados.Container) { - run(d, c, s) - cancel() - }, } - startCmd = func(container arvados.Container, cmd *exec.Cmd) error { + startCmd := func(container arvados.Container, cmd *exec.Cmd) error { dispatcher.UpdateState(container.UUID, "Running") dispatcher.UpdateState(container.UUID, "Complete") return cmd.Start() } + cl := arvados.Cluster{Containers: arvados.ContainersConfig{RuntimeEngine: "docker"}} + + dispatcher.RunContainer = func(d *dispatch.Dispatcher, c arvados.Container, s <-chan arvados.Container) error { + defer cancel() + return (&LocalRun{startCmd, make(chan bool, 8), ctx, &cl}).run(d, c, s) + } + err = dispatcher.Run(ctx) c.Assert(err, Equals, context.Canceled) @@ -175,18 +178,21 @@ func testWithServerStub(c *C, apiStubResponses map[string]arvadostest.StubRespon dispatcher := dispatch.Dispatcher{ Arv: arv, PollPeriod: time.Second / 20, - RunContainer: func(d *dispatch.Dispatcher, c arvados.Container, s <-chan arvados.Container) { - run(d, c, s) - cancel() - }, } - startCmd = func(container arvados.Container, cmd *exec.Cmd) error { + startCmd := func(container arvados.Container, cmd *exec.Cmd) error { dispatcher.UpdateState(container.UUID, "Running") dispatcher.UpdateState(container.UUID, "Complete") return cmd.Start() } + cl := arvados.Cluster{Containers: arvados.ContainersConfig{RuntimeEngine: "docker"}} + + dispatcher.RunContainer = func(d *dispatch.Dispatcher, c arvados.Container, s <-chan arvados.Container) error { + defer cancel() + return (&LocalRun{startCmd, make(chan bool, 8), ctx, &cl}).run(d, c, s) + } + re := regexp.MustCompile(`(?ms).*` + expected + `.*`) go func() { for i := 0; i < 80 && !re.MatchString(buf.String()); i++ {