X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a5445a2ae553b0723d8579462bcb48855f71a17c..68463d51530a921dd965075e1721744c75322703:/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 39ec15dd0e..c9208a6943 100644 --- a/services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go +++ b/services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go @@ -193,7 +193,7 @@ func testWithServerStub(c *C, apiStubResponses map[string]arvadostest.StubRespon api := httptest.NewServer(&apiStub) defer api.Close() - arv := arvadosclient.ArvadosClient{ + arv := &arvadosclient.ArvadosClient{ Scheme: "http", ApiServer: api.URL[7:], ApiToken: "abc123", @@ -305,13 +305,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, Partition: []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) }