11369: Fix tests. Tweak test fixture to include a mounts entry with capacity.
authorPeter Amstutz <peter.amstutz@curoverse.com>
Wed, 3 May 2017 02:53:28 +0000 (22:53 -0400)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Wed, 3 May 2017 13:41:35 +0000 (09:41 -0400)
services/api/test/fixtures/containers.yml
services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go

index d1f4c7bdc8fac1248aa80d3b0a88d674900cc8e8..07ccb134287e081914ac6a226c7b7ff433bbd40c 100644 (file)
@@ -12,6 +12,13 @@ queued:
   runtime_constraints:
     ram: 12000000000
     vcpus: 4
+  mounts:
+    /tmp:
+      kind: tmp
+      capacity: 24000000000
+    /var/spool/cwl:
+      kind: tmp
+      capacity: 24000000000
 
 running:
   uuid: zzzzz-dz642-runningcontainr
index 71852bffa7f38eb13ced6ffdebc683290c5b1b0f..cca8b3f1505de624c3b9f5775cec95c33e6b2b58 100644 (file)
@@ -153,7 +153,9 @@ func sbatchFunc(container arvados.Container) *exec.Cmd {
 
        var disk int64
        for _, m := range container.Mounts {
-               disk += m.Capacity
+               if m.Kind == "tmp" {
+                       disk += m.Capacity
+               }
        }
        disk = int64(math.Ceil(float64(disk) / float64(1048576)))
 
index e6abb1650ec1007d6f44906d7fdeba7c977318f9..1c366a0e5a59ecaa17233354e14cd882d1470deb 100644 (file)
@@ -118,10 +118,11 @@ func (s *TestSuite) TestIntegrationCancel(c *C) {
 }
 
 func (s *TestSuite) TestIntegrationMissingFromSqueue(c *C) {
-       container := s.integrationTest(c, func() *exec.Cmd { return exec.Command("echo") }, []string{"sbatch", "--share",
+       container := s.integrationTest(c, func() *exec.Cmd { return exec.Command("echo") }, []string{"sbatch",
                fmt.Sprintf("--job-name=%s", "zzzzz-dz642-queuedcontainer"),
-               fmt.Sprintf("--mem-per-cpu=%d", 2862),
-               fmt.Sprintf("--cpus-per-task=%d", 4)},
+               fmt.Sprintf("--mem=%d", 11445),
+               fmt.Sprintf("--cpus-per-task=%d", 4),
+               fmt.Sprintf("--tmp=%d", 45777)},
                func(dispatcher *dispatch.Dispatcher, container arvados.Container) {
                        dispatcher.UpdateState(container.UUID, dispatch.Running)
                        time.Sleep(3 * time.Second)
@@ -327,9 +328,9 @@ func testSbatchFuncWithArgs(c *C, args []string) {
        sbatchCmd := sbatchFunc(container)
 
        var expected []string
-       expected = append(expected, "sbatch", "--share")
+       expected = append(expected, "sbatch")
        expected = append(expected, theConfig.SbatchArguments...)
-       expected = append(expected, "--job-name=123", "--mem-per-cpu=120", "--cpus-per-task=2")
+       expected = append(expected, "--job-name=123", "--mem=239", "--cpus-per-task=2", "--tmp=0")
 
        c.Check(sbatchCmd.Args, DeepEquals, expected)
 }
@@ -340,8 +341,8 @@ func (s *MockArvadosServerSuite) TestSbatchPartition(c *C) {
        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")
+       expected = append(expected, "sbatch")
+       expected = append(expected, "--job-name=123", "--mem=239", "--cpus-per-task=1", "--tmp=0", "--partition=blurb,b2")
 
        c.Check(sbatchCmd.Args, DeepEquals, expected)
 }