Adjust BrowserTestBase::filePreDeleteCallback() so it does not fail unnecesarily

Created on 28 September 2016, almost 8 years ago
Updated 18 April 2024, 5 months ago

While setting up a Jenkins job to run BrowserTests, we realized that we could not run tests with this command with the jenkins user when using ACLs to grant write permissions but not chmod permissions:

vendor/bin/phpunit -c core --testsuite kernel --group mymodule --verbose --debug

The above command was failing due to directory permissions, here is the error message:

Exception: Warning: mkdir(): Permission denied
Drupal\Component\PhpStorage\FileStorage->createDirectory()() (Line: 165)


/var/www/myweb/drupal/core/lib/Drupal/Core/Test/HttpClientMiddleware/TestHttpClientMiddleware.php:44
/var/www/myweb/drupal/vendor/guzzlehttp/promises/src/FulfilledPromise.php:39
/var/www/myweb/drupal/vendor/guzzlehttp/promises/src/TaskQueue.php:61
/var/www/myweb/drupal/vendor/guzzlehttp/promises/src/Promise.php:246
/var/www/myweb/drupal/vendor/guzzlehttp/promises/src/Promise.php:223
/var/www/myweb/drupal/vendor/guzzlehttp/promises/src/Promise.php:266
/var/www/myweb/drupal/vendor/guzzlehttp/promises/src/Promise.php:225
/var/www/myweb/drupal/vendor/guzzlehttp/promises/src/Promise.php:62
/var/www/myweb/drupal/vendor/guzzlehttp/guzzle/src/Client.php:129
/var/www/myweb/drupal/vendor/fabpot/goutte/Goutte/Client.php:138
/var/www/myweb/drupal/vendor/symfony/browser-kit/Client.php:315
/var/www/myweb/drupal/vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php:144
/var/www/myweb/drupal/vendor/behat/mink/src/Session.php:143
/var/www/myweb/drupal/core/tests/Drupal/Tests/BrowserTestBase.php:330
/var/www/myweb/drupal/core/tests/Drupal/Tests/BrowserTestBase.php:433
/var/lib/jenkins/workspace/myJob/mymodule/tests/src/Functional/Mytest.php:56

It is a bad practice to allow the jenkins user to sudo into www-data in order to run tests and overcome the above warnings. We needed a way to run this command from the jenkins user and, as long as the sites/simpletest directory had the correct ownership (jenkins:www-data), then we should not get these kind of errors.

📌 Task
Status

Closed: outdated

Version

11.0 🔥

Component
PHPUnit 

Last updated about 11 hours ago

Created by

🇪🇸Spain juampynr

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024