Problem/Motivation

https://www.drupal.org/pift-ci-job/2432195

Scaffold.Drupal\Tests\Composer\Plugin\Scaffold\Functional\ComposerHookTest
✗	
Drupal\Tests\Composer\Plugin\Scaffold\Functional\ComposerHookTest
exception: [Other] Line 0 of sites/default/files/simpletest/phpunit-562.xml:
PHPUnit Test failed to complete; Error: PHPUnit 9.5.20 �[44m#StandWith�[0m�[43mUkraine�[0m

Testing Drupal\Tests\Composer\Plugin\Scaffold\Functional\ComposerHookTest
E.                                                                  2 / 2 (100%)

Time: 00:05.026, Memory: 4.00 MB

There was 1 error:

1) Drupal\Tests\Composer\Plugin\Scaffold\Functional\ComposerHookTest::testComposerHooks
RuntimeException: Exit code: 1

No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
Loading composer repositories with package information
Updating dependencies
Lock file operations: 3 installs, 0 updates, 0 removals
  - Locking drupal/core-composer-scaffold (10.0.x-dev)
  - Locking fixtures/drupal-assets-fixture (dev-main)
  - Locking fixtures/drupal-core-fixture (dev-main)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 3 installs, 0 updates, 0 removals

In PluginManager.php line 769:

  drupal/core-composer-scaffold contains a Composer plugin which is blocked b
  y your allow-plugins config. You may add it to the list if you consider it
  safe.
  You can run "composer config --no-plugins allow-plugins.drupal/core-compose
  r-scaffold [true|false]" to enable it (true) or disable it explicitly and s
  uppress this exception (false)
  See https://getcomposer.org/allow-plugins


install [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-progress] [--no-install] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--] [...]



Steps to reproduce

Update to the latest composer 2 stable release 2.3.10 for example. Run ./vendor/bin/phpunit -v core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ComposerHookTest.php --filter testComposerHooks

Proposed resolution

Fix test and the corresponding fixture. Latest composer versions do not support requiring plugins without allowing or dis-allowing them.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

catch created an issue. See original summary.

catch’s picture

catch’s picture

Spokje’s picture

As it turns out, the PHP 8.1/8.2 containers were updated by the DA.
Which means currently the local composer version is Composer version 2.3.10 2022-07-13 15:48:23.

Looks like this test now fails on the new behaviour introduced in 2.3.9:

Fixed non-interactive behavior of allow-plugins to throw instead of continue with a warning to avoid broken installs (#10920)

https://github.com/composer/composer/releases/tag/2.3.9

Or most probably this one: https://github.com/composer/composer/pull/10920#issuecomment-1175147334

Spokje’s picture

Status: Needs review » Needs work
alexpott’s picture

Yep I think correct thing to do here is to remove the test. It just doesn't work the way we are testing it now. Patch incoming.

alexpott’s picture

We can't and shouldn't really test something that has been deliberately broken by composer.

alexpott’s picture

FWIW the test fails locally once you are on the latest Composer 2 as well.

alexpott’s picture

Title: Add drupal/core-composer-scaffold to allowed plugins » Fix test that tests drupal/core-composer-scaffold when it is not allowed
Issue summary: View changes
FileSize
4.12 KB
1.57 KB

Actually I think we can do a better test - at least more in the spirit of the way composer works now... although you could argue that we're testing composer here...

longwave’s picture

Agree that we are testing composer itself here - as far as I see none of our code even runs in the system under test, given that we disallow the plugin, so there is no benefit to us of having this test.

alexpott’s picture

Re-upping #7 as that's the patch that @longwave is suggesting we use. I'm not sure it matters.

Spokje’s picture

Status: Needs review » Reviewed & tested by the community

Happy to RTBC if TestBot is also happy after a full run.

dww’s picture

Title: Fix test that tests drupal/core-composer-scaffold when it is not allowed » Remove test that tests drupal/core-composer-scaffold when it is not allowed
  1. More accurate title for what’s now happening.
  2. Everything looks and sounds reasonable in here.
  3. I also vote for remove entirely, instead of retesting composer.

If bot is happy, I am, too. 😉

andypost’s picture

+1 to commit it fixes PHP 8.2 too

  • larowlan committed 8bee469 on 10.0.x
    Issue #3298821 by alexpott, catch, Spokje: Remove test that tests drupal...
  • larowlan committed ce0389d on 10.1.x
    Issue #3298821 by alexpott, catch, Spokje: Remove test that tests drupal...
  • larowlan committed d2a938d on 9.4.x
    Issue #3298821 by alexpott, catch, Spokje: Remove test that tests drupal...
  • larowlan committed fbacd04 on 9.5.x
    Issue #3298821 by alexpott, catch, Spokje: Remove test that tests drupal...
larowlan’s picture

Version: 9.5.x-dev » 9.3.x-dev

Committed to 10.1.x and all the way back to 9.4.x

Will ask if we need this in 9.3.x too

  • larowlan committed 8a33bc0 on 9.3.x
    Issue #3298821 by alexpott, catch, Spokje: Remove test that tests drupal...
larowlan’s picture

Status: Reviewed & tested by the community » Fixed

Discussed with @alexpott and he agreed re backport to 9.3.x, so did that too

Status: Fixed » Closed (fixed)

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