12552: Fix starvation in test case.
[arvados.git] / services / crunch-dispatch-slurm / squeue_test.go
index f1ffda9d86cff17a614a30abed0bf5ff61083d12..694a4d6f36c1da35ce830edf708a8c3df56bd7b5 100644 (file)
@@ -99,6 +99,14 @@ func (s *SqueueSuite) TestSetPriorityBeforeQueued(c *C) {
                case <-tick.C:
                        slurm.queue = uuidGood + " 0 12345\n"
                        sqc.check()
+
+                       // Avoid immediately selecting this case again
+                       // on the next iteration if check() took
+                       // longer than one tick.
+                       select {
+                       case <-tick.C:
+                       default:
+                       }
                case <-timeout.C:
                        c.Fatal("timed out")
                case <-done: