Problem/Motivation

LocalePluralFormatTest::testPluralEditDateFormatter() randomly fails with:

fail: [Other] Line 201 of core/modules/locale/src/Tests/LocalePluralFormatTest.php:
'Member for' text is translated.

See https://www.drupal.org/pift-ci-job/85244 (postgres) and https://www.drupal.org/pift-ci-job/80754 (mysql). Interestingly it seems to occur more often on postgres.

Another random fail (postgres only) was recently fixed in the same test in #2615776: LocalePluralFormatTest is failing on Postgres

Opening as critical. While I won't hold up the release on it, if we can resolve the random fail before tagging, I think that's worth doing.

Proposed resolution

Change the user created time as necessary to ensure the random fail cannot occur.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

catch created an issue. See original summary.

catch’s picture

[edit: not awake yet].

catch’s picture

Ignore #2, that's a different test entirely.

alexpott’s picture

Title: LocalePluralFormatTest is failing randomly on postgres » LocalePluralFormatTest::testPluralEditDateFormatter() is failing randomly
Issue summary: View changes

I don't think it is just postgres it just seems to be more often on postgres from some reason - https://www.drupal.org/pift-ci-job/80754

I've run this test 100's of times locally and have not managed to reproduce :(

alexpott’s picture

So the reason why this test fails on Postgres more often then any other DB and has not failed on PHP7 is because it is timing based fail. Postgres is slower atm because the DB server is completely untuned.

>>> \Drupal::service('date.formatter')->formatTimeDiffSince(REQUEST_TIME - 60)
=> "1 minute"
>>> \Drupal::service('date.formatter')->formatTimeDiffSince(REQUEST_TIME - 61)
=> "1 minute 1 second"

So if the last access time a multiple of 60 then the test will fail.

YesCT’s picture

Issue tags: +Random test failure
alexpott’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
2.47 KB

Here's a fix that also improves the test.

Berdir’s picture

+++ b/core/modules/locale/src/Tests/LocalePluralFormatTest.php
@@ -199,9 +210,12 @@ public function testPluralEditDateFormatter() {
+    // that the we're dealing in mutliple seconds and it can't be exactly 1

multiple :)

alexpott’s picture

catch’s picture

Status: Needs review » Reviewed & tested by the community

#9 looks solid, and all green from the bot.

I think we should commit this today (now that 8.0.0 is tagged), to get DrupalCI back to all green again.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.0.x, thanks!

  • catch committed a34dfb2 on 8.0.x
    Issue #2618886 by alexpott: LocalePluralFormatTest::...

  • catch committed a34dfb2 on 8.1.x
    Issue #2618886 by alexpott: LocalePluralFormatTest::...

Status: Fixed » Closed (fixed)

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