Closed (fixed)
Project:
Configuration Update Manager
Version:
8.x-1.x-dev
Component:
Tests
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
3 Aug 2018 at 18:02 UTC
Updated:
4 Sep 2018 at 15:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
nedjoWhile the test results show errors only for
Config_update.Drupal\Tests\config_update_ui\Functional\ConfigUpdateTest, IIRC locally I got a failure for a 2nd test class inconfig_update_ui,ConfigProfileOverridesTest.Comment #3
nedjo#2915414: Omit "_core" key from normalized config entities, which includes the default config hash may be related.
Comment #4
jhodgdonCould be that is the change in Core... I'm not sure though.
The test that is failing is verifying that when we revert a config item, then go to the single export page, we retain the UUID and _core / default_config_hash lines.
The test is failing to see the default_config_hash line.
There could be two reasons for this:
a) When we revert, we aren't getting the default_config_hash item into the config any more for some reason (like maybe it's getting removed during config save?).
b) When Core exports config on the single export page, it is no longer including the _core section.
It seems to me we need to figure out which one is the reason. If it's (b), then we should change our test in that section so that we don't rely on the single export page to test whether the config contains the lines we are looking for. If it's (a), then we need to figure out whether it's a bug or not, and either change the test or fix the bug. So the next step would be, I think, to investigate whether Core is still using default_config_hash at all, and if so, whether it's still being exported on the single export page.
Comment #5
nedjoI started with b). Steps:
Install core 8.7.x with the 'standard' install profile.
Log in, navigate to
/admin/config/development/configuration/single/export, and export "contact.settings" of type "Simple configuration". Result:Implication: b) is not true.
Next looking at a). As a start, what are we doing to revert and what if anything has changed in the core code we're calling?
The test line we're getting this on relates to a config entity rather than simple configuration.
In ConfigReverter::revert() the relevant lines look to be these:
One possible place to look would be the relevant
::updateFromStorageRecord()method.Looking at the most recent changes in what looks to be the relevant file:
$ git log core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.phpOur first test failures seem to be from after that earlier date (July 13, 2018).
Looking to the specific commit and file:
So, there have been changes in the method we're calling--but whether that's related or not remains TBD.
Comment #6
jhodgdonGood detective work! That does indeed look like the change in Core that caused this test failure.
So. For non-entity config, we are specifically in the ConfigReverter::revert() method saving the old value of __core and putting it back after we copy in the new config values:
That comment you referenced says that in contrast, we don't have to do that for entities, because updateFromStorageRecord *used to* not mess with __core. As of the commit above, this function now does mess with __core. So I think we need to just add a few lines to the method so that we save/replace __core just like we are doing for simple config.
Right?
Comment #7
jhodgdonThe other thing we could do is reopen that issue and complain that their commit broke our module, by changing the behavior of a public method. That I think would be valid.
Comment #8
nedjo@jhodgdon That all sounds right, but I'm not following the code well enough to be certain of this part:
The revised code calls
ConfigEntityType::getPropertiesToExport(), and that at least under certain conditions includes '_core' among the listed properties.Comment #9
jhodgdonWell it looks like we need to not assume that this Core function/class we are using will preserve __core, and so we should preserve it ourselves to maintain backwards compatibility, as we are doing for simple config.
Comment #10
nedjoThat sounds right.
Note: I jumped into looking at the code. I haven't yet tested to confirm I can reproduce what I'm assuming is the bug--that when we revert a config entity, we lose the _core property.
Comment #11
jhodgdonI got an email today from the Drupal Core dev team -- maybe you got it too? -- about being an 8.x contrib module maintainer saying to test modules against 8.x and file issues if there are compatibility issues, using particular tags... so I added a tag and comment to #2986901-14: Followup for #2666392: ConfigEntityTypeInterface::getPropertiesToExport no longer returns NULL, throws exception instead, and filed a new Core issue #2993876: Change notice or revert needed for #2986901.
In the meantime, we should probably assume Core isn't going to revert that change and continue with our work-around. Here's a proposed patch, which I haven't tested at all... it might work? Anyway I think we need to do something like this.
Comment #12
jhodgdonThat patch does seem to work. Thoughts?
Comment #13
nedjoYep, thanks for fixing this, good to go. I added a test with core 8.5 and that passed too.
Comment #15
jhodgdonThanks for reviewing! Committed.