projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
15003: Fix import cycle.
[arvados.git]
/
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 6da17ea86cc06ccdbce21c37d2b703b1f937fded..41357403f0a01c9092e2ee7503e13943ba4c2cd3 100644
(file)
--- a/
services/crunch-dispatch-local/crunch-dispatch-local_test.go
+++ b/
services/crunch-dispatch-local/crunch-dispatch-local_test.go
@@
-20,7
+20,7
@@
import (
"git.curoverse.com/arvados.git/sdk/go/arvadosclient"
"git.curoverse.com/arvados.git/sdk/go/arvadostest"
"git.curoverse.com/arvados.git/sdk/go/dispatch"
"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/
S
irupsen/logrus"
+ "github.com/
s
irupsen/logrus"
. "gopkg.in/check.v1"
)
. "gopkg.in/check.v1"
)
@@
-73,18
+73,19
@@
func (s *TestSuite) TestIntegration(c *C) {
dispatcher := dispatch.Dispatcher{
Arv: arv,
PollPeriod: time.Second,
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()
}
dispatcher.UpdateState(container.UUID, "Running")
dispatcher.UpdateState(container.UUID, "Complete")
return cmd.Start()
}
+ dispatcher.RunContainer = func(d *dispatch.Dispatcher, c arvados.Container, s <-chan arvados.Container) {
+ (&LocalRun{startCmd, make(chan bool, 8), ctx}).run(d, c, s)
+ cancel()
+ }
+
err = dispatcher.Run(ctx)
c.Assert(err, Equals, context.Canceled)
err = dispatcher.Run(ctx)
c.Assert(err, Equals, context.Canceled)
@@
-175,18
+176,19
@@
func testWithServerStub(c *C, apiStubResponses map[string]arvadostest.StubRespon
dispatcher := dispatch.Dispatcher{
Arv: arv,
PollPeriod: time.Second / 20,
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()
}
dispatcher.UpdateState(container.UUID, "Running")
dispatcher.UpdateState(container.UUID, "Complete")
return cmd.Start()
}
+ dispatcher.RunContainer = func(d *dispatch.Dispatcher, c arvados.Container, s <-chan arvados.Container) {
+ (&LocalRun{startCmd, make(chan bool, 8), ctx}).run(d, c, s)
+ cancel()
+ }
+
re := regexp.MustCompile(`(?ms).*` + expected + `.*`)
go func() {
for i := 0; i < 80 && !re.MatchString(buf.String()); i++ {
re := regexp.MustCompile(`(?ms).*` + expected + `.*`)
go func() {
for i := 0; i < 80 && !re.MatchString(buf.String()); i++ {