Problem/Motivation

As we found out in #3263618-21: Deprecate HAL module, the tests in core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php trigger a deprecation notice whenever a Core module with config is deprecated.

This happens since in this test all (optional) config for core modules and themes are installed and re-saved to check for differences.
This requires installing/enabling the modules/themes to which those config belong, which in turn triggers the deprecation notice when a module/theme has lifecycle: deprecated in its info.yml file.
Do this by marking the test skipped before the install/enable call.

Steps to reproduce

- Enable a deprecated Core module/theme
- Run the tests in core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
- Curl up in fetal position and sob endlessly.

Proposed resolution

Exclude modules/themes with lifecycle: deprecated in their info.yml file from being installed in Drupal\KernelTests\Config\DefaultConfigTest::assertExtensionConfig().

The down side of this is that config belonging to a deprecated Core module/theme won't be tested for correctness any more.
This is mitigated by the fact that, since it being a Core module/theme, the config belonging to it would be tested on every run until the Core module/theme is marked as deprecated.

The likely-hood of changes on config belonging to an already deprecated module/theme (and thus not being tested any more after this change) seems very unlikely.
#FamousLastWords

Remaining tasks

- MR
- Review
- Commit

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3265546

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Spokje created an issue. See original summary.

spokje’s picture

Marked this as a Major priority, since it will block deprecating Core Modules, which in turn blocks removing Core modules, which (at least to my knowledge) have Priority Major by default.

spokje’s picture

Issue summary: View changes
spokje’s picture

Title: Drupal\KernelTests\Config\DefaultConfigTest throws deprecation notice for deprecated Core modules which have config » Drupal\KernelTests\Config\DefaultConfigTest throws deprecation notice for deprecated Core modules/themes which have config
Issue summary: View changes

This is also valid for Core themes.

catch’s picture

I think this is the right approach. If we really want to keep all the generic test coverage for modules/themes after they're deprecated, I think we'd need to revert the deprecation error when they're enabled - the whole point is to find tests with dependencies, and core has several of these catch-all tests. So better to exclude, and if it comes around to bite us at some point, we can revisit.

spokje’s picture

StatusFileSize
new4.07 KB

Thanks @catch.

Failing test patch to get the party started (and to see if I can get away with _not_ creating Yet Another Test Theme/Module).

spokje’s picture

StatusFileSize
new4.07 KB

*cough*
Failing test patch to get the party started (and to see if I can get away with _not_ creating Yet Another Test Theme/Module).
*cough*

spokje’s picture

StatusFileSize
new3.64 KB

Hmmm, when it fails it pours...

Let's try that (yet) again

spokje’s picture

Status: Active » Needs review
spokje’s picture

Assigned: spokje » Unassigned
quietone’s picture

Status: Needs review » Needs work

Oh and what happens in the extension is obsolete, will a deprecation error also occur?

quietone’s picture

Issue tags: +blocker

Also a blocker

spokje’s picture

Status: Needs work » Needs review

Thanks @quietone for the review.

Made changes/left comments in the MR, resolved all threads, back to NR.

bbrala’s picture

@Spokje you missed #12 I think.

I was gonna just see how it behaves, but my d10 install script is broken today, sorry.

catch’s picture

Oh and what happens in the extension is obsolete, will a deprecation error also occur?

If an extension is obsolete, it can't be installed because we throw an exception. But also an obsolete module can never have any configuration (if it did it wouldn't be obsolete), and this test is only installing modules with configuration, so it should be fine due to that.

bbrala’s picture

Status: Needs review » Reviewed & tested by the community

Looking good! Nice work.

  • catch committed 408f629 on 10.0.x
    Issue #3265546 by Spokje, quietone: Drupal\KernelTests\Config\...

  • catch committed fb93414 on 9.4.x
    Issue #3265546 by Spokje, quietone: Drupal\KernelTests\Config\...
catch’s picture

Version: 10.0.x-dev » 9.4.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 10.0.x and cherry-picked to 9.4.x, thanks!

catch’s picture

Status: Fixed » Closed (fixed)

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