Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests are failing with libxml 2.9.10 #34733

Closed
5 tasks
ihor-sviziev opened this issue Nov 30, 2021 · 23 comments
Closed
5 tasks

Unit tests are failing with libxml 2.9.10 #34733

ihor-sviziev opened this issue Nov 30, 2021 · 23 comments
Labels
Area: Framework Component: Framework/Setup USE ONLY for FRAMEWORK RELATED BUG! E.g If bug occurs during Catalog Setup use just Catalog Issue: needs update Additional information is require, waiting for response Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reported on 2.4.x Indicates original Magento version for the Issue report.

Comments

@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Nov 30, 2021

Preconditions (*)

Steps to reproduce (*)

  1. Checkout platform-health branch from magento2 repository
  2. run composer install
  3. run vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist

Expected result (*)

  1. All unit tests should be passing

Actual result (*)

  1. We have 158 test failures
FAILURES!
Tests: 22720, Assertions: 61403, Failures: 158, Skipped: 184, Incomplete: 47.
  1. 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

  1. I prepared a branch on how to run unit tests on Github Actions (based on top of platform-health branch):
    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

  1. When using centos based image (https://warden.dev/) - we have different test failures.
  2. 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”.
@m2-assistant
Copy link

m2-assistant bot commented Nov 30, 2021

Hi @ihor-sviziev. Thank you for your report.
To speed up processing of this issue, make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@andrewbess
Copy link

Hello @ihor-sviziev
Thank you for your vigilance

@xmav
Copy link
Contributor

xmav commented Dec 3, 2021

Thats reporting issue (from Jenkins to GitHub). Tests are running in different groups in few threads. Total number of reported OpenSource php unit tests is 26011
platform-helath branch is not stable branch. It holds "work in progress" type of code so it is expected for now to see failures there.
Btw which PHP version did you use to run tests?

@xmav
Copy link
Contributor

xmav commented Dec 3, 2021

From what I see most of the failures in your results related to xml\xsd. Please double check that everything is ok on that environment

@ihor-sviziev
Copy link
Contributor Author

@xmav, please ping me in Slack, it will be way faster to check it

@ihor-sviziev
Copy link
Contributor Author

ihor-sviziev commented Dec 8, 2021

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?

@Nuranto
Copy link
Contributor

Nuranto commented May 27, 2022

I confirm this issue on Debian bullseye / libxml 2.9.10 on M2.4.4.

(2.9.4 is not available on standard bullseye)

@ihor-sviziev ihor-sviziev changed the title Unit tests are failing Unit tests are failing with libxml 2.9.10 May 27, 2022
@rvr31
Copy link

rvr31 commented Oct 6, 2022

For others running in docker and facing this issue, until this is fixed in the core, sharing my small hack;

Running in a php:8.1-fpm-alpine container the following downgrades your libxml2 to 2.9.4 and dropped failures massively.
I've not encountered an issue by doing this so far. PHP will still say it's built with the newer version but it will load this older version.

FROM php:8.1-fpm-alpine

## LIBXML 2.9.4 for Magento unit tests (https://github.com/magento/magento2/issues/34733)
RUN apk add --no-cache --virtual .build-deps build-base automake libtool zlib-dev autoconf make && \
  apk del libxml2-dev && \
  curl https://gitlab.gnome.org/GNOME/libxml2/-/archive/v2.9.4/libxml2-v2.9.4.zip -o /tmp/libxml.zip && \
  cd /tmp && \
  unzip libxml.zip && \
  cd libxml2-v2.9.4 && \
  ./autogen.sh && \
  make && \
  make install  && \
  apk del --no-network .build-deps && \
  rm /usr/lib/libxml2.so.2 && \
  ln -s /usr/local/lib/libxml2.so.2.9.4 /usr/lib/libxml2.so.2

Make sure you test this before you use this in production, use at your own risk.

@m2-assistant
Copy link

m2-assistant bot commented Dec 9, 2022

Hi @engcom-Lima. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Lima engcom-Lima removed their assignment Dec 22, 2022
@engcom-Dash engcom-Dash self-assigned this Dec 22, 2022
@m2-assistant
Copy link

m2-assistant bot commented Dec 22, 2022

Hi @engcom-Dash. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

    1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
      DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
    1. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
    1. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

@engcom-Dash
Copy link
Contributor

engcom-Dash commented Dec 23, 2022

Hi @ihor-sviziev ,

We are trying to reproduce the issue in 2.4-develop instance.But we are not able to reproduce the issue.
We got 23 failures in while running the - vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist command.

Magento Version -2.4 develop
PHP - 8.1

Steps to Reproduce:
1.Install fresh Magento instance
2.Checkout Platform-Health branch Magento2 repository using
3.Run Composer install command
4.Run vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist command
5.We got 23 Failures....

Screenshots:
Screenshot 2022-12-23 at 5 20 35 PM
Screenshot 2022-12-23 at 5 22 44 PM

As per the description there are 153 failures was occurred. But we got 23 Failures only occurred.We are not able to reproduce the issue.

Let us know if we missing anything!!!

Thanks!!!!

@engcom-Dash engcom-Dash added the Issue: needs update Additional information is require, waiting for response label Dec 23, 2022
@engcom-Dash engcom-Dash added the Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch label Dec 23, 2022
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-8018 is successfully created for this GitHub issue.

@m2-community-project m2-community-project bot added the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Feb 23, 2023
@m2-assistant
Copy link

m2-assistant bot commented Feb 23, 2023

✅ Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@engcom-November engcom-November added the Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. label Feb 23, 2023
@github-jira-sync-bot
Copy link

❌ You don't have permission to export this issue.

@engcom-Bravo
Copy link
Contributor

Hi @ihor-sviziev,

We got Confirmation from internal team.

We have run 2 jenkins build on baseimages/centos7php82os2mysql80 & baseimages/centos7php81os2mysql80

There are no failures observed.

Hence this issue which is created is no longer reproducible.

Screenshots for reference:

Screenshot 2023-05-02 at 14 07 42

Screenshot 2023-05-02 at 14 06 23

image-2023-05-02-14-12-05-876

image-2023-05-02-14-12-13-747

Thanks.

@engcom-Bravo engcom-Bravo added Issue: needs update Additional information is require, waiting for response and removed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch labels May 8, 2023
@m2-community-project m2-community-project bot added Progress: ready for dev and removed Progress: PR Created Indicates that Pull Request has been created to fix issue labels May 8, 2023
@github-jira-sync-bot github-jira-sync-bot added Progress: PR Created Indicates that Pull Request has been created to fix issue and removed Progress: ready for dev labels May 8, 2023
@ihor-sviziev
Copy link
Contributor Author

ihor-sviziev commented May 8, 2023

hi @engcom-Bravo,
I just re-checked - it looks like the listed errors are not there anymore, but I still have 2 failures:
https://github.com/ihor-sviziev/magento2/actions/runs/4916496544/jobs/8780333650

There were 2 failures:

1) Magento\MessageQueue\Test\Unit\Console\PoisonPillApplyDuringSetupUpgradeTest::testChangeVersion
Expectation failed for method name is "put" when invoked 1 time(s).
Method was expected to be called 1 times, actually called 0 times.

2) Magento\Framework\Config\Test\Unit\XsdTest::testInvalidXmlFile with data set #0 ('view.xsd', 'view_invalid.xml', 8)
Failed asserting that 9 matches expected 8.

/home/runner/work/magento2/magento2/lib/internal/Magento/Framework/Config/Test/Unit/XsdTest.php:38

FAILURES!
Tests: 23240, Assertions: 63160, Failures: 2, Skipped: 231.

image

And locally, in warden, I have exactly the same issue.

Note: I rebased my branch on top of current 2.4-develop branch and updated it to use PHP 8.1 2.4-develop...ihor-sviziev:run-unit-tests

@ihor-sviziev
Copy link
Contributor Author

So since this issue isn't reproducing anymore, I'm closing it. But keep in mind. The tests still failing

@m2-community-project m2-community-project bot added Progress: done and removed Progress: PR Created Indicates that Pull Request has been created to fix issue labels May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Framework Component: Framework/Setup USE ONLY for FRAMEWORK RELATED BUG! E.g If bug occurs during Catalog Setup use just Catalog Issue: needs update Additional information is require, waiting for response Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reported on 2.4.x Indicates original Magento version for the Issue report.
Projects
Development

No branches or pull requests