- Issue created by @borisson_
- First commit to issue fork.
- First commit to issue fork.
- Status changed to Needs review
about 1 year ago 2:58pm 21 October 2023 - last update
about 1 year ago 30,425 pass, 1 fail - last update
about 1 year ago 30,425 pass, 1 fail - π¬π§United Kingdom Eli-T Manchester
This MR introduces a new Constraint that checks that an entity with a given ID and entity type exists. This is probably useful in a number of other places so it would be worth reviewing issues that might need it and linking so we're not duplicating work
- last update
about 1 year ago 30,425 pass, 1 fail - last update
about 1 year ago 30,425 pass, 1 fail - Status changed to Needs work
about 1 year ago 2:12pm 22 October 2023 - π¬π§United Kingdom Eli-T Manchester
The assertion that is currently failing is in ConfigImportAllTest::testInstallUninstall() on line 147
// Check that all modules that were uninstalled are now reinstalled. $this->assertModules(array_keys($modules_to_uninstall), TRUE);
- π¬π§United Kingdom Eli-T Manchester
The test is asserting that a set of modules are enabled, and is failing because block_content is not enabled. However, debugging shows it would fail on other modules - here's a list of the enabled status of all checked modules.
action = true announcements_feed = true automated_cron = true ban = true basic_auth = true big_pipe = true block = true block_content = false book = false breakpoint = false ckeditor5 = false comment = false config_translation = false contact = false content_moderation = false content_translation = false contextual = false datetime = false datetime_range = false dblog = false dynamic_page_cache = true editor = false field = false field_layout = false field_ui = false file = false filter = true forum = false help = true history = false image = false inline_form_errors = true jsonapi = false language = false layout_builder = false layout_discovery = false link = false locale = false media = false media_library = false menu_link_content = false menu_ui = false migrate = false migrate_drupal = false migrate_drupal_ui = false node = false options = false page_cache = true path = false pgsql = true phpass = false responsive_image = false rest = false sdc = false search = false serialization = false settings_tray = false shortcut = false sqlite = true statistics = false syslog = true experimental_module_requirements_test = true experimental_module_test = true system_test = true taxonomy = false telephone = false text = false toolbar = false tour = true update = true views = false views_ui = false workflows = false workspaces = false
- π§πͺBelgium borisson_ Mechelen, π§πͺ
I have tried to figure out what the problem is what that
testInstallUninstall
, I don't understand what the problem is, there is no config errors when installing or when uninstalling, so why some modules don't want to be installed is a mystery to me.
I don't think it is because those modules all depend on filter, because for example workspaces only depends on user. - πͺπΈSpain nireneko
I checked this, and I can't find the problem, but like @borisson_ sais, must be in the config, debugging the core.extensions.yml file has the full list of modules that must be installed, but when the syncronization is executed in the test
ConfigImportAllTest
lines:$this->drupalGet('admin/config/development/configuration'); $this->submitForm([], 'Import all');
Is not installing all the modules.
I tried to debug the syncronization import in
Drupal\config\Form\ConfigSync
, but I can't :(Getting the list of enabled modules before
// Check that all modules that were uninstalled are now reinstalled. $this->assertModules(array_keys($modules_to_uninstall), TRUE);
line, there are 26 installed modules of 74.
Also something strange, in the new validator
EntityExistsConstraintValidator
, adding one "return;" before add the violation (or removing the violation), the test is green and I don't understand why, because in my case, that point never is reached, the 'if' always is 'true'.// If we can load an entity of the given type with the ID in value we pass // the constraint. if ($this->entityTypeManager->getStorage($constraint->entityType)->load($value)) { return; } return; $violation = $this->context ->buildViolation($constraint->message) ->setParameter('@entity_type', $constraint->entityType) ->setParameter('%value', $value); $violation->addViolation();
- π΅πͺPeru marvil07
I could not find the actual problem either.
Said that, hopefully some extra clues follow.Also something strange, in the new validator EntityExistsConstraintValidator, adding one "return;" before add the violation (or removing the violation), the test is green and I don't understand why, because in my case, that point never is reached, the 'if' always is 'true'.
@nireneko, that is expected, a return or the non-creation of a violation means the constraint passes validation.
As stated at previous comments, there are multiple modules not enabled on the configuration import done on the failing test.
Finding the error is a bit tricky, since
ConfigImportAllTest::testInstallUninstall()
is using the configuration synchronization UI, and that uses the batch API.
Inside the Batch API, errors seem to not be relied, or at least not in tests, seeob_\*
calls at https://git.drupalcode.org/project/drupal/-/blob/0bbf07394de4a370c28b904....Trying to figure the problem out, I noticed that if the module installer service is used to enable the modules, they can be enabled.
E.g. adding the following change will make block_content module enabled correctly, and the error will be reported on the next not re-enabled module, book.diff --git a/core/modules/config/tests/src/Functional/ConfigImportAllTest.php b/core/modules/config/tests/src/Functional/ConfigImportAllTest.php index 4d693c6333..7beb8b66ea 100644 --- a/core/modules/config/tests/src/Functional/ConfigImportAllTest.php +++ b/core/modules/config/tests/src/Functional/ConfigImportAllTest.php @@ -139,6 +139,7 @@ public function testInstallUninstall() { $this->submitForm([], 'Import all'); // Modules have been installed that have services. $this->rebuildContainer(); + $this->assertTrue(\Drupal::service('module_installer')->install(['block_content']), 'Manually installing block_content actually installs it.'); // Check that there are no errors. $this->assertSame([], $this->configImporter()->getErrors());
In other words, the code path enabling the modules with the configuration synchronization form on the test is doing something different than the call to
\Drupal::service('module_installer')->install()
.
What exactly, not quite sure.Overall, it may be that the new configuration validation is correctly triggering a problem, but that problem seems to only exist on the testing code path, and not on the normal code path, outside test via phpunit.
- π·π΄Romania claudiu.cristea Arad π·π΄
I find something weird with schema of filters.
This is text format schema (removed some parts for readability):
filter.format.*: type: config_entity mapping: name: type: required_label (...) filters: type: sequence orderby: key sequence: type: filter
Each filter is of type
filter
:filter: type: mapping mapping: id: type: string (...) settings: type: filter_settings.[%parent.id]
Each filter's settings is of type `filter_settings.`, defaulting to `filter_settings.*`
But here comes the weirdness: Each `filter_settings.` is again of type
filter
(except filter_settings.* which correctly goes to a sequence.For instance:
filter_settings.filter_html: type: filter mapping: ...
I think each `filter_settings.` should be of type mapping
Am I missing something?
- π·π΄Romania claudiu.cristea Arad π·π΄
I've opened π Filter settings schema types are incorrect Active for #14
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
#14: you re-discovered π Provide guidance to config schema developers: detect broken config schema types Needs work π
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
Blocked on π Filter settings schema types are incorrect Active .
- Assigned to wim leers
- Status changed to Postponed
11 months ago 10:15am 5 February 2024 - π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
π Filter settings schema types are incorrect Active landed!
- Status changed to Needs work
11 months ago 11:32am 5 February 2024 - Issue was unassigned.
- Status changed to Needs review
11 months ago 5:25pm 5 February 2024 - π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
Lifted some code from β¨ [PP-1] Mark parts of CKEditor 5 and Editor config schema as fully validatable Postponed to expand what the existing
ConfigExists
constraint can do, which is why I associated this change record β with this issue.It also means I was able to remove the new
EntityExists
constraint that @Eli-T proposed. I think that would be an excellent addition, but such a useful general addition is not a hard blocker for this issue. There's now two distinct issues that would benefit from that expansion in capability forConfigExists
, so went ahead with that.What's still missing is test coverage.
\Drupal\Tests\filter\Functional\FilterAdminTest::testFilterAdmin()
does some testing offilter.settings
, so is the closest place we have. - π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
Aha β¦ the reason
Drupal.Tests.config.Functional.ConfigImportAllTest
is not passing tests is actually quite simple:filter.settings
is simple config- β οΈ Only config entities are allowed to have config dependencies
- When
filter.settings
is installed/saved, text format config entities have not yet been installed - Hence
ConfigImportAllTest::testInstallUninstall()
fails.
There is the short-term solution and the long-term one:
Because there is no clear long-term solution either, I think the short-term solution is fine for now.
- Status changed to Needs work
10 months ago 5:23pm 8 February 2024 - πΊπΈUnited States smustgrave
Left a small comment, let me know what you think.
- Status changed to RTBC
10 months ago 1:20pm 9 February 2024 - π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
This flaw in
filter.settings
was introduced in #1799440: Convert Filter variables to Configuration System β .#1932544: Remove all traces of fallback format concept from the (admin) UI β is the long-term solution.
Updated comment π
- Status changed to Fixed
10 months ago 4:18pm 14 February 2024 Automatically closed - issue fixed for 2 weeks with no activity.