Error when running PHPUnit tests after latest changes
Closed this issue · 3 comments
Hi,
We were using your image on our CircleCI setup and after that changes pushed 5 days ago, our checks started to fail.
We updated these files:
- behat.xml: drupal_root from
/var/www/html/web
to/var/www/html
- config.xml: all
/var/www/html
to/opt/drupal
However, we are still facing an issue.
> DrupalProject\composer\ScriptHandler::createRequiredFiles
Create a sites/default/files directory with chmod 0777
[Composer\Install] Done in 29.308s
[2K18 [>---------------------------] 0%[Exec] Running dockerize -wait tcp://localhost:3306 -timeout 1m
2020/09/22 05:37:52 Waiting for: tcp://localhost:3306
2020/09/22 05:37:52 Connected to tcp://localhost:3306
[Exec] Done in 0.011s
[Exec] Running vendor/bin/drush --root=/opt/drupal/web site-install --verbose --yes --db-url='mysql://root@127.0.0.1/drupal8'
Warning: require(/opt/drupal/web/vendor/composer/../../load.environment.php): failed to open stream: No such file or directory in /opt/drupal/web/vendor/composer/autoload_real.php on line 73
Call Stack:
0.0001 413432 1. {main}() /opt/drupal/web/vendor/drush/drush/drush:0
0.0004 425168 2. require('/opt/drupal/web/vendor/drush/drush/drush.php') /opt/drupal/web/vendor/drush/drush/drush:4
0.0005 426208 3. include_once('/opt/drupal/web/vendor/autoload.php') /opt/drupal/web/vendor/drush/drush/drush.php:56
0.0007 439880 4. ComposerAutoloaderInit7b63ccd3d875797d5feebde768e347dc::getLoader() /opt/drupal/web/vendor/autoload.php:7
0.0351 3932568 5. composerRequire7b63ccd3d875797d5feebde768e347dc() /opt/drupal/web/vendor/composer/autoload_real.php:63
It seem that /opt/drupal/web/vendor/composer/
should be /opt/drupal/vendor/composer/
.
If we move load.environment.php
to web
folder, tests start to run successfully. However, this is not an option, right? since this is a core file.
Really appreciate if you can help us or have an idea/suggestion on how can we fix the issue above.
Thanks,
Carol
Hi Carol!
Sorry for the issues this caused. Admittedly I didn't realize how disruptive the changes were until I was deep into it. I updated the CircleCI demo repo with necessary changes, which might be helpful for you to compare and mimic:
https://github.com/m4olivei/drupal8-circleci/pull/2/files
For our setup on our actual project, we had to make the following changes (similar to demo repo):
- Replace
/var/www/html
with/opt/drupal
in the following places:- behat.yml
- phpunit.xml
- .circleci/config.yml
- Anywhere else you might find it in your project
- Invalidate the CircleCI cache (see https://circleci.com/docs/2.0/caching/#managing-caches).
From the sounds of it, I'd guess your facing the second issue above, eg. you need to invalidate your CircleCI cache. For example, here is an excerpt of our CircleCI config.yml as a diff that we needed to change to invalidate the CircleCI cache:
restore_cache: &restore_cache
# We use the composer.lock as a way to determine if we can cache our build.
keys:
- - v4-dependencies-{{ .Branch }}-{{ checksum "composer.lock" }}
+ - v5-dependencies-{{ .Branch }}-{{ checksum "composer.lock" }}
# fallback to using the latest master cache if no exact match is found
- - v4-dependencies-master-
+ - v5-dependencies-master-
Alternatively, or as an interim solution while you work out the changes, you can pin the Docker image to the the previous hash that all your jobs had been working under, which is: juampynr/drupal8ci@sha256:ade6da2be7b6fdbc946e8331c1510470fb574b7e351036a648cd5b90af19944f
. You'd change juampynr/latest
with that in each place in your CircleCI config.yml.
Hope that helps!
Thank you so much for your quick reply. Invalidating CircleCI cache was the tip that I needed. It fixed our issues and tests are now running. :D
You're welcome!