projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
13385: login-sync test works even if there is no fuse group
[arvados.git]
/
services
/
crunch-dispatch-slurm
/
crunch-dispatch-slurm_test.go
diff --git
a/services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go
b/services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go
index 371f7db31ec20ababf00100d54355a1052e78bc1..499f6d5d7275cb609f48cf40c50de381210997ac 100644
(file)
--- a/
services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go
+++ b/
services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go
@@
-55,10
+55,11
@@
func (s *IntegrationSuite) TearDownTest(c *C) {
}
type slurmFake struct {
}
type slurmFake struct {
- didBatch [][]string
- didCancel []string
- didRenice [][]string
- queue string
+ didBatch [][]string
+ didCancel []string
+ didRelease []string
+ didRenice [][]string
+ queue string
// If non-nil, run this func during the 2nd+ call to Cancel()
onCancel func()
// Error returned by Batch()
// If non-nil, run this func during the 2nd+ call to Cancel()
onCancel func()
// Error returned by Batch()
@@
-74,6
+75,11
@@
func (sf *slurmFake) QueueCommand(args []string) *exec.Cmd {
return exec.Command("echo", sf.queue)
}
return exec.Command("echo", sf.queue)
}
+func (sf *slurmFake) Release(name string) error {
+ sf.didRelease = append(sf.didRelease, name)
+ return nil
+}
+
func (sf *slurmFake) Renice(name string, nice int64) error {
sf.didRenice = append(sf.didRenice, []string{name, fmt.Sprintf("%d", nice)})
return nil
func (sf *slurmFake) Renice(name string, nice int64) error {
sf.didRenice = append(sf.didRenice, []string{name, fmt.Sprintf("%d", nice)})
return nil
@@
-115,7
+121,7
@@
func (s *IntegrationSuite) integrationTest(c *C,
s.disp.Dispatcher = &dispatch.Dispatcher{
Arv: arv,
s.disp.Dispatcher = &dispatch.Dispatcher{
Arv: arv,
- PollPeriod: time.
Duration(1) * time.
Second,
+ PollPeriod: time.Second,
RunContainer: func(disp *dispatch.Dispatcher, ctr arvados.Container, status <-chan arvados.Container) {
go func() {
runContainer(disp, ctr)
RunContainer: func(disp *dispatch.Dispatcher, ctr arvados.Container, status <-chan arvados.Container) {
go func() {
runContainer(disp, ctr)
@@
-151,7
+157,7
@@
func (s *IntegrationSuite) integrationTest(c *C,
}
func (s *IntegrationSuite) TestNormal(c *C) {
}
func (s *IntegrationSuite) TestNormal(c *C) {
- s.slurm = slurmFake{queue: "zzzzz-dz642-queuedcontainer 10000 100\n"}
+ s.slurm = slurmFake{queue: "zzzzz-dz642-queuedcontainer 10000 100
PENDING Resources
\n"}
container := s.integrationTest(c,
nil,
func(dispatcher *dispatch.Dispatcher, container arvados.Container) {
container := s.integrationTest(c,
nil,
func(dispatcher *dispatch.Dispatcher, container arvados.Container) {
@@
-163,7
+169,7
@@
func (s *IntegrationSuite) TestNormal(c *C) {
}
func (s *IntegrationSuite) TestCancel(c *C) {
}
func (s *IntegrationSuite) TestCancel(c *C) {
- s.slurm = slurmFake{queue: "zzzzz-dz642-queuedcontainer 10000 100\n"}
+ s.slurm = slurmFake{queue: "zzzzz-dz642-queuedcontainer 10000 100
PENDING Resources
\n"}
readyToCancel := make(chan bool)
s.slurm.onCancel = func() { <-readyToCancel }
container := s.integrationTest(c,
readyToCancel := make(chan bool)
s.slurm.onCancel = func() { <-readyToCancel }
container := s.integrationTest(c,
@@
-217,6
+223,7
@@
func (s *IntegrationSuite) TestSbatchFail(c *C) {
{"object_uuid", "=", container.UUID},
{"event_type", "=", "dispatch"},
}}, &ll)
{"object_uuid", "=", container.UUID},
{"event_type", "=", "dispatch"},
}}, &ll)
+ c.Assert(err, IsNil)
c.Assert(len(ll.Items), Equals, 1)
}
c.Assert(len(ll.Items), Equals, 1)
}
@@
-260,10
+267,10
@@
func (s *StubbedSuite) testWithServerStub(c *C, apiStubResponses map[string]arva
ctx, cancel := context.WithCancel(context.Background())
dispatcher := dispatch.Dispatcher{
Arv: arv,
ctx, cancel := context.WithCancel(context.Background())
dispatcher := dispatch.Dispatcher{
Arv: arv,
- PollPeriod: time.
Duration(1) * time.
Second,
+ PollPeriod: time.Second,
RunContainer: func(disp *dispatch.Dispatcher, ctr arvados.Container, status <-chan arvados.Container) {
go func() {
RunContainer: func(disp *dispatch.Dispatcher, ctr arvados.Container, status <-chan arvados.Container) {
go func() {
- time.Sleep(
1 *
time.Second)
+ time.Sleep(time.Second)
disp.UpdateState(ctr.UUID, dispatch.Running)
disp.UpdateState(ctr.UUID, dispatch.Complete)
}()
disp.UpdateState(ctr.UUID, dispatch.Running)
disp.UpdateState(ctr.UUID, dispatch.Complete)
}()