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

Concurrency Tests - Update ExternalBatch for symfony/process v4.1+ (esp Drupal 10) #27072

Merged
merged 1 commit into from
Aug 15, 2023

Conversation

totten
Copy link
Member

@totten totten commented Aug 15, 2023

Before

api_v3_JobProcessMailingTest::testConcurrency() and Civi\FlexMailer\ConcurrencyTest fail when executed on Drupal 10. The errors look like:

7) Civi\FlexMailer\ConcurrentDeliveryTest::testConcurrency with data set #6 (array(2, 10, 1, 5, 6), array(3, 1, 1), 20)
TypeError: Symfony\Component\Process\Process::__construct(): Argument #1 ($command) must be of type array, string given, called in /home/totten/bknix/build/d10/vendor/civicrm/civicrm-core/Civi/API/ExternalBatch.php on line 220

/home/totten/bknix/build/d10/vendor/symfony/process/Process.php:143
/home/totten/bknix/build/d10/vendor/civicrm/civicrm-core/Civi/API/ExternalBatch.php:220
/home/totten/bknix/build/d10/vendor/civicrm/civicrm-core/Civi/API/ExternalBatch.php:97
/home/totten/bknix/build/d10/vendor/civicrm/civicrm-core/tests/phpunit/api/v3/JobProcessMailingTest.php:464
/home/totten/bknix/build/d10/vendor/civicrm/civicrm-core/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ConcurrentDeliveryTest.php:56
/home/totten/bknix/build/d10/vendor/civicrm/civicrm-core/tests/phpunit/CiviTest/CiviUnitTestCase.php:237
/home/totten/bknix/extern/phpunit8/phpunit8.phar:1721

After

These tests pass in the same environment.

Technical Details

symfony/process v4.1 deprecated the usage of new Process(string) and added Process::fromShellCommandline(string). The new Process(string) was dropped from v5.x and v6.x. So you get an unconditional failure on D10. (On other platforms, it can also fail... depending on how you deal with deprecations.)

In civicrm-core:composer.json, the minimum version of symfony/process is 4.4. So that means we can use the newer Process::fromShellCommandline(string).

Before
------

`api_v3_JobProcessMailingTest::testConcurrency()` and `Civi\FlexMailer\ConcurrencyTest`
fail when executed on Drupal 10.

After
-----

Pass when executed on Drupal 10

Technical Details
-----------------

`symfony/process` v4.1 deprecated the usage of `new Process(string)` and
added `Process::fromShellCommandline(string)`. The `new Process(string)` was
dropped from v5.x and v6.x. So you get an unconditional failure on D10. (On
other platforms, it can also fail... depending on how you deal with
deprecations.)

In `civicrm-core:composer.json`, the minimum mversion of `symfony/process` is `4.4`.
So that means we can use the newer `Process::fromShellCommandline(string)`.
@civibot
Copy link

civibot bot commented Aug 15, 2023

Thank you for contributing to CiviCRM! ❤️ We will need to test and review the PR. 👷

Introduction for new contributors
  • If this is your first PR, an admin will greenlight automated testing with the command ok to test or add to whitelist.
  • A series of tests will automatically run. You can see the results at the bottom of this page (if there are any problems, it will include a link to see what went wrong).
  • A demo site will be built where anyone can try out a version of CiviCRM that includes your changes.
  • If this process needs to be repeated, an admin will issue the command test this please to rerun tests and build a new demo site.
  • Before this PR can be merged, it needs to be reviewed. Please keep in mind that reviewers are volunteers, and their response time can vary from a few hours to a few weeks depending on their availability and their knowledge of this particular part of CiviCRM.
  • A great way to speed up this process is to "trade reviews" with someone - find an open PR that you feel able to review, and leave a comment like "I'm reviewing this now, could you please review mine?" (include a link to yours). You don't have to wait for a response to get started (and you don't have to stop at one!) the more you review, the faster this process goes for everyone 😄
  • To ensure that you are credited properly in the final release notes, please add yourself to contributor-key.yml
  • For more information about contributing, see CONTRIBUTING.md.
Quick links for reviewers

@civibot civibot bot added the master label Aug 15, 2023
@totten
Copy link
Member Author

totten commented Aug 15, 2023

To run the tests on D10, one can use https://test.civicrm.org/job/CiviCRM-Manual-Test/. Compare:

@demeritcowboy demeritcowboy merged commit ae91d73 into civicrm:master Aug 15, 2023
@totten totten deleted the master-test-d10 branch August 15, 2023 18:07
@totten totten changed the title Concurrency Tests - Update ExternalBatch for symfony/proces v4.1+ (esp Drupal 10) Concurrency Tests - Update ExternalBatch for symfony/process v4.1+ (esp Drupal 10) Aug 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants