Follow-up for #3361534: config validation errors in contrib modules should cause deprecation notices, not test failures

Created on 8 August 2023, over 1 year ago
Updated 19 October 2023, about 1 year ago

Problem/Motivation

Due to šŸ“Œ KernelTestBase::$strictConfigSchema = TRUE and BrowserTestBase::$strictConfigSchema = TRUE do not actually strictly validate Fixed in core, some very eager contrib modules may already start seeing test failures like this (reported by @jibran over at #3361534-90: KernelTestBase::$strictConfigSchema = TRUE and BrowserTestBase::$strictConfigSchema = TRUE do not actually strictly validate ā†’ !):

1) Drupal\Tests\dynamic_entity_reference\Kernel\DynamicEntityReferenceTestViewsTest::testDefaultConfig
There should be no errors in configuration 'views.view.test_dynamic_entity_reference_entity_test_mul_view'. Errors:
Schema key 0 failed with: [dependencies.module.0] Module 'entity_test' is not installed.

Failed asserting that Array &0 (
    0 => '[dependencies.module.0] Module 'entity_test' is not installed.'
) is true.

āš ļø That should not happen, because that would imply the introduction of config validation in Drupal 10.2 introduces significant disruption.

Steps to reproduce

  1. cd DRUPAL_PROJECT_ROOT
    cd modules
    git clone https://git.drupalcode.org/project/dynamic_entity_reference.git
    cd dynamic_entity_reference
    git checkout 3.x
    # This is the last commit at the time this issue was opened.
    git reset --hard 15c0f2ebfc69de604927966a1eb291e1fe073a1d
    # Copy the diff at 
                
                  #3361534-90: KernelTestBase::$strictConfigSchema = TRUE and BrowserTestBase::$strictConfigSchema = TRUE do not actually strictly validate ā†’
                , including the trailing blank line.
    pbpaste | git apply -3v
    
  2. Run Drupal\Tests\dynamic_entity_reference\Kernel\DynamicEntityReferenceTestViewsTest
  3. You'll see:
    1) Drupal\Tests\dynamic_entity_reference\Kernel\DynamicEntityReferenceTestViewsTest::testDefaultConfig
    There should be no errors in configuration 'views.view.test_dynamic_entity_reference_entity_test_mul_view'. Errors:
    Schema key 0 failed with: [dependencies.module.0] Module 'entity_test' is not installed.
    
    Failed asserting that Array &0 (
        0 => '[dependencies.module.0] Module 'entity_test' is not installed.'
    ) is true.
    

Proposed resolution

  1. Convert any validation errors in the case of running a contrib test to deprecation notices instead.
  2. Update the existing CR at https://www.drupal.org/node/3364109 ā†’ to show

Expected result after doing this for the steps to reproduce above:

Testing /Users/wim.leers/core/modules/contrib/dynamic_entity_reference/tests/src/Kernel
.                                                                   1 / 1 (100%)

Time: 00:01.713, Memory: 10.00 MB

OK (1 test, 5 assertions)

Remaining self deprecation notices (5)

  1x: The 'views.view.test_dynamic_entity_reference_entity_test_mul_view' configuration contains validation errors. Invalid config is deprecated in drupal:10.2.0 and will be required to be valid in drupal:11.0.0. The following validation errors were found:
		- [dependencies.module.0] Module 'entity_test' is not installed.
    1x in DynamicEntityReferenceTestViewsTest::testDefaultConfig from Drupal\Tests\dynamic_entity_reference\Kernel

  1x: The 'views.view.test_dynamic_entity_reference_entity_test_view' configuration contains validation errors. Invalid config is deprecated in drupal:10.2.0 and will be required to be valid in drupal:11.0.0. The following validation errors were found:
		- [dependencies.module.0] Module 'entity_test' is not installed.
    1x in DynamicEntityReferenceTestViewsTest::testDefaultConfig from Drupal\Tests\dynamic_entity_reference\Kernel

  1x: The 'views.view.test_dynamic_entity_reference_mul_entity_test_mul_view' configuration contains validation errors. Invalid config is deprecated in drupal:10.2.0 and will be required to be valid in drupal:11.0.0. The following validation errors were found:
		- [dependencies.module.0] Module 'entity_test' is not installed.
    1x in DynamicEntityReferenceTestViewsTest::testDefaultConfig from Drupal\Tests\dynamic_entity_reference\Kernel

  1x: The 'views.view.test_dynamic_entity_reference_mul_entity_test_view' configuration contains validation errors. Invalid config is deprecated in drupal:10.2.0 and will be required to be valid in drupal:11.0.0. The following validation errors were found:
		- [dependencies.module.0] Module 'entity_test' is not installed.
    1x in DynamicEntityReferenceTestViewsTest::testDefaultConfig from Drupal\Tests\dynamic_entity_reference\Kernel

  1x: The 'views.view.test_dynamic_entity_reference_entity_test_rev_view' configuration contains validation errors. Invalid config is deprecated in drupal:10.2.0 and will be required to be valid in drupal:11.0.0. The following validation errors were found:
		- [dependencies.module.0] Module 'entity_test' is not installed.
    1x in DynamicEntityReferenceTestViewsTest::testDefaultConfig from Drupal\Tests\dynamic_entity_reference\Kernel

Process finished with exit code 1

Remaining tasks

  1. āœ…
  2. āœ… ā†’ #9 + #10
  3. Once approved or committed by a core committer:
    1. āœ…
    2. āœ…
    3. āœ…

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

See šŸ“Œ KernelTestBase::$strictConfigSchema = TRUE and BrowserTestBase::$strictConfigSchema = TRUE do not actually strictly validate Fixed .

šŸ“Œ Task
Status

Fixed

Version

11.0 šŸ”„

Component
ConfigurationĀ  ā†’

Last updated 3 days ago

Created by

šŸ‡§šŸ‡ŖBelgium wim leers Ghent šŸ‡§šŸ‡ŖšŸ‡ŖšŸ‡ŗ

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

Comments & Activities

Production build 0.71.5 2024