Update fixtures for run updates

Created on 29 July 2024, 5 months ago
Updated 30 August 2024, 4 months ago

Problem/Motivation

In file SmartTrimUpdateMoreTest fixture is mapped D10.0.8 which won't run on the next major.
See: https://git.drupalcode.org/issue/smart_trim-3464515/-/jobs/2268117#L463

Proposed resolution

Update the fixtures with latest on i.e 10.3.0

๐Ÿ“Œ Task
Status

Fixed

Version

2.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia ankitv18

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

Merge Requests

Comments & Activities

  • Issue created by @ankitv18
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States markie Albuquerque, NM

    Setting this as a blocker for the 2.2.0 release.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States markie Albuquerque, NM
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States ultimike Florida, USA

    @ankitv18 - I _think_ I understand what you mean, but not entirely 100% sure.

    In walking through all this during DrupalEasy office hours, we understand that it is not possible to upgrade from Drupal core 10.0.* to Drupal 11 (next major), which is why you're suggesting we update the "drupal-10.0.8-smart_trim-2.0.php.gz" test fixture to be based on Drupal core 10.3.x.

    But, Drupal 11 has been the "next major" for quite some time now, so I'm not sure I understand why this is suddenly an issue.

    For example, on April 22, 2024, it was failing - see [here](https://git.drupalcode.org/project/smart_trim/-/pipelines/153603). But, on February 25, 2024, it was passing - see [here](https://git.drupalcode.org/issue/smart_trim-3423678/-/pipelines/103540). In both cases, "next major" was Drupal 11, no?

    ...a few minutes pass...

    Heh, we just figured it out. It turns out all all core updates prior to 10.3 were removed from Drupal 11 on April 19, 2024 - see [here]( https://www.drupal.org/project/drupal/issues/3439769 ๐Ÿ“Œ Remove all the pre-10.3.0 updates hooks Fixed ).

    Therefore, no need for @ankitv18 to answer my question, as we have answered it for ourselves ๐Ÿ˜€

    Bottom line - yes, we need a new fixture based on Drupal 10.3.whatever and Smart Trim 2.0.0. The easiest way to create this fixture (database dump) is probably to:

    • Start with a fresh Drupal 10.3.whatever code base
    • Import the existing fixture (smart_trim/tests/fixtures/update/drupal-10.0.8-smart_trim-2.0.php.gz)
    • Run database updates
    • Export database (as .gz, not as .zip!)
    • Update line 26 of smart_trim/tests/src/Functional/Update/SmartTrimUpdateMoreTest.php
    • Run test locally to ensure all is working.
    • Commit changes

    Did we miss anything?

    -mike

  • Status changed to Needs review 4 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States ultimike Florida, USA

    Hopefully, this is now all set.

    During DrupalEasy office hours today, we updated the text fixture - it was a great learning experience for all of us, and definitely a team effort. I have asked those to participated to leave a comment below so that they can receive credit as well.

    ๐Ÿคž๐Ÿผthat all tests pass.

    Some notes along the way:

    To import the old database fixture, we first deleted all the tables from the database, then used the following command to import (from the "web" directory): php ./core/scripts/db-tools.php import ./modules/contrib/smart_trim/tests/fixtures/update/drupal-10.0.8-smart_trim-2.0.php

    Prior to running the database updates for Drupal core, we checked out the 2.0.0 branch of Smart Trim (otherwise we would have run the database updates that are meant to be tested). After we ran the updates, we checked out the -dev for Smart Trim.

    To re-create the fixture, we used (again from the web directory): php ./core/scripts/db-tools.php dump-database-d8-mysql > modules/contrib/smart_trim/tests/fixtures/update/drupal-10.3.2-smart_trim-2.0.php, then we used "gzip" to compress the file.

    -mike

  • First commit to issue fork.
  • Merge request !101Resolve #3464532 "Update fixtures for" โ†’ (Merged) created by lostcarpark
  • Pipeline finished with Failed
    4 months ago
    Total: 458s
    #256167
  • Pipeline finished with Success
    4 months ago
    Total: 392s
    #256175
  • ๐Ÿ‡ฎ๐Ÿ‡ชIreland lostcarpark

    Mike had to run so I created the Merge Request.

    Next Major test passed, but previous minor and previous major failed - this makes sense to me since we were trying to load a D10.3 DB into older Drupal versions.

    Added conditional logic to setDatabaseDumpFiles() function, to check the Drupal version, and load the previous fixture file if lower than 10.3.2.

    All tests now pass. I'm not sure how it manages to pass for previous major, but I guess the 10.0 DB must be close enough to 9.5 that it doesn't break anything.

    Should be ready for review.

  • Pipeline finished with Skipped
    4 months ago
    #256246
  • Status changed to Fixed 4 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States markie Albuquerque, NM

    Thanks for the information on creating fixtures. Merged in the latest and tagging for 2.2.0

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

Production build 0.71.5 2024