Regression in #3343827: GitExcluderTest should test with composer/installers enabled

Created on 8 March 2023, over 1 year ago
Updated 16 March 2023, over 1 year ago

Problem/Motivation

While reviewing ๐Ÿ“Œ GitExcluder should use ComposerInspector instead of ComposerUtility Fixed , I noticed that \Drupal\Tests\package_manager\Kernel\PathExcluder\GitExcluderTest is not testing all code paths in GitExcluder yet.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ“Œ Task
Status

Fixed

Version

3.0

Component

Package Manager

Created by

๐Ÿ‡ง๐Ÿ‡ชBelgium Wim Leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

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

Comments & Activities

  • Issue created by @Wim Leers
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium Wim Leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    This clearly should fail tests, but it passesโ€ฆ ๐Ÿ˜ฑ

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium Wim Leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ
  • Assigned to kunal.sachdev
  • Status changed to Needs work over 1 year ago
  • @kunalsachdev opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Assigned to kunal.sachdev
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium Wim Leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    The test coverage proves the problem in HEAD โ€ฆ

    โ€ฆ but in reviewing this I realized that the root cause is probably simply a regression caused by ๐Ÿ“Œ Update FixtureManipulator to work with InstalledPackagesList, real composer show command Fixed ๐Ÿ˜…

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium Wim Leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Assigned to kunal.sachdev
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium Wim Leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    The fix in GitExcluder has proper test coverage, because uncommenting it causes the tests to fail:

    Testing /Users/wim.leers/core/modules/contrib/automatic_updates/package_manager/tests/src/Kernel/PathExcluder
    F.                                                                  2 / 2 (100%)
    
    Time: 00:11.157, Memory: 10.00 MB
    
    There was 1 failure:
    
    1) Drupal\Tests\package_manager\Kernel\PathExcluder\GitExcluderTest::testGitDirectoriesExcludedActive
    Failed asserting that an array does not contain 'modules/package_known_to_composer_removed_later/.git'.
    
    /Users/wim.leers/core/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:122
    /Users/wim.leers/core/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:55
    /Users/wim.leers/core/modules/contrib/automatic_updates/package_manager/tests/src/Kernel/PathExcluder/GitExcluderTest.php:67
    /Users/wim.leers/core/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
    
    FAILURES!
    Tests: 2, Assertions: 14, Failures: 1.
    Process finished with exit code 1
    
    

    ๐Ÿ‘

    That leaves only one question on the MR to be addressed!

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Assigned to kunal.sachdev
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium Wim Leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Assigned to kunal.sachdev
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium Wim Leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    This now just needs $allow_plugins=TRUE for the final bit of clean-up ๐Ÿ˜Š๐Ÿ™

  • Assigned to Wim Leers
  • Status changed to Needs review over 1 year ago
  • Assigned to kunal.sachdev
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium Wim Leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    I found the problem. Or actually, two.

    Pre-existing ComposerInstallersTrait bug

    In the test, we only had this:

        "installer-paths": {
          "different_installer_path/package_known_to_composer": ["foo/package_with_different_installer_path_known_to_composer"]
        }
    

    i.e.

          "core": ["type:drupal-core"],
          "libraries/{$name}": ["type:drupal-library"],
          "modules/contrib/{$name}": ["type:drupal-module"],
          "profiles/contrib/{$name}": ["type:drupal-profile"],
          "themes/contrib/{$name}": ["type:drupal-theme"],
          "drush/Commands/contrib/{$name}": ["type:drupal-drush"],
          "modules/custom/{$name}": ["type:drupal-custom-module"],
          "themes/custom/{$name}": ["type:drupal-custom-theme"]
    

    was missing! ๐Ÿ˜ฑ

    Fixed in 10ee1d560d8c7eaa37b656dbad5203ae0004dadd.

    Pre-existing \Drupal\fixture_manipulator\FixtureManipulator::addDotGitFolder() bug

    The above also means that

    ->addDotGitFolder($project_root . "/modules/custom/custom_package_known_to_composer")
    

    and

        $not_excluded_paths = [
    โ€ฆ
          'modules/custom/custom_package_known_to_composer/.git',
    โ€ฆ
        ];
    

    in the MR are only passing tests because addDotGitFolder() is blindly creating a .git folder in a directory that doesn't even exist nor contains a composer.json โ‡’ we need to add basic validation to addDotGitFolder(). Otherwise, @kunal.sachdev would have been alerted about this! ๐Ÿ˜ข

    Fixed in 0688af9937653905da1c19aaeea356bb9952fccb.

    Next

    Now that the test infrastructure makes sense again, I'm certain @kunal.sachdev can finish this one! ๐Ÿ˜Š

  • Assigned to Wim Leers
  • Status changed to Needs review over 1 year ago
  • Issue was unassigned.
  • Status changed to RTBC over 1 year ago
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium Wim Leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    ๐Ÿš€

  • Assigned to phenaproxima
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    Reviewing with an eye to commit.

  • Status changed to Fixed over 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts
  • Issue was unassigned.
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium Wim Leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    Thanks for that very nice simplification right at the end! ๐Ÿ˜Š๐Ÿ‘

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

Production build 0.69.0 2024