Umami content is all created in the same second

Created on 7 November 2023, about 1 year ago
Updated 5 August 2024, 5 months ago

Problem/Motivation

Found working on ๐Ÿ“Œ Allow assertions on the number of database queries run during tests RTBC .

MariaDB [db]> SELECT FROM_UNIXTIME(created) FROM node_field_data;
+------------------------+
| FROM_UNIXTIME(created) |
+------------------------+
| 2023-11-07 21:42:54    |
| 2023-11-07 21:42:54    |
| 2023-11-07 21:42:54    |
| 2023-11-07 21:42:54    |
| 2023-11-07 21:42:54    |
| 2023-11-07 21:42:54    |
| 2023-11-07 21:42:54    |

Views like related recipes are ordering by created timestamp, but because it's the same, this can mean random results.

Steps to reproduce

Proposed resolution

Add a second to each node as it's created, or give them specific, fake, backdated dates.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

๐Ÿ› Bug report
Status

Fixed

Version

11.0 ๐Ÿ”ฅ

Component
Umamiย  โ†’

Last updated about 1 month ago

  • Maintained by
  • ๐Ÿ‡ฎ๐Ÿ‡ชIreland @markconroy
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom @smaz
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom @kjay
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States @shaal
Created by

๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch

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

Merge Requests

Comments & Activities

  • Issue created by @catch
  • ๐Ÿ‡ฎ๐Ÿ‡ชIreland markconroy

    I wonder could we do something like a post install update that will cycle through all the nodes on the site and set them as created a day between each.

    So if we have 30 nodes, then

    • node/30 will be set to have been created yesterday,
    • node/29 will be set to have been created 2 days ago,
    • node 28 will be set to have been created 3 days ago,
    • etc

    ---
    Thanks to Code Enigma for sponsoring my time to work on this.

  • Status changed to Needs review 6 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ชIreland markconroy

    Setting to needs review.

  • Pipeline finished with Failed
    6 months ago
    Total: 163s
    #216568
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch

    I think this is a good idea. We should open a follow-up for the default content import that comes with recipes to add some kind of created date offset key so that this could be done on import.

    Probably also need an issue to convert Umami's default content to the new system.

  • Status changed to Needs work 6 months ago
  • The Needs Review Queue Bot โ†’ tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide โ†’ to find step-by-step guides for working with issues.

  • Status changed to Needs review 6 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ชIreland markconroy

    Thanks @needs-review-queue-bot

    Fixed, and setting back to needs review.

  • Pipeline finished with Failed
    6 months ago
    Total: 2955s
    #216716
  • Status changed to Needs work 5 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    I get confused sometimes and not sure the rule of thumb for tests on Umami, know before we have skipped them as it's main purpose is to be a demo.

    Re-ran the failing test but seems to be valid

        1)
        Drupal\Tests\demo_umami\Functional\UmamiMultilingualInstallTest::testUmami
        Behat\Mink\Exception\ResponseTextException: The text "Quiche mediterrรกneo
        profundo" was not found anywhere in the text of the current page.
        
        /builds/issue/drupal-3399970/vendor/behat/mink/src/WebAssert.php:907
        /builds/issue/drupal-3399970/vendor/behat/mink/src/WebAssert.php:293
        /builds/issue/drupal-3399970/core/tests/Drupal/Tests/WebAssert.php:975
        /builds/issue/drupal-3399970/core/profiles/demo_umami/tests/src/Functional/UmamiMultilingualInstallTest.php:32
        
    
  • Pipeline finished with Failed
    5 months ago
    Total: 569s
    #228872
  • Pipeline finished with Success
    5 months ago
    Total: 469s
    #228898
  • ๐Ÿ‡ฎ๐Ÿ‡ชIreland markconroy

    Thanks @smustgrave, this took me a little bit of time to track down.

    I've added a new commit to change the string that we should search for. This is because since we set the nodes to have different dates on them in the new install hook, the string we were searching for belongs to a node that will not make it to the front page listing.

    The ordering for that view on the homepage is

    Sticky at top of lists => Date added => node id

    With the date added now changed, and the node id for this content item being 1, it no longer makes the grade :)

    All tests are passing now.

    ---
    Thanks to Code Enigma for sponsoring my time to work on this.

  • Status changed to Needs review 5 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ชIreland markconroy
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch

    #9 is exactly the reason I opened this issue in reverse, not on the front page but in some other circumstances, the nodes shown on pages (maybe recommended articles or something) were different each test run..

  • Status changed to RTBC 5 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Thanks seeing all green. And suppose since the test had to be updated that can count as test coverage :)

  • Status changed to Fixed 5 months ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch

    Opened โœจ Add a creation timestamp offset for default content Active against recipes so that if we added that feature, and eventually use recipe default content for Umami, we should be able to remove the install hook again.

    Committed/pushed to 11.x, thanks!

    • catch โ†’ committed fe7c0ff8 on 11.x
      Issue #3399970 by markconroy, catch, smustgrave: Umami content is all...
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024