X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/224f384d411bb1b4cccc7165c55bb64fd5c695ad..6b91e8201f24d2b4126532d809abba42a5ab959c:/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 e7ccf25fc9..40461031e2 100644 --- a/services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go +++ b/services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go @@ -81,7 +81,8 @@ func (s *TestSuite) TestIntegrationCancel(c *C) { return exec.Command("echo") } - container := s.integrationTest(c, func() *exec.Cmd { return exec.Command("echo", "zzzzz-dz642-queuedcontainer") }, + container := s.integrationTest(c, + func() *exec.Cmd { return exec.Command("echo", "zzzzz-dz642-queuedcontainer") }, []string(nil), func(dispatcher *dispatch.Dispatcher, container arvados.Container) { dispatcher.UpdateState(container.UUID, dispatch.Running) @@ -134,7 +135,7 @@ func (s *TestSuite) integrationTest(c *C, }(squeueCmd) squeueCmd = newSqueueCmd - // There should be no queued containers now + // There should be one queued container params := arvadosclient.Dict{ "filters": [][]string{{"state", "=", "Queued"}}, } @@ -305,13 +306,25 @@ func (s *MockArvadosServerSuite) TestSbatchFuncWithConfigArgs(c *C) { func testSbatchFuncWithArgs(c *C, args []string) { theConfig.SbatchArguments = append(theConfig.SbatchArguments, args...) - container := arvados.Container{UUID: "123", RuntimeConstraints: arvados.RuntimeConstraints{RAM: 1000000, VCPUs: 2}} + container := arvados.Container{UUID: "123", RuntimeConstraints: arvados.RuntimeConstraints{RAM: 250000000, VCPUs: 2}} sbatchCmd := sbatchFunc(container) var expected []string expected = append(expected, "sbatch", "--share") expected = append(expected, theConfig.SbatchArguments...) - expected = append(expected, "--job-name=123", "--mem-per-cpu=1", "--cpus-per-task=2") + expected = append(expected, "--job-name=123", "--mem-per-cpu=120", "--cpus-per-task=2") + + c.Check(sbatchCmd.Args, DeepEquals, expected) +} + +func (s *MockArvadosServerSuite) TestSbatchPartition(c *C) { + theConfig.SbatchArguments = nil + container := arvados.Container{UUID: "123", RuntimeConstraints: arvados.RuntimeConstraints{RAM: 250000000, VCPUs: 1}, SchedulingParameters: arvados.SchedulingParameters{Partitions: []string{"blurb", "b2"}}} + sbatchCmd := sbatchFunc(container) + + var expected []string + expected = append(expected, "sbatch", "--share") + expected = append(expected, "--job-name=123", "--mem-per-cpu=239", "--cpus-per-task=1", "--partition=blurb,b2") c.Check(sbatchCmd.Args, DeepEquals, expected) }