magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.51k stars 9.31k forks source link

Magento v2.3.2 Integration Test Framework fails on Alpine Linux #23637

Closed damienwebdev closed 3 years ago

damienwebdev commented 5 years ago

Preconditions (*)

  1. Magento v2.3.2
  2. Alpine Linux
  3. PHP 7.2

Steps to reproduce (*)

  1. Run an instance of Alpine Linux w/ php7.2
  2. Setup Magento environment, etc.
  3. cd dev/tests/integration
  4. cp phpunit.xml.dist phpunit.xml
  5. phpunit --configuration phpunit.xml

Expected result (*)

I expect to be able to run the test suite.

Actual result (*)

The test suite fails with

Fatal error: Uncaught Exception: ps: unrecognized option: pid
BusyBox v1.30.1 (2019-06-12 17:51:55 UTC) multi-call binary.

Usage: ps [-o COL1,COL2=HEADER]

Show list of processes

    -o COL1,COL2=HEADER Select columns for display in /var/www/html/vendor/magento/framework/Shell.php:63
Stack trace:
#0 /var/www/html/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php(74): Magento\Framework\Shell->execute('ps --pid '222' ...', Array)
#1 /var/www/html/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php(55): Magento\TestFramework\Helper\Memory->_getUnixProcessMemoryUsage(222)
#2 /var/www/html/dev/tests/integration/framework/Magento/TestFramework/MemoryLimit.php(127): Magento\TestFramework\Helper\Memory->getRealMemoryUsage()
#3 /var/www/html/dev/tests/integration/framework/Magento/TestFramework/MemoryLimit.php(59): Magento\TestFramework\MemoryLimit->_getUsage()
#4 /var/www/html/dev/tests/integration/framework/Magento/TestFramework/Bootstrap/Memory.php(50): Magento\TestFramework\MemoryLimit- in /var/www/html/vendor/magento/framework/Shell.php on line 64
m2-assistant[bot] commented 5 years ago

Hi @damienwebdev. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

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

For more details, please, review the Magento Contributor Assistant documentation.

@damienwebdev do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?


damienwebdev commented 5 years ago

The code in question is:

https://github.com/magento/magento2/blob/0eb8677b0b4e35606032e856cc1ef7c80e68829f/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php#L71

We would need an additional variant for the base alpine ps, or as there are several conditionals in this file that could be cleaned up, a ps abstraction.

m2-assistant[bot] commented 5 years ago

Hi @engcom-Charlie. 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: :point_down:

engcom-Charlie commented 5 years ago

Hello @damienwebdev ! Thank you for your report ! I have tested this issue using Ubuntu 16.04 and was not able to reproduce it. Have you tried to reproduce it using other OS except Alpine Linux ?

integr

damienwebdev commented 5 years ago

@engcom-Charlie No. This bug only exists in Alpine Linux. Out-of-the-box Alpine Linux does not have a pid flag for the ps command.

I'm positive the code runs just fine on most common Ubuntu flavors, but Alpine Linux is slightly different, and this is one of the ways.

Much like the code in question handles the "OS" (e.g. Mac vs. Linux), we'll need a way to handle Alpine Linux as well.

magento-engcom-team commented 5 years ago

:white_check_mark: Confirmed by @engcom-Charlie Thank you for verifying the issue. Based on the provided information internal tickets MC-18138 were created

Issue Available: @engcom-Charlie, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

damienwebdev commented 5 years ago

@engcom-Charlie Additionally, as I just tested this on my Alpine image, merely adding a isAlpine flavor for the conditional:

if($this->isMacOS() || $this->isAlpineLinux())

https://github.com/magento/magento2/blob/0eb8677b0b4e35606032e856cc1ef7c80e68829f/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php#L71

Would work as the command:

https://github.com/magento/magento2/blob/0eb8677b0b4e35606032e856cc1ef7c80e68829f/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php#L72

Works in Alpine.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Thank you for your contributions.

damienwebdev commented 3 years ago

Not stale.

aliuosio commented 3 years ago

exchange "allure-framework/allure-phpunit": "~1.2.0" with "allure-framework/allure-phpunit": "~1.2.3" to fix

magento-engcom-team commented 3 years ago

Hi @damienwebdev.

Thank you for your report and collaboration!

The related internal Jira ticket MC-23829 was closed as Fixed.

The fix will be available with the upcoming 2.4.3 release.

speller commented 2 years ago

I still have this issue in 2.4.3:

../../../vendor/bin/phpunit
PHP Fatal error:  Uncaught Exception: sh: tasklist.exe: not found in /magento/vendor/magento/framework/Shell.php:65
Stack trace:
#0 /magento/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php(92): Magento\Framework\Shell->execute('tasklist.exe /f...', Array)
#1 /magento/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php(58): Magento\TestFramework\Helper\Memory->_getWinProcessMemoryUsage(195)
#2 /magento/dev/tests/integration/framework/Magento/TestFramework/MemoryLimit.php(127): Magento\TestFramework\Helper\Memory->getRealMemoryUsage()
#3 /magento/dev/tests/integration/framework/Magento/TestFramework/MemoryLimit.php(59): Magento\TestFramework\MemoryLimit->_getUsage()
#4 /magento/dev/tests/integration/framework/Magento/TestFramework/Bootstrap/Memory.php(50): Magento\TestFramework\MemoryLimit->printStats()
#5 [internal function]: Magento\TestFramework\Bootstrap\Memory->displayStats()
#6 {main}

Next Magento\Framework\Exception\LocalizedException: Command returned non-zero exit code:
`task in /magento/vendor/magento/framework/Shell.php on line 66

It fails to run the ps --pid %s --format rss --no-headers command and tries to run a Windows command.

When it really be fixed?

stollr commented 3 weeks ago

@damienwebdev I can confirm that this issue still exists in Alpine Docker image with Magento 2.4.7-p2.

Executing ps --pid {PID} --format rss --no-headers results in

ps: unrecognized option: pid BusyBox v1.36.1 (2024-09-17 06:35:48 UTC) multi-call binary.

Usage: ps [-o COL1,COL2=HEADER] [-T]

Show list of processes

   -o COL1,COL2=HEADER     Select columns for display
   -T                      Show threads