CRM-16387 - JobProcessMailingTest - Add comments about brokenness of mailerJobsMax...
authorTim Otten <totten@civicrm.org>
Mon, 15 Jun 2015 19:48:56 +0000 (12:48 -0700)
committerTim Otten <totten@civicrm.org>
Wed, 17 Jun 2015 23:30:04 +0000 (16:30 -0700)
With the current MySQL-based lock-implementation, mailerJobsMax cannot be
enforced because the job locks (```data.mailing.job.*```) trample the worker
locks (```worker.mailing.*```).

The relevant tests are hacked (```lockHold```) so that they pass and loosely
approximate what *would* happen if the lock implementation were less
bonkers.

tests/phpunit/api/v3/JobProcessMailingTest.php

index bab19dedabb92b216a6e34d44ace597bca384a83..fd90e1597235b051323363853fcf11102d7aadbb 100644 (file)
@@ -116,6 +116,10 @@ class api_v3_JobProcessMailingTest extends CiviUnitTestCase {
       array(
         'recipients' => 20,
         'workers' => 3,
+        // FIXME: lockHold is unrealistic/unrepresentative. In reality, this situation fails because
+        // the data.* locks trample the worker.* locks. However, setting lockHold allows us to
+        // approximate the behavior of what would happen *if* the lock-implementation didn't suffer
+        // trampling effects.
         'lockHold' => 10,
         'mailerBatchLimit' => 4,
         'mailerJobsMax' => 1,
@@ -132,6 +136,10 @@ class api_v3_JobProcessMailingTest extends CiviUnitTestCase {
       array(// Settings.
         'recipients' => 20,
         'workers' => 3,
+        // FIXME: lockHold is unrealistic/unrepresentative. In reality, this situation fails because
+        // the data.* locks trample the worker.* locks. However, setting lockHold allows us to
+        // approximate the behavior of what would happen *if* the lock-implementation didn't suffer
+        // trampling effects.
         'lockHold' => 10,
         'mailerBatchLimit' => 5,
         'mailerJobsMax' => 2,
@@ -148,7 +156,6 @@ class api_v3_JobProcessMailingTest extends CiviUnitTestCase {
       array(// Settings.
         'recipients' => 20,
         'workers' => 3,
-        'lockHold' => 10,
         'mailerBatchLimit' => 6,
         'mailerJobsMax' => 3,
       ),
@@ -163,7 +170,6 @@ class api_v3_JobProcessMailingTest extends CiviUnitTestCase {
       array(// Settings.
         'recipients' => 20,
         'workers' => 4,
-        'lockHold' => 4,
         'mailerBatchLimit' => 6,
         'mailerJobsMax' => 0,
       ),