Page MenuHomePhabricator

CiviCRM unit test failing locally
Closed, ResolvedPublic

Description

When running the full suite of CiviCRM unit tests locally, I'm seeing a bunch of failures and, eventually, a timeout at 64% of tests run. I've tried setting the php.ini setting max_execution_time=0, but it looks like this is being overridden somewhere internally as the final error shows PHP Fatal error: Maximum execution time of 180 seconds exceeded in /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/Civi/Api4/Utils/ReflectionUtils.php on line 77

I was running the tests for this patch locally https://gerrit.wikimedia.org/r/c/wikimedia/fundraising/crm/+/886207 to try and confirm no regressions were introduced. The tests do pass on CI, so it feels like potentially an environment inconsistency. Also, the tests took around 21 minutes to run before failing. Can revisit the test suites to remove or optimise any slow or duplicated tests to speed this up. I saw a bunch of tests using dataProviders which we might be able to slim down with less permutation testing.

The full console output is here:

1docker@civicrm:/srv/civi-sites/wmff/drupal$ drush updb -v
2Include /srv/civicrm-buildkit/extern/drush-lib [notice]
3Executing: mysql --defaults-extra-file=/tmp/drush_zUzXoP --database=drupal --host=database --port=3306 --silent < /tmp/drush_nrIXP0
4Executing: mysql --defaults-extra-file=/tmp/drush_ajhlCs --database=drupal --host=database --port=3306 --silent < /tmp/drush_CGMC0D
5The following module is missing from the file system: <em class="placeholder">orphan_slayer</em>. For information about how to fix this, see <a href="https://www.drupal.org/node/2487215">the [warning]
6documentation page</a>. bootstrap.inc:1181
7No database updates required [success]
8Command dispatch complete [notice]
9docker@civicrm:/srv/civi-sites/wmff/drupal$ drush cvupdb -v
10Include /srv/civicrm-buildkit/extern/drush-lib [notice]
11Executing: mysql --defaults-extra-file=/tmp/drush_FQ1GFf --database=drupal --host=database --port=3306 --silent < /tmp/drush_AjNmB5
12Executing: mysql --defaults-extra-file=/tmp/drush_o3l5Rz --database=drupal --host=database --port=3306 --silent < /tmp/drush_fk1RLp
13You are already upgraded to CiviCRM 5.58.1
14Command dispatch complete [notice]
15docker@civicrm:/srv/civi-sites/wmff/drupal$ cd ../
16docker@civicrm:/srv/civi-sites/wmff$ ./vendor/bin/phpunit
17PHPUnit 8.0.0 by Sebastian Bergmann and contributors.
18
19............................................................... 63 / 583 ( 10%)
20..........................................F.................... 126 / 583 ( 21%)
21..............E...civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
22.civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
23.......civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
24civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
25civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
26....civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
27civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
28civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
29civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
30civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
31civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
32civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
33civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
34civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
35civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
36civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
37.civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
38civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
39civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
40civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
41civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
42civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
43civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
44civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
45civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
46civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
47civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
48civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
49civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
50civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
51civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
52civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
53civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
54.....civicrm.wmf.WARNING: wmf_civicrm: No cash submethod given
55........................... 189 / 583 ( 32%)
56......................................civicrm.wmf.ERROR: adyen_audit: Archive file /srv/civi-sites/wmff/drupal/sites/all/modules/wmf_audit/tests/data/logs//payments-adyen-20170219.gz seems not to exist
57
58.civicrm.wmf.ERROR: adyen_audit: Archive file /srv/civi-sites/wmff/drupal/sites/all/modules/wmf_audit/tests/data/logs//payments-adyen-20200224.gz seems not to exist
59
60....civicrm.wmf.ERROR: amazon_audit: Archive file /srv/civi-sites/wmff/drupal/sites/all/modules/wmf_audit/tests/data/logs//payments-amazon_gateway-20151002.gz seems not to exist
61
62...civicrm.wmf.ERROR: astropay_audit: Archive file /srv/civi-sites/wmff/drupal/sites/all/modules/wmf_audit/tests/data/logs//payments-astropay-20150616.gz seems not to exist
63
64civicrm.wmf.ERROR: astropay_audit: Archive file /srv/civi-sites/wmff/drupal/sites/all/modules/wmf_audit/tests/data/logs//payments-astropay-20150615.gz seems not to exist
65
66civicrm.wmf.ERROR: astropay_audit: Archive file /srv/civi-sites/wmff/drupal/sites/all/modules/wmf_audit/tests/data/logs//payments-astropay-20150614.gz seems not to exist
67
68civicrm.wmf.ERROR: astropay_audit: Archive file /srv/civi-sites/wmff/drupal/sites/all/modules/wmf_audit/tests/data/logs//payments-astropay-20150613.gz seems not to exist
69
70civicrm.wmf.ERROR: astropay_audit: Archive file /srv/civi-sites/wmff/drupal/sites/all/modules/wmf_audit/tests/data/logs//payments-astropay-20150612.gz seems not to exist
71
72civicrm.wmf.ERROR: astropay_audit: Archive file /srv/civi-sites/wmff/drupal/sites/all/modules/wmf_audit/tests/data/logs//payments-astropay-20150611.gz seems not to exist
73
74civicrm.wmf.ERROR: astropay_audit: Archive file /srv/civi-sites/wmff/drupal/sites/all/modules/wmf_audit/tests/data/logs//payments-astropay-20150610.gz seems not to exist
75
76civicrm.wmf.ERROR: astropay_audit: Archive file /srv/civi-sites/wmff/drupal/sites/all/modules/wmf_audit/tests/data/logs//payments-astropay-20150609.gz seems not to exist
77
78.civicrm.wmf.ERROR: astropay_audit: Archive file /srv/civi-sites/wmff/drupal/sites/all/modules/wmf_audit/tests/data/logs//payments-astropay-20150618.gz seems not to exist
79
80..civicrm.wmf.ERROR: braintree_audit: Archive file /srv/civi-sites/wmff/drupal/sites/all/modules/wmf_audit/tests/data/logs//payments-braintree-20220629.gz seems not to exist
81
82....civicrm.wmf.ERROR: ingenico_audit: Archive file /srv/civi-sites/wmff/drupal/sites/all/modules/wmf_audit/tests/data/logs//payments-ingenico-20170730.gz seems not to exist
83
84.civicrm.wmf.ERROR: ingenico_audit: Archive file /srv/civi-sites/wmff/drupal/sites/all/modules/wmf_audit/tests/data/logs//payments-ingenico-20180501.gz seems not to exist
85
86....civicrm.wmf.ERROR: ingenico_audit: Archive file /srv/civi-sites/wmff/drupal/sites/all/modules/wmf_audit/tests/data/logs//payments-ingenico-20171207.gz seems not to exist
87
88....F 252 / 583 ( 43%)
89..........FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 315 / 583 ( 54%)
90FFFFFFFFFFFFFFFFFFFFFFFFFF..................................... 378 / 583 ( 64%)
91............................PHP Fatal error: Maximum execution time of 180 seconds exceeded in /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/Civi/Api4/Utils/ReflectionUtils.php on line 77
92PHP Stack trace:
93PHP 1. {main}() /srv/civi-sites/wmff/vendor/bin/phpunit:0
94PHP 2. include() /srv/civi-sites/wmff/vendor/bin/phpunit:118
95PHP 3. PHPUnit\TextUI\Command::main() phpvfscomposer:///srv/civi-sites/wmff/vendor/phpunit/phpunit/phpunit:60
96PHP 4. PHPUnit\TextUI\Command->run() /srv/civi-sites/wmff/vendor/phpunit/phpunit/src/TextUI/Command.php:164
97PHP 5. PHPUnit\TextUI\TestRunner->doRun() /srv/civi-sites/wmff/vendor/phpunit/phpunit/src/TextUI/Command.php:208
98PHP 6. PHPUnit\Framework\TestSuite->run() /srv/civi-sites/wmff/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:632
99PHP 7. PHPUnit\Framework\TestSuite->run() /srv/civi-sites/wmff/vendor/phpunit/phpunit/src/Framework/TestSuite.php:761
100PHP 8. PHPUnit\Framework\TestSuite->run() /srv/civi-sites/wmff/vendor/phpunit/phpunit/src/Framework/TestSuite.php:761
101PHP 9. GeocoderTest->run() /srv/civi-sites/wmff/vendor/phpunit/phpunit/src/Framework/TestSuite.php:761
102PHP 10. PHPUnit\Framework\TestResult->run() /srv/civi-sites/wmff/vendor/phpunit/phpunit/src/Framework/TestCase.php:797
103PHP 11. GeocoderTest->runBare() /srv/civi-sites/wmff/vendor/phpunit/phpunit/src/Framework/TestResult.php:685
104PHP 12. GeocoderTest->setUp() /srv/civi-sites/wmff/vendor/phpunit/phpunit/src/Framework/TestCase.php:839
105PHP 13. GeocoderTest->callAPISuccess() /srv/civi-sites/wmff/drupal/sites/default/civicrm/extensions/org.wikimedia.geocoder/tests/phpunit/GeocoderTest.php:86
106PHP 14. GeocoderTest->civicrm_api() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/Civi/Test/Api3TestTrait.php:173
107PHP 15. civicrm_api() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/Civi/Test/Api3TestTrait.php:292
108PHP 16. Civi\API\Kernel->runSafe() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/api/api.php:22
109PHP 17. Civi\API\Kernel->runRequest() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/Civi/API/Kernel.php:81
110PHP 18. Civi\API\Provider\MagicFunctionProvider->invoke() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/Civi/API/Kernel.php:158
111PHP 19. civicrm_api3_system_flush() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php:89
112PHP 20. CRM_Core_Invoke::rebuildMenuAndCaches() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/api/v3/System.php:33
113PHP 21. CRM_Core_ManagedEntities->reconcile() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/CRM/Core/Invoke.php:417
114PHP 22. CRM_Core_ManagedEntities->reconcileEntities() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/CRM/Core/ManagedEntities.php:113
115PHP 23. CRM_Core_ManagedEntities->updateExistingEntity() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/CRM/Core/ManagedEntities.php:145
116PHP 24. civicrm_api4() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/CRM/Core/ManagedEntities.php:258
117PHP 25. Civi\Api4\Generic\DAOUpdateAction->execute() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/api/api.php:85
118PHP 26. Civi\API\Kernel->runRequest() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/Civi/Api4/Generic/AbstractAction.php:250
119PHP 27. Civi\Api4\Provider\ActionObjectProvider->invoke() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/Civi/API/Kernel.php:158
120PHP 28. Civi\Api4\Generic\DAOUpdateAction->_run() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/Civi/Api4/Provider/ActionObjectProvider.php:72
121PHP 29. Civi\Api4\Generic\DAOUpdateAction->updateRecords() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/Civi/Api4/Generic/AbstractUpdateAction.php:93
122PHP 30. Civi\Api4\Generic\DAOUpdateAction->writeObjects() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/Civi/Api4/Generic/DAOUpdateAction.php:30
123PHP 31. Civi\Api4\Generic\DAOUpdateAction->write() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/Civi/Api4/Generic/Traits/DAOActionTrait.php:134
124PHP 32. CRM_Core_BAO_OptionValue::create() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/Civi/Api4/Generic/Traits/DAOActionTrait.php:163
125PHP 33. CRM_Core_BAO_OptionValue::add() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/CRM/Core/BAO/OptionValue.php:34
126PHP 34. CRM_Utils_Hook::post() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/CRM/Core/BAO/OptionValue.php:197
127PHP 35. Civi\Core\CiviEventDispatcher->dispatch() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/CRM/Utils/Hook.php:370
128PHP 36. Civi\Core\UnoptimizedEventDispatcher->dispatch() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/Civi/Core/CiviEventDispatcher.php:260
129PHP 37. Civi\Core\UnoptimizedEventDispatcher->callListeners() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php:73
130PHP 38. CRM_Core_BAO_Managed::on_hook_civicrm_post() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php:251
131PHP 39. CRM_Core_BAO_Managed::isApi4ManagedType() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/CRM/Core/BAO/Managed.php:36
132PHP 40. Civi\Api4\Utils\CoreUtil::getInfoItem() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/CRM/Core/BAO/Managed.php:53
133PHP 41. Civi\Api4\Provider\ActionObjectProvider->getEntities() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/Civi/Api4/Utils/CoreUtil.php:58
134PHP 42. Civi\Api4\Afform::getInfo() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/Civi/Api4/Provider/ActionObjectProvider.php:158
135PHP 43. Civi\Api4\Generic\AbstractEntity::getInfo() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/ext/afform/core/Civi/Api4/Afform.php:279
136PHP 44. Civi\Api4\Utils\ReflectionUtils::getCodeDocs() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/Civi/Api4/Generic/AbstractEntity.php:164
137PHP 45. Civi\Api4\Utils\ReflectionUtils::parseDocBlock() /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/Civi/Api4/Utils/ReflectionUtils.php:33

Related Objects

Event Timeline

It's timing out during a managed entities reconciliation in the geocoder test - reconcileEntities - assuming the test is initiating that it is now possible to only reconcile entities for specific extensions (api v4 Managed.reconcile api) - which might speed it up

Change 904278 had a related patch set uploaded (by Jgleeson; author: Jgleeson):

[wikimedia/fundraising/crm@master] Reduce logging noise generated by AstroPayAuditTests

https://gerrit.wikimedia.org/r/904278

Change 904278 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Reduce logging noise generated by AstroPayAuditTests

https://gerrit.wikimedia.org/r/904278

Change 905305 had a related patch set uploaded (by Jgleeson; author: Eileen):

[wikimedia/fundraising/crm@master] What fails

https://gerrit.wikimedia.org/r/905305

Change 905305 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] What fails

https://gerrit.wikimedia.org/r/905305

greg triaged this task as Medium priority.Oct 16 2023, 10:26 PM
greg moved this task from Backlog to Being Reviewed on the Fundraising Tech - Chaos Crew board.
greg subscribed.

The above patches are merged, are we good here?

So the timeouts are gone, but there are other things failing in the tests locally. Some of the post-test assertions added in https://gerrit.wikimedia.org/r/c/wikimedia/fundraising/crm/+/968387 specifically seem to fail locally (though not on CI)

Change 972885 had a related patch set uploaded (by Ejegg; author: Ejegg):

[wikimedia/fundraising/crm@master] Exclude example data from post-test asserts

https://gerrit.wikimedia.org/r/972885

Change 972885 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Exclude example data from post-test asserts

https://gerrit.wikimedia.org/r/972885

XenoRyet set Final Story Points to 2.