Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Gábor Hojtsy’s picture

Issue tags: +D8MI, +language-ui

Yes! Should make run tests much faster hopefully.

penyaskito’s picture

Status: Active » Needs review
FileSize
794 bytes

Something like this?

Sutharsan’s picture

I expected this patch to fail. If disabled by default, the translation import/update test require this setting to be enabled explicitly. Since this test is passed, I doubt that it effectively disables the the translation download.

Gábor Hojtsy’s picture

Status: Needs review » Needs work

Unit tests would not even enable modules, right? Should be in webtestbase AFAIS.

Berdir’s picture

I think the best place for this would be in the testing profile config folder (overriding the config provided by locale... might not yet but should work) or testing_install().

jair’s picture

Issue tags: +Needs reroll

Needs reroll

Berdir’s picture

Title: Disable import_enabled when running tests. » Disable import_enabled when running tests
Category: task » bug
Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
677 bytes

Changing this to a bug, might even be major.

Tests that enable languages through the UI are considerably faster like this. And we have tons of those, getting 44 matches for "$this->drupalPost('admin/config/regional/language/add'".

Locally, this gets the TwigTransTest from 3m22 to ~1min. Probably not such a big difference on the bot, hard to tell.

Copied the locale settings directory into the testing profile. Could also live in testing_install() but that wouldn't be as fancy ;) Downside of this is that we have to duplicate the whole file.

Gábor Hojtsy’s picture

Tests could also use global overrides from $conf?

Berdir’s picture

Not really, we would have to write that into a test settings file so that it can be loaded on page requests. We do support and use that for some settings() tests, but doing it all the time when we can just change the configuration is IMHO backwards :) I'd rather add it to testing_install().

Gábor Hojtsy’s picture

Ok, maybe do that then? I think keeping a full config file like in #7 in sync sounds like can be problematic.

Status: Needs review » Needs work
Issue tags: -D8MI, -language-ui

The last submitted patch, import-enabled-testing-2031175-7.patch, failed testing.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.

penyaskito’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
596 bytes

Disabled import_enabled in hook_install in testing profile.
Should fail for the translation update tests.

Berdir’s picture

Status: Needs review » Needs work

Should use \Drupal::config().

Somehow didn't work, because the tests didn't fail.

penyaskito’s picture

Status: Needs work » Needs review
FileSize
592 bytes

As locale installation overrides config in the profile/profile hook_install(), we must do this on hook_modules_installed().

penyaskito’s picture

@Sutharsan: I reviewed the translate tests and AFAICS all of them manipulate the status data, so the variable doesn't really affect them. Probably we are missing test coverage. Please correct me if I am wrong.

This looks really promising. #14 took 39 min 6 sec while #12 took 1 hour 25 min.

penyaskito’s picture

The last submitted patch, 7: import-enabled-testing-2031175-7.patch, failed testing.

The last submitted patch, 7: import-enabled-testing-2031175-7.patch, failed testing.

vijaycs85’s picture

Updating patch with config save().

Status: Needs review » Needs work

The last submitted patch, 19: 2031175-import-disable-19.patch, failed testing.

Berdir’s picture

Hah, yeah, saving helps :) Might be worth to check if the first, easier approach would work too?

I think some changes are being discussed as to who wins in such a scenario, might be worth to check with @alexpott.

Sutharsan’s picture

Status: Needs work » Needs review
FileSize
1.27 KB
858 bytes

Re-enabling the translation import during locale tests.

Sutharsan’s picture

This one is using Berdir's approach in #7 to disable the import in the profile settings.yml file.
[edit] Ignore this code. Bad patches.

The last submitted patch, 22: 2031175-import-disable-22.patch, failed testing.

Sutharsan’s picture

FileSize
1.33 KB
1.35 KB

Oeps, wrong patches.
This one is using Berdir's approach in #7 to disable the import in the profile settings.yml file.

@penyaskito Re. #15: translation.import_enabled only disables import when modules or themes are enabled and when languages are added. Some LocaleUpdate tests do cover these processes, others don't. The ones involved do fail (on my localhost) with #22 and #23 type solutions. But I did not provide a failing patch (yet).

The last submitted patch, 23: 2031175-import-disable-23.patch, failed testing.

Sutharsan’s picture

The failing tests are caused by configuration translations which are affected by the translation.import_enabled configuration too. Not use if that was the desired effect, but we can open an new issue for that.
This patch re-enables the import for these tests.

The last submitted patch, 27: 2031175-import-disable-26.patch, failed testing.

The last submitted patch, 25: 2031175-import-disable-24.patch, failed testing.

Berdir’s picture

Fixing the last test fail, only a single method there is failing.

Did some tests, what I could see is that the difference is ~20s per language that is added. Obviously, it only is like that if locale.module is enabled. Haven't counted how many times 20s we're talking about :)

vijaycs85’s picture

Reviewed this patch. Overall it looks great. Minor update on config file... +1 to RTBC.

Gábor Hojtsy’s picture

Title: Disable import_enabled when running tests » Translation imports take a lot of time in tests even when not needed
Status: Needs review » Reviewed & tested by the community
Issue tags: +D8MI, +language-ui, +testbot, +Simpletest, +sprint

Looks good indeed.

xjm’s picture

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Great catch!

The only concern I have here is this is an awful lot of code +docs to copy/paste/get identical each time this needs to be done. I wonder if we could open up a follow-up to get all of these tests deriving from a base class w/ a helper method on it, or... something like that.

Anyway, this works on its own and makes tests faster, so yay!

Committed and pushed to 8.x.

Gábor Hojtsy’s picture

Issue tags: -sprint

This should help with Drupal 8 velocity in general by allowing faster test feedback :) Thanks all!

Berdir’s picture

The biggest improvement is running those tests yourself, doesn't matter that much if we save 10 or 20 times 20 seconds, distributed across 8 parallel processes, but having to wait 20s less on a test is nice :)

Status: Fixed » Closed (fixed)

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