Giter Site home page Giter Site logo

Comments (11)

duartegarin avatar duartegarin commented on May 25, 2024 2

Ended up resolving this by calling phpunit with the web user

from drupal9ci.

duartegarin avatar duartegarin commented on May 25, 2024 1

Managed to get it working, by starting apache before running the phpunit command.
I know have another issue, which is permission denied:

Exception: User warning: mkdir(): Permission Denied
Drupal\Component\PhpStorage\FileStorage->createDirectory()() (Line: 174)

from drupal9ci.

juampynr avatar juampynr commented on May 25, 2024

Hi @acha5066,

What CI tool are you using? Travis or CircleCI? Can you paste screenshots or describe further details about your setup and the error?

from drupal9ci.

duartegarin avatar duartegarin commented on May 25, 2024

Hi @juampynr ,
I'm also facing issues running Drupal PHPUnit Functional tests.

However, the only thing I see on CircleCI is:
"Too long with no output (exceeded 10m0s)"

The tests work fine locally, but it is using a different endpoint. For these I am just using the default (modified for 8.5) phpunit.xml that comes with the installer.

Any thoughts on what might be wrong?
Thanks!

from drupal9ci.

duartegarin avatar duartegarin commented on May 25, 2024

Actually I just tried a different test (Metatag module) and the error is the same as above:

For example:

GuzzleHttp\Exception\ConnectException: cURL error 7: Failed to connect to localhost port 80: Connection refused (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

/var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:185
/var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:149
/var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:102
/var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php:43
/var/www/html/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php:28
/var/www/html/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php:51
/var/www/html/web/core/tests/Drupal/Tests/BrowserTestBase.php:326
/var/www/html/web/core/lib/Drupal/Core/Test/HttpClientMiddleware/TestHttpClientMiddleware.php:31
/var/www/html/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php:37
/var/www/html/vendor/guzzlehttp/guzzle/src/Middleware.php:36
/var/www/html/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php:54
/var/www/html/vendor/guzzlehttp/guzzle/src/Middleware.php:60
/var/www/html/vendor/guzzlehttp/guzzle/src/HandlerStack.php:67
/var/www/html/vendor/guzzlehttp/guzzle/src/Client.php:277
/var/www/html/vendor/guzzlehttp/guzzle/src/Client.php:125
/var/www/html/vendor/guzzlehttp/guzzle/src/Client.php:131
/var/www/html/vendor/fabpot/goutte/Goutte/Client.php:180
/var/www/html/vendor/symfony/browser-kit/Client.php:351
/var/www/html/vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php:144
/var/www/html/vendor/behat/mink/src/Session.php:148
/var/www/html/web/core/tests/Drupal/Tests/BrowserTestBase.php:266
/var/www/html/web/core/tests/Drupal/Tests/BrowserTestBase.php:246
/var/www/html/web/core/tests/Drupal/Tests/BrowserTestBase.php:391
/var/www/html/web/modules/contrib/metatag/tests/src/Functional/DefaultTags.php:43```

from drupal9ci.

JakeMilburn avatar JakeMilburn commented on May 25, 2024

Hi. I am having the same problem as the original poster.
Getting the error Failed to connect to localhost port 80 when running functional tests.
Has anyone else found a solution or hit this issue?
Base URL is set in phpunit.xml as
<env name="SIMPLETEST_BASE_URL" value="http://localhost"/>
This is running in Circle CI.

from drupal9ci.

juampynr avatar juampynr commented on May 25, 2024

Hi @JakeMilburn! Can you open a new issue with the above details plus anything else that may help to pinpoint the reason of the error?

Thanks!

from drupal9ci.

welly avatar welly commented on May 25, 2024

@JakeMilburn I found that the jobServeDrupal job wasn't being called from either another method in RoboFile.php or .gitlab-ci as per the default configuration so have added:

  before_script:
    - vendor/bin/robo job:serve-drupal

to drupal9ci:unit_kernel_tests and drupal9ci:code_coverage in .gitlab-ci and now it works. I am getting a different error now but I've made some progress.

from drupal9ci.

juampynr avatar juampynr commented on May 25, 2024

Thanks for the update @welly ! Let us know if you need help with the different error that you mentioned.

from drupal9ci.

welly avatar welly commented on May 25, 2024

One of the problems I found was I was getting mkdir() permission denied errors when running functional tests and code coverage reports. I forget where I found a suggested solution for the issue but in runUnitTests() by running it through sudo. I suspect the apache environment variables are redundant though.

    $tasks[] = $this->taskExecStack()
      ->exec('chmod -R 777 ../web/sites')
      ->envVars(['XDEBUG_MODE' => 'coverage', 'APACHE_RUN_USER' => 'root', 'APACHE_RUN_GROUP' => 'root'] + getenv())
      ->dir('web')
      ->exec('sudo -u root -E sudo -u www-data ../vendor/bin/phpunit -c core --verbose modules/custom');

seemed to fix it. I'm not sure if it's the perfect/ideal fix but it does seem to work. I had to do something similar for runCoverageReport() as well.

from drupal9ci.

juampynr avatar juampynr commented on May 25, 2024

I think that's fine, this is an isolated environment that runs temporarily.

from drupal9ci.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.