Problem/Motivation

Numerous test failures occurred across multiple branches today, mostly with fails like:

#slow.Drupal\BuildTests\Composer\Template\ComposerProjectTemplatesTest
✗	
Drupal\BuildTests\Composer\Template\ComposerProjectTemplatesTest
exception: [Other] Line 0 of sites/default/files/simpletest/phpunit-1.xml:
PHPunit Test failed to complete; Error: PHPUnit 8.5.2 by Sebastian Bergmann and contributors.

Testing Drupal\BuildTests\Composer\Template\ComposerProjectTemplatesTest
.E.                                                                 3 / 3 (100%)

Time: 9.58 minutes, Memory: 14.50 MB

There was 1 error:

1) Drupal\BuildTests\Composer\Template\ComposerProjectTemplatesTest::testTemplateCreateProject with data set "recommended-project" ('drupal/recommended-project', 'composer/Template/RecommendedProject', '/web')
Symfony\Component\Process\Exception\ProcessTimedOutException: The process "COMPOSER_CORE_VERSION=9.0.x-dev composer create-project drupal/recommended-project testproject 9.0.x-dev -s dev -vv --repository /tmp/build_workspace_0cb74fdd1a5642e0cdf9b32245d4a3a15qTmwc/test_repository/packages.json" exceeded the timeout of 300 seconds.

/var/www/html/vendor/symfony/process/Process.php:1253
/var/www/html/vendor/symfony/process/Process.php:417
/var/www/html/vendor/symfony/process/Process.php:238
/var/www/html/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php:326
/var/www/html/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php:131
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:691
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestSuite.php:597
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestSuite.php:597
/var/www/html/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:621
/var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php:200
/var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php:159

ERRORS!
Tests: 3, Assertions: 32, Errors: 1.

Since it mentions a 5-minute (!) timeout, I wondered if the spate of fails was related to an infrastructural issue (on or outside of our internal infra). @Mixologic looked into it and said:

but as to why that test is slow is beyond me. It should be all using local path repos and be very quick.

looks like its inside of they symfony process as the timeout:

Symfony\Component\Process\Exception\ProcessTimedOutException

It could just be that aws suffered some instability around when those were processed.

yeah, Im concerned that the timeouts would happen though. Those tests are /should be not using the internet at all.

Proposed resolution

Determine whether ComposerProjectTemplatesTest relies on an external network connection, and if it does, determine whether we can fix it to not do that.

Remaining tasks

TBD

User interface changes

N/A

API changes

TBD

Data model changes

N/A

Release notes snippet

TBD

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xjm created an issue. See original summary.

longwave’s picture

Confirmed locally with tcpdump that ComposerProjectTemplatesTest generates network traffic to packages.drupal.org and repo.packagist.org even if the Composer cache is primed.

This can be verified by logging the verbose output from the composer create-project command which includes lines such as:

Downloading https://packages.drupal.org/8/packages.json
...
Downloading https://repo.packagist.org/packages.json
...
Downloading http://repo.packagist.org/p/provider-2020-01%24ce39449fd57c453a091a0f0ffc553c9124a692f4056437294d147139ced7c88c.json
...
Downloading http://repo.packagist.org/p/provider-latest%24c8540af638cfb9912bea2e19b3e1d8dfec3045d87c336993a863000e1dddcbc9.json

If the Composer cache is wiped before starting the test, then the full set of package metadata and the packages themselves are all downloaded.

alexpott’s picture

This is being caused by the version constraints in composer/Template/RecommendedProject/composer.json which are:

    "require": {
        "composer/installers": "^1.2",
        "drupal/core-composer-scaffold": "^8.8",
        "drupal/core-project-message": "^8.8",
        "drupal/core-recommended": "^8.8"
    },

There's now 8.9.x-dev available so composer tries to install that.

Here's the actual error output and not the binary string reported in the error logs:

Cannot create cache directory /Users/alex/.composer/cache/repo/https---packages.drupal.org-8/, or directory is not writable. Proceeding without cache
Cannot create cache directory /Users/alex/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /Users/alex/.composer/cache/files/, or directory is not writable. Proceeding without cache
Cannot create cache directory /Users/alex/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /Users/alex/.composer/cache/repo/file----private-tmp-build-workspace-a5cb41153afafa010fad0ecbee7273a7r7DT30-test-repository-packages.json/, or directory is not writable. Proceeding without cache
Installing drupal/recommended-project (8.8.x-dev)
Cannot create cache directory /Users/alex/.composer/cache/files/, or directory is not writable. Proceeding without cache
  - Installing drupal/recommended-project (8.8.x-dev): Symlinking from composer/Template/RecommendedProject
Created project in testproject
Cannot create cache directory /Users/alex/.composer/cache/repo/https---packages.drupal.org-8/, or directory is not writable. Proceeding without cache
Cannot create cache directory /Users/alex/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /Users/alex/.composer/cache/files/, or directory is not writable. Proceeding without cache
Cannot create cache directory /Users/alex/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
Loading composer repositories with package information
Updating dependencies (including require-dev)
Dependency resolution completed in 1.029 seconds
Analyzed 17956 packages to resolve dependencies
Analyzed 1569972 rules to resolve dependencies
Dependency resolution completed in 0.000 seconds
Package operations: 112 installs, 0 updates, 0 removals
Installs: composer/installers:v1.9.0, drupal/core-composer-scaffold:8.8.x-dev, drupal/core-project-message:8.8.x-dev, typo3/phar-stream-wrapper:v3.1.4, symfony/polyfill-ctype:v1.15.0, twig/twig:v1.42.5, symfony/yaml:v3.4.40, psr/container:1.0.0, symfony/polyfill-mbstring:v1.15.0, symfony/translation:v3.4.40, symfony/validator:v3.4.40, symfony/serializer:v3.4.40, symfony/routing:v3.4.40, symfony/process:v3.4.40, symfony/polyfill-util:v1.15.0, symfony/polyfill-php72:v1.15.0, paragonie/random_compat:v9.99.99, symfony/polyfill-php70:v1.15.0, symfony/polyfill-php56:v1.15.0, symfony/polyfill-intl-idn:v1.15.0, symfony/polyfill-iconv:v1.15.0, psr/log:1.1.3, symfony/debug:v3.4.40, symfony/http-foundation:v3.4.40, symfony/event-dispatcher:v3.4.40, symfony/http-kernel:v3.4.40, symfony/dependency-injection:v3.4.40, symfony/console:v3.4.40, symfony/class-loader:v3.4.40, pear/pear_exception:v1.0.1, pear/console_getopt:v1.4.3, pear/pear-core-minimal:v1.10.10, laminas/laminas-zendframework-bridge:1.0.3, laminas/laminas-stdlib:3.2.1, laminas/laminas-escaper:2.6.1, laminas/laminas-feed:2.12.2, psr/http-message:1.0.1, laminas/laminas-diactoros:1.8.7p2, ralouphie/getallheaders:3.0.3, guzzlehttp/psr7:1.6.1, guzzlehttp/promises:v1.3.1, guzzlehttp/guzzle:6.5.3, doctrine/lexer:1.0.2, egulias/email-validator:2.1.17, composer/semver:1.5.1, asm89/stack-cors:1.3.0, pear/archive_tar:1.4.9, symfony/psr-http-message-bridge:v1.1.2, symfony-cmf/routing:1.4.1, stack/builder:v1.0.5, masterminds/html5:2.3.0, easyrdf/easyrdf:0.9.1, doctrine/inflector:v1.2.0, doctrine/annotations:v1.4.0, doctrine/collections:v1.4.0, doctrine/cache:v1.6.2, doctrine/common:v2.7.3, drupal/core:8.9.x-dev 27acf07, drupal/core-recommended:8.9.x-dev 970e22e, symfony/phpunit-bridge:v3.4.39, symfony/lock:v3.4.40, symfony/finder:v3.4.40, symfony/filesystem:v3.4.40, symfony/css-selector:v3.4.40, symfony/dom-crawler:v4.2.12, symfony/browser-kit:v3.4.40, sebastian/version:2.0.1, sebastian/resource-operations:2.0.1, sebastian/recursion-context:3.0.0, sebastian/object-reflector:1.1.1, sebastian/object-enumerator:3.0.3, sebastian/global-state:2.0.0, sebastian/exporter:3.1.2, sebastian/environment:4.2.3, sebastian/diff:3.0.2, sebastian/comparator:3.0.2, phpunit/php-timer:2.1.2, phpunit/php-text-template:1.2.1, phpunit/php-file-iterator:2.0.2, theseer/tokenizer:1.1.3, sebastian/code-unit-reverse-lookup:1.0.1, phpunit/php-token-stream:3.1.1, phpunit/php-code-coverage:6.1.4, doctrine/instantiator:1.3.0, webmozart/assert:1.8.0, phpdocumentor/reflection-common:2.1.0, phpdocumentor/type-resolver:1.1.0, phpdocumentor/reflection-docblock:5.1.0, phpspec/prophecy:v1.10.3, phar-io/version:2.0.1, phar-io/manifest:1.0.3, myclabs/deep-copy:1.9.5, phpunit/phpunit:7.5.20, mikey179/vfsstream:v1.6.8, justinrainbow/json-schema:5.2.9, jcalderonzumba/gastonjs:v1.2.0, behat/mink:v1.8.0, jcalderonzumba/mink-phantomjs-driver:v0.3.3, squizlabs/php_codesniffer:3.5.5, drupal/coder:8.3.8, seld/phar-utils:1.1.0, seld/jsonlint:1.8.0, composer/xdebug-handler:1.4.1, composer/spdx-licenses:1.5.3, composer/ca-bundle:1.2.7, composer/composer:1.10.6, instaclick/php-webdriver:1.4.7, behat/mink-selenium2-driver:v1.4.0, fabpot/goutte:v3.2.3, behat/mink-browserkit-driver:v1.3.4, behat/mink-goutte-driver:v1.2.1, drupal/core-dev:8.8.x-dev
  - Installing composer/installers (v1.9.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing drupal/core-composer-scaffold (8.8.x-dev): Symlinking from /private/tmp/build_workspace_a5cb41153afafa010fad0ecbee7273a7r7DT30/composer/Plugin/Scaffold
  - Installing drupal/core-project-message (8.8.x-dev): Symlinking from /private/tmp/build_workspace_a5cb41153afafa010fad0ecbee7273a7r7DT30/composer/Plugin/ProjectMessage
  - Installing typo3/phar-stream-wrapper (v3.1.4): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/polyfill-ctype (v1.15.0): Downloading (connecting...)Downloading (0%)           Downloading (85%)Downloading (100%)
 Extracting archive  - Installing twig/twig (v1.42.5): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/yaml (v3.4.40): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing psr/container (1.0.0): Downloading (connecting...)Downloading (0%)           Downloading (75%)Downloading (100%)
 Extracting archive  - Installing symfony/polyfill-mbstring (v1.15.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/translation (v3.4.40): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/validator (v3.4.40): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/serializer (v3.4.40): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/routing (v3.4.40): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/process (v3.4.40): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/polyfill-util (v1.15.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/polyfill-php72 (v1.15.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing paragonie/random_compat (v9.99.99): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/polyfill-php70 (v1.15.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/polyfill-php56 (v1.15.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/polyfill-intl-idn (v1.15.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/polyfill-iconv (v1.15.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing psr/log (1.1.3): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/debug (v3.4.40): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/http-foundation (v3.4.40): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/event-dispatcher (v3.4.40): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/http-kernel (v3.4.40): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/dependency-injection (v3.4.40): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/console (v3.4.40): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/class-loader (v3.4.40): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing pear/pear_exception (v1.0.1): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing pear/console_getopt (v1.4.3): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing pear/pear-core-minimal (v1.10.10): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing laminas/laminas-zendframework-bridge (1.0.3): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing laminas/laminas-stdlib (3.2.1): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing laminas/laminas-escaper (2.6.1): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing laminas/laminas-feed (2.12.2): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing psr/http-message (1.0.1): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing laminas/laminas-diactoros (1.8.7p2): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing ralouphie/getallheaders (3.0.3): Downloading (connecting...)Downloading (0%)           Downloading (80%)Downloading (100%)
 Extracting archive  - Installing guzzlehttp/psr7 (1.6.1): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing guzzlehttp/promises (v1.3.1): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing guzzlehttp/guzzle (6.5.3): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing doctrine/lexer (1.0.2): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing egulias/email-validator (2.1.17): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing composer/semver (1.5.1): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing asm89/stack-cors (1.3.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing pear/archive_tar (1.4.9): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/psr-http-message-bridge (v1.1.2): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony-cmf/routing (1.4.1): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing stack/builder (v1.0.5): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing masterminds/html5 (2.3.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing easyrdf/easyrdf (0.9.1): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing doctrine/inflector (v1.2.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing doctrine/annotations (v1.4.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing doctrine/collections (v1.4.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing doctrine/cache (v1.6.2): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing doctrine/common (v2.7.3): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing drupal/core (8.9.x-dev 27acf07): Failed to update https://github.com/drupal/core.git in cache, package installation for drupal/core might fail.
Cloning 27acf0781233bb08c6d6ada1320e5ca0b738b84e from cache
    27acf0781233bb08c6d6ada1320e5ca0b738b84e is gone (history was rewritten?)
    Failed to download drupal/core from source: Failed to execute git checkout '27acf0781233bb08c6d6ada1320e5ca0b738b84e' -- && git reset --hard '27acf0781233bb08c6d6ada1320e5ca0b738b84e' --

fatal: reference is not a tree: 27acf0781233bb08c6d6ada1320e5ca0b738b84e

    Now trying to download from dist
  - Installing drupal/core (8.9.x-dev 27acf07): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing drupal/core-recommended (8.9.x-dev 970e22e)
  - Installing symfony/phpunit-bridge (v3.4.39): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/lock (v3.4.40): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/finder (v3.4.40): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/filesystem (v3.4.40): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/css-selector (v3.4.40): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/dom-crawler (v4.2.12): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing symfony/browser-kit (v3.4.40): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing sebastian/version (2.0.1): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing sebastian/resource-operations (2.0.1): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing sebastian/recursion-context (3.0.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing sebastian/object-reflector (1.1.1): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing sebastian/object-enumerator (3.0.3): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing sebastian/global-state (2.0.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing sebastian/exporter (3.1.2): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing sebastian/environment (4.2.3): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing sebastian/diff (3.0.2): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing sebastian/comparator (3.0.2): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing phpunit/php-timer (2.1.2): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing phpunit/php-text-template (1.2.1): Downloading (connecting...)Downloading (0%)           Downloading (35%)Downloading (85%)Downloading (100%)
 Extracting archive  - Installing phpunit/php-file-iterator (2.0.2): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing theseer/tokenizer (1.1.3): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing sebastian/code-unit-reverse-lookup (1.0.1): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing phpunit/php-token-stream (3.1.1): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing phpunit/php-code-coverage (6.1.4): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing doctrine/instantiator (1.3.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing webmozart/assert (1.8.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing phpdocumentor/reflection-common (2.1.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing phpdocumentor/type-resolver (1.1.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing phpdocumentor/reflection-docblock (5.1.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing phpspec/prophecy (v1.10.3): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing phar-io/version (2.0.1): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing phar-io/manifest (1.0.3): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing myclabs/deep-copy (1.9.5): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing phpunit/phpunit (7.5.20): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing mikey179/vfsstream (v1.6.8): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing justinrainbow/json-schema (5.2.9): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing jcalderonzumba/gastonjs (v1.2.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing behat/mink (v1.8.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing jcalderonzumba/mink-phantomjs-driver (v0.3.3): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing squizlabs/php_codesniffer (3.5.5): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing drupal/coder (8.3.8): Cloning e53e75b45842a5d2b454b08c318a17f57339e60e from cache
  - Installing seld/phar-utils (1.1.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing seld/jsonlint (1.8.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing composer/xdebug-handler (1.4.1): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing composer/spdx-licenses (1.5.3): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing composer/ca-bundle (1.2.7): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing composer/composer (1.10.6): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing instaclick/php-webdriver (1.4.7): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing behat/mink-selenium2-driver (v1.4.0): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing fabpot/goutte (v3.2.3): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing behat/mink-browserkit-driver (v1.3.4): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing behat/mink-goutte-driver (v1.2.1): Downloading (connecting...)Downloading (100%)         
 Extracting archive  - Installing drupal/core-dev (8.8.x-dev)
symfony/translation suggests installing symfony/config
symfony/validator suggests installing psr/cache-implementation (For using the metadata cache.)
symfony/validator suggests installing symfony/intl
symfony/validator suggests installing symfony/config
symfony/validator suggests installing symfony/property-access (For accessing properties within comparison constraints)
symfony/validator suggests installing symfony/expression-language (For using the Expression validator)
symfony/serializer suggests installing psr/cache-implementation (For using the metadata cache.)
symfony/serializer suggests installing symfony/property-info (To deserialize relations.)
symfony/serializer suggests installing symfony/config (For using the XML mapping loader.)
symfony/serializer suggests installing symfony/property-access (For using the ObjectNormalizer.)
symfony/routing suggests installing symfony/config (For using the all-in-one router or any loader)
symfony/routing suggests installing symfony/expression-language (For using expression matching)
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
symfony/http-kernel suggests installing symfony/config
symfony/http-kernel suggests installing symfony/var-dumper
symfony/dependency-injection suggests installing symfony/config
symfony/dependency-injection suggests installing symfony/expression-language (For using expressions in service container configuration)
symfony/dependency-injection suggests installing symfony/proxy-manager-bridge (Generate service proxies to lazy load them)
symfony/class-loader suggests installing symfony/polyfill-apcu (For using ApcClassLoader on HHVM)
laminas/laminas-feed suggests installing laminas/laminas-cache (Laminas\Cache component, for optionally caching feeds between requests)
laminas/laminas-feed suggests installing laminas/laminas-db (Laminas\Db component, for use with PubSubHubbub)
laminas/laminas-feed suggests installing laminas/laminas-http (Laminas\Http for PubSubHubbub, and optionally for use with Laminas\Feed\Reader)
laminas/laminas-feed suggests installing laminas/laminas-servicemanager (Laminas\ServiceManager component, for easily extending ExtensionManager implementations)
laminas/laminas-feed suggests installing laminas/laminas-validator (Laminas\Validator component, for validating email addresses used in Atom feeds and entries when using the Writer subcomponent)
guzzlehttp/psr7 suggests installing zendframework/zend-httphandlerrunner (Emit PSR-7 responses)
pear/archive_tar suggests installing ext-xz (Lzma2 compression support.)
symfony/psr-http-message-bridge suggests installing nyholm/psr7 (For a super lightweight PSR-7/17 implementation)
easyrdf/easyrdf suggests installing ml/json-ld (~1.0)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/php-code-coverage suggests installing ext-xdebug (^2.6.0)
phpunit/phpunit suggests installing phpunit/php-invoker (^2.0)
phpunit/phpunit suggests installing ext-xdebug (*)
behat/mink suggests installing dmore/chrome-mink-driver (fast and JS-enabled driver for any app (requires chromium or google chrome))
behat/mink suggests installing behat/mink-zombie-driver (fast and JS-enabled headless driver for any app (requires node.js))
Writing lock file
Generating autoload files

alexpott’s picture

Issue tags: -Random test failure

The test failure is no longer random - https://www.drupal.org/pift-ci-job/1677969

greg.1.anderson’s picture

I encountered the binary string problem in #3134606: [backport] PHP Fatal error in 8.9.x / 9.0.x upgrade path. I started getting correct results again when I switched to using PHP's native exec function instead of symfony/process.

alexpott’s picture

The binary string thing happens because PHPUnit incorrectly determines the thing to be a binary string. It's not but there are characters in the string that makes it think it is a binary string. It's not actually part of the problem - it just adds a layer of obfuscation to the problem.

greg.1.anderson’s picture

#6: Yes, exactly. By "correct results" I mean that my failing tests were failing with readable messages instead of unreadable (but transliterable) hexadecimal sequences. This is something else that only recently started happening.

greg.1.anderson’s picture

I remember working on this test a while back. I discovered that if the dependencies of the template project were also added to the packages.json file, that the entire composer create-project could run without Packagist.

I don't remember what I was working on at the time. My test might be in an unfinished patch, or it might just be lost.

greg.1.anderson’s picture

The issue here is that even though the Drupal projects in our repo are loaded via a path repo rather than going through Packagist, we still hit Packagist for all of our dependencies of dependencies.

Here's a failing patch that demonstrates the problem by disabling Packagist for the test. Any package that we can't get locally will fail to be found, so this build fails due to unresolvable dependencies. I've also made an attempt here to define packages for all of our dependencies. I briefly had this working in ad-hoc testing locally, but the version in code didn't work, and now I can't reproduce my earlier ad-hoc results. I'll continue to try different permutations to see which ways Composer will let us define local packages.

greg.1.anderson’s picture

So I did notice that path should be $path = "$root/vendor/$name";, but fixing that didn't help Composer find the vendor projects. Perhaps putting the vendor projects directly in a "package" repository in the template project will work better.

xjm’s picture

Status: Active » Needs work

Once we have a test it's NW. :) Also queued it to expose the fail.

xjm’s picture

Issue tags: +Random test failure

It's back to being random, at least for HEAD.

greg.1.anderson’s picture

@mglaman got local package repositories working: https://twitter.com/nmdmatt/status/1260760241135853570

alexpott’s picture

This test and it's reliance on the internet causes problems for releases.

If I change the \Druapal::VERSION locally to 8.6.6 it fails locally for me. It looks like the symlinking thing doesn’t happen. The output contains Extracting archive - Installing drupal/core-dev (8.8.6)\n but the test expects it do have : Symlinking from PATH/TO/DIRECTORY appended. I don’t know why this is different from when you run the test with 8.6.6-dev as the version. But when my version is 8.6.6-dev the output is Extracting archive - Installing drupal/core (8.8.x-dev): Symlinking from /private/tmp/build_workspace_223b32aed9d1a85d8232daac9f6100853PxoqE/core.

I suspect this is because packagist & the repo know nothing about the 8.6.6 tag. But who knows?

Changing the \Drupal:VERSION to 8.6.7-dev and the test passes again.

greg.1.anderson’s picture

I got the internet-free version of this working yesterday; I just need to clean it up and make a patch.

greg.1.anderson’s picture

EDIT: This comment is all madness and rambling. Please jump ahead to #19.

Here's a new patch that (a) doesn't use Packagist or other internet resources AND (b) passed BUT the test modifies files in the source tree when it runs.

Once I got this green I spent some time last night moving the fixtures around in the hopes that I could make it modify the test fixtures rather than the original source AND still work, but the Composer path repositories setup in this test are a fragile house of cards. It's kind of difficult to modify the configuration, because in some instances, Composer will only allow relative paths, but when I tried to consistently use a "package" repository (where absolute paths are allowed), I ran into the other Composer limitation where you run into trouble if you define more than twenty or so path repositories (yep, if there are too many path repositories, Composer stops working). Relative paths are tricky, because it's not always clear what they are supposed to be relative to, and so sometimes making minor adjustments that seem equivalent end up breaking everything.

Hopefully this testbot will come back with passing tests, like my local runs did. Once we have a baseline here that works, we can make incremental changes until we have something that works and that we can live with.

greg.1.anderson’s picture

Status: Needs work » Needs review
greg.1.anderson’s picture

The testbot won't allow our bad practices, and gives us a "permission denied" when we try to alter the sources we are testing. The modification of the template projects themselves shouldn't be too hard to fix; however, there is a more difficult problem. This patch avoids using Packagist in tests by creating a local "Composer"-type package repository from all of the packages in the vendor directory. Vendor is used in-place to avoid copying it. It seems that "Composer"-type package repositories only work with relative paths. I tried using a "Packages"-type package repository, but as I mentioned in #16, this ran up against the limit on how many path repositories Composer will allow you to use. (Apparently, "Composer"-type packages only count as one, but "Package"-type repositories count as one per package.) We can probably get around this by copying the vendor directory to another location, but I was hoping to avoid doing that. I also considered symlinking vendor, but avoided that idea to avoid problems when running the tests on Windows.

greg.1.anderson’s picture

OK Let's just ignore #16, I was too tired when I was working on this last night. Here's a cleaned-up version with an interdiff with #9.

We avoid using Packagist while running this test by building a package repository for everything in the vendor directory.

greg.1.anderson’s picture

Code style and a little cleanup / simplification.

alexpott’s picture

I can confirm that #20 works when there's no access to the internet. Nice.

Also if \Drupal:VERSION is something like 9.1.1 and composer/Metapackage/CoreRecommended/composer.json and composer/Metapackage/PinnedDevDependencies/composer.json have been updated too then the test is passing. Double nice!

  1. +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
    @@ -107,15 +107,32 @@ public function testVerifyTemplateTestProviderIsAccurate() {
    -      $this->markTestSkipped('We cannot run the template create project test with Composer 2 until we have a stable version of composer/semver 2.x. The create project test installs drupal/core-recommended and the Drupal Composer plugins from Packagist, so these must also be compatible with Composer 2.x in order for this test to work.');
    +      $this->markTestSkipped("This test is pretty close to being usable with Composer 2, but exhibits some failures with the vendor packages. We won't worry about this for now.");
    

    "We won't worry about this for now" should be an @todo pointing to an issue.

  2. +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
    @@ -107,15 +107,32 @@ public function testVerifyTemplateTestProviderIsAccurate() {
    +    // Make a working COMPOSER_HOME directory for setting global composer config
    +    $composerHome = $this->getWorkspaceDirectory() . '/composer-home';
    +    mkdir($composerHome);
    +
    +    // Disable packagist
    +    $this->executeCommand("COMPOSER_HOME=$composerHome composer config -n -g repo.packagist false");
    

    Given that we're futzing with the repositories of the composer.json under test isn't doing an override just for that composer.json okay - i.e. https://getcomposer.org/doc/05-repositories.md#disabling-packagist-org

    Or does this not work because we're doing composer create-project. And if this is the case we should probably document that.

  3. +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
    @@ -107,15 +107,32 @@ public function testVerifyTemplateTestProviderIsAccurate() {
    +    // Remove the packages.drupal.org entry from the SUT's repositories section.
    +    $this->executeCommand("composer config -n --unset 'repositories.0'", $package_dir);
    

    Should we unset all repositories here. In the unlikely case that we add another one to our templates this would make it less likely that the test would become internet dependent again.

  4. +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
    @@ -123,17 +140,19 @@ public function testTemplateCreateProject($project, $package_dir, $docroot_dir)
    -      $this->executeCommand('composer config repositories.' . $name . ' path ' . $path, $package_dir);
    +      $this->executeCommand("composer config -n repositories.$name path $path", $package_dir);
    

    So the only real change here is the -n for no interaction. If this is necessary can we use --no-interaction. It helps to have to think less what everything means.

  5. +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
    @@ -123,17 +140,19 @@ public function testTemplateCreateProject($project, $package_dir, $docroot_dir)
    +    $this->executeCommand("composer config -n repositories.local composer file://" . $vendor_packages_path, $package_dir);
    

    As above for the -n

  6. +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
    @@ -214,4 +234,41 @@ protected function makeTestPackage($repository_path, $version) {
    +    $packages = [];
    +    $installed = json_decode(file_get_contents($root . "/vendor/composer/installed.json"), TRUE);
    +    foreach ($installed as $package) {
    

    Build an array called $packages from an array called $package does not make for the most readable code. How about $installed as $project

  7. +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
    @@ -214,4 +234,41 @@ protected function makeTestPackage($repository_path, $version) {
    +    $installed = json_decode(file_get_contents($root . "/vendor/composer/installed.json"), TRUE);
    

    Is there any reason you preferred this over the root composer.lock file. It's interesting to ponder which format is less likely to change here. I wonder if we should use the composer command composer show --installed --format=json here instead. As that's probably a more guaranteed API - rather than relying on Composer keeping it's file formats the same.

  8. +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
    @@ -214,4 +234,41 @@ protected function makeTestPackage($repository_path, $version) {
    +      $fullPath = "$root/$path";
    

    $full_path

  9. +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
    @@ -214,4 +234,41 @@ protected function makeTestPackage($repository_path, $version) {
    +      $projectVersion = $package['version'];
    

    $project_version or $version

  10. +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
    @@ -214,4 +234,41 @@ protected function makeTestPackage($repository_path, $version) {
    +      if (is_dir($fullPath)) {
    

    The is_dir() is interesting here - when is that not true - I guess this excludes drupal/core :) - perhaps worth a commment.

longwave’s picture

Status: Needs review » Needs work

Nice work!

NW for #21 and the below

  1. +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
    @@ -107,15 +107,32 @@ public function testVerifyTemplateTestProviderIsAccurate() {
    +    $composerHome = $this->getWorkspaceDirectory() . '/composer-home';
    ...
    +    $this->executeCommand("COMPOSER_HOME=$composerHome composer config -n -g repo.packagist false");
    

    $composerHome -> $composer_home

  2. +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
    @@ -107,15 +107,32 @@ public function testVerifyTemplateTestProviderIsAccurate() {
    +    $this->executeCommand("COMPOSER_HOME=$composerHome composer config -n -g repo.packagist false");
    

    Do we need

    $this->assertCommandSuccessful();
    

    here?

  3. +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
    @@ -123,17 +140,19 @@ public function testTemplateCreateProject($project, $package_dir, $docroot_dir)
    +    $this->executeCommand("composer config -n repositories.local composer file://" . $vendor_packages_path, $package_dir);
    

    Do we need

    $this->assertCommandSuccessful();
    

    here?

  4. +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
    @@ -141,7 +160,8 @@ public function testTemplateCreateProject($project, $package_dir, $docroot_dir)
    +    // plugin, so its existance assures us that scaffolding hapened.
    

    existance -> existence
    hapened -> happened

greg.1.anderson’s picture

Thanks for the reviews. This was Harder Than Your Average Patch thanks to Composer oddities.

#21:

1. Added a TODO with a reference to #3128631: Update dependencies composer/composer ^2 and composer/semver to ^3

2. Yes, this is needed for create-project. Added a comment.

3. It's not possible to do this with`composer config --unset`, so I changed the code to read in and rewrite composer.json instead.

4 & 5. Spelled out --no-interaction and --global options.

6 & 8 - 9. Fixed code style.

7. I was reading installed.json to get the project type; however, it turned out that including the project type in the package repository was not only unnecessary, but also harmful. Since I don't need the type any longer, I switched to using `composer info --format=json`, which includes the information needed to build the repository structure.

10. We are building a set of packages with path repositories pointing to things in vendor, so it naturally makes sense to check to see if the project exists in vendor before pointing at a directory that does not exist.

#22:

1. Fixed variable code style (and $composer_version_line too)

2 & 3. Added failure checks for prudence.

4. Fixed spelling

greg.1.anderson’s picture

Status: Needs work » Needs review
longwave’s picture

Status: Needs review » Needs work

Only some real nitpicks left as far as I can see:

  1. +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
    @@ -105,17 +105,44 @@ public function testVerifyTemplateTestProviderIsAccurate() {
    +      // TODO: See https://www.drupal.org/project/drupal/issues/3128631
    

    This should follow coding standards, ie. something like

    // @todo Remove in https://www.drupal.org/project/drupal/issues/3128631
    
  2. +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
    @@ -105,17 +105,44 @@ public function testVerifyTemplateTestProviderIsAccurate() {
    +    $this->executeCommand("COMPOSER_HOME=$composer_home composer config --no-interaction --global repo.packagist false");
    

    Out of scope, but I wonder if all the Composer tests should just set the COMPOSER_NO_INTERACTION environment variable and then we don't have to remember to sprinkle --no-interaction everywhere.

  3. +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
    @@ -105,17 +105,44 @@ public function testVerifyTemplateTestProviderIsAccurate() {
    +    // `composer config --unset`, so we're read and rewrite composer.json.
    

    we're -> we

  4. +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
    @@ -214,4 +245,45 @@ protected function makeTestPackage($repository_path, $version) {
    +              "url" => "$path",
    ...
    +            "version" => "$version",
    

    Unnecessary string interpolation? Took me a few attempts to mentally parse this :)

greg.1.anderson’s picture

Status: Needs work » Needs review
FileSize
6.93 KB
1.85 KB

Addressed #25.

I don't have a strong opinion on using COMPOSER_NO_INTERACTION. I guess it would make for DRY-er tests, but I kind of like being explicit in tests.

longwave’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! All points addressed, over to core committers for another look.

greg.1.anderson’s picture

One last code standards fix (DOH!).

The 9.0.x patch seems to apply to 8.9.x; let's try running it both places.

alexpott’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

Committed and pushed a6eaea1b96 to 9.1.x and e1ab4c0d19 to 9.0.x and 09f6211187 to 8.9.x. Thanks!

We need to backport this to 8.8.x too because at the moment without this fix the commit with the release version will fail tests.

  • alexpott committed a6eaea1 on 9.1.x
    Issue #3123933 by greg.1.anderson, alexpott, longwave, xjm: Determine...

  • alexpott committed e1ab4c0 on 9.0.x
    Issue #3123933 by greg.1.anderson, alexpott, longwave, xjm: Determine...

  • alexpott committed 09f6211 on 8.9.x
    Issue #3123933 by greg.1.anderson, alexpott, longwave, xjm: Determine...
alexpott’s picture

Issue tags: +Needs reroll
longwave’s picture

Status: Patch (to be ported) » Needs review
Issue tags: -Needs reroll
FileSize
6.18 KB

Rerolled, but this failed locally, and I don't have time to fix it now. Looks like makeVendorPackage() needs to take -dev releases into account.

[RuntimeException]
Could not load package behat/mink-selenium2-driver in file:///tmp/build_workspace_0ee39e33a2eeb27e75dc5340ec6269baGuJ3i3/vendor_packages/packages.json: [UnexpectedValueException] Invalid version string "1.3.x-dev 0a09c43"

[UnexpectedValueException]
Invalid version string "1.3.x-dev 0a09c43"

alexpott’s picture

Here's a fix for #34. It's happening because we've not backported #3078671: Pin behat/mink and behat/mink-selenium2-driver to use resolvable release so we have to deal with funky dev versions.

The last submitted patch, 34: 3123933-8.8.x-34.patch, failed testing. View results

alexpott’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
6.18 KB

#3078671: Pin behat/mink and behat/mink-selenium2-driver to use resolvable release got backported. #34 now passes on 8.8.x so re-uploading so it's the last patch.

The last submitted patch, 35: 3123933-35.patch, failed testing. View results

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed a2e22ea and pushed to 8.8.x. Thanks!

@longwave thanks for the quick work on the 8.8.x patch.

  • alexpott committed a2e22ea on 8.8.x
    Issue #3123933 by greg.1.anderson, alexpott, longwave, xjm: Determine...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.