magento2: Unit tests are failing with libxml 2.9.10
Preconditions (*)
Steps to reproduce (*)
- Checkout platform-health branch from magento2 repository
- run
composer install - run
vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist
Expected result (*)
- All unit tests should be passing
Actual result (*)
- We have 158 test failures
FAILURES!
Tests: 22720, Assertions: 61403, Failures: 158, Skipped: 184, Incomplete: 47.
- Errors :
1) PayPal\Braintree\Test\Unit\Block\FormTest::testIsVaultEnabled
TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object
/var/www/html/vendor/magento/framework/Session/SessionManager.php:169
/var/www/html/vendor/paypal/module-braintree-core/Block/Form.php:116
/var/www/html/vendor/paypal/module-braintree-core/Test/Unit/Block/FormTest.php:156
2) PayPal\Braintree\Test\Unit\Ui\Component\Report\Filters\Type\DateRangeTest::testPrepare with data set #1 ('test_date', array(array(null, '11-05-2015')), array('2015-05-11T23:59:00+0000', 'lteq'))
Exception: Deprecated Functionality: DateTime::__construct(): Passing null to parameter #1 ($datetime) of type string is deprecated in /var/www/html/vendor/paypal/module-braintree-core/Test/Unit/Ui/Component/Report/Filters/Type/DateRangeTest.php on line 117
/var/www/html/vendor/magento/framework/App/ErrorHandler.php:61
/var/www/html/vendor/paypal/module-braintree-core/Test/Unit/Ui/Component/Report/Filters/Type/DateRangeTest.php:117
--
Failures (I have 153 failures, I give you only one for example) :
153) Magento\Framework\ObjectManager\Test\Unit\Config\XsdTest::testSchemaCorrectlyIdentifiesInvalidXml with data set "virtualtype with digits_and_prefix_slash" ('<config xmlns:xsi="http://www...onfig/>', array('Element 'virtualType', attrib...e: 2\n', 'Element 'virtualType', attrib...e: 2\n', 'Element 'virtualType', attrib...e: 2\n'))
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
Array (
0 => 'Element 'virtualType', attrib...e: 2\n'
- 1 => 'Element 'virtualType', attribute 'name': '\777Digits\IsNotAllowed' is not a valid value of the atomic type 'phpClassName'.\n
+ 1 => 'Element 'virtualType', attribute 'name': Warning: No precomputed value available, the value was either invalid or something strange happened.\n
Line: 2\n
'
- 2 => 'Element 'virtualType', attrib...e: 2\n'
)
Additional Information
Same issue is reported here. Launching Unit tests with M2.4.4 and PHP8.1 gives errors and failures
Additional Notes
- I prepared a branch on how to run unit tests on Github Actions (based on top of
platform-healthbranch): https://github.com/magento/magento2/compare/platform-health...ihor-sviziev:run-unit-tests
You can find the result of the execution here: https://github.com/ihor-sviziev/magento2/runs/4353240450?check_suite_focus=true
- When using centos based image (https://warden.dev/) - we have different test failures.
- I noted that the amount of ran unit tests on Magento build is different: Example: https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/34723/e5b7c4fa8fbdcd87b9a7e2551dc072ab/Unit/console-error-logs.html At the end of CE tests
Tests: **6875**, Assertions: 14857, Failures: 1, Skipped: 99, Incomplete: 7.
But when we’re running tests locally, we have the following output (4X more tests were run!):
Tests: **22720**, Assertions: 61407, Failures: 158, Skipped: 184, Incomplete: 47.
/CC @andrewbess @xmav
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 3
- Comments: 23 (11 by maintainers)
Verified the issue on Magento 2.4-develop instance and the issue is reproducible. Hence confirming this issue. Unit tests are getting failed on latest Magento 2.4-develop instance as well.
After discussion with @xmav in Slack - it feels like the current tests work with outdated libxml2 library version 2.9.1, while on Ubuntu 20.04 we have 2.9.10 or 2.9.12.
After downgrading to libxml 2.9.4 (used Debian buster based installation) everything works fine.
Just a side note: on local env unit tests are running for 2 minutes. Why the hell they’re running for 30+ mins on the CI?