Improve fixture regeneration script

Created on 26 November 2024, 26 days ago

Problem/Motivation

๐Ÿ“Œ Make relevance the default sort Active introduced a script to regenerate fixture re-generation. However, ๐Ÿ“Œ Do not hardcode UUIDs in DrupalJsonApi plugin Active introduced a new way to get the UUIDs of certain taxonomy terms so they wouldn't be hardcoded, and the previous script was based on the old values, so if we try to regenerate them again we get 0 results, because the UUIDs are not the right ones.

Steps to reproduce

php scripts/regenerate-drupalorg-jsonapi-fixture.php

Proposed resolution

Get the UUIDs dynamically and build the queries with the right ones.

๐Ÿ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

๐Ÿ‡ช๐Ÿ‡ธSpain fjgarlin

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

Merge Requests

Comments & Activities

  • Issue created by @fjgarlin
  • Merge request !629Regeneration script improvements โ†’ (Merged) created by fjgarlin
  • Pipeline finished with Failed
    26 days ago
    Total: 501s
    #350424
  • Pipeline finished with Canceled
    26 days ago
    Total: 75s
    #350468
  • Pipeline finished with Canceled
    26 days ago
    Total: 221s
    #350471
  • Pipeline finished with Canceled
    26 days ago
    Total: 326s
    #350477
  • Pipeline finished with Failed
    26 days ago
    Total: 492s
    #350486
  • Pipeline finished with Failed
    26 days ago
    Total: 469s
    #350509
  • Pipeline finished with Failed
    26 days ago
    Total: 477s
    #350517
  • Pipeline finished with Failed
    26 days ago
    Total: 472s
    #350521
  • Pipeline finished with Failed
    26 days ago
    Total: 500s
    #350534
  • Pipeline finished with Failed
    26 days ago
    Total: 473s
    #350537
  • Pipeline finished with Failed
    26 days ago
    Total: 439s
    #350709
  • Pipeline finished with Failed
    26 days ago
    Total: 364s
    #350790
  • Pipeline finished with Failed
    26 days ago
    Total: 367s
    #350877
  • ๐Ÿ‡ช๐Ÿ‡ธSpain fjgarlin

    Ok, it took longer than expected but I tried to make it as solid as possible. The script regeneration works now much better.

    The script has some configuration constants, that would not need changing unless the tests and fixtures change. I made comments were relevant and the script gives output on whether the fixture was saved or not. It also offers suggestions to change some old UUIDs for new ones if needed.

    However, there are things that we should change for future tests writing regarding the fixtures.
    - It doesnโ€™t make sense to check whether we have 4564 results or 1897 results. We just one results, so we can change things for regex checks instead.
    - When checking list of returned modules, the lists should be small rather than having 8-10 modules, as results can change.
    - One of the tests checks for the newest modulesโ€ฆ this will always change on regeneration.

    Right now the tests are falling due to expecting certain list of modules and certain number of results. It also needs rebasing and solving the conflict because of a commit that happened today.

  • Pipeline finished with Canceled
    26 days ago
    Total: 348s
    #350894
  • Pipeline finished with Failed
    26 days ago
    Total: 408s
    #350902
  • Pipeline finished with Failed
    26 days ago
    Total: 772s
    #350900
  • Pipeline finished with Failed
    25 days ago
    Total: 354s
    #351883
  • Pipeline finished with Canceled
    25 days ago
    Total: 152s
    #351903
  • Pipeline finished with Canceled
    25 days ago
    Total: 469s
    #351909
  • Pipeline finished with Failed
    25 days ago
    Total: 370s
    #351915
  • Pipeline finished with Failed
    23 days ago
    Total: 598s
    #354113
  • Pipeline finished with Failed
    23 days ago
    Total: 357s
    #354152
  • Pipeline finished with Failed
    23 days ago
    Total: 695s
    #354163
  • Pipeline finished with Canceled
    23 days ago
    Total: 331s
    #354170
  • Pipeline finished with Success
    23 days ago
    Total: 442s
    #354176
  • ๐Ÿ‡ช๐Ÿ‡ธSpain fjgarlin

    This is finally ready to be checked. The re-generation is now fully automated, it offers suggestions on what to change in the tests and the tests are a bit less flaky, as we don't check an exact list of modules in certain order (that's already tested on other classes).

    I insist that the followup ๐Ÿ“Œ Simplify tests for JsonApi plugin Active should be addressed anyway, as all we should be checking in the JsonApi plugin is that it is able to consume the jsonapi data and produce results. This can be a kernel or even unit test, but I'll let that be decided in the other issue.

    As far as this go, I think it's ready.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia narendraR Jaipur, India

    Regenerated fixture on local using php scripts/regenerate-drupalorg-jsonapi-fixture.php and run all tests in ProjectBrowserUiTestJsonApi. All tests are passing after fixture update.
    Moving this issue to RTBC.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States chrisfromredfin Portland, Maine

    Please just address the one comment. I'd love to understand why the JSON files are numbered. Either change them away from being numbered to something more self-documenting, or document the "why" for numerically-named files in the function's DocBlock / a code comment explaining why they are the way they are.

  • ๐Ÿ‡ช๐Ÿ‡ธSpain fjgarlin

    That's a good point. I was just keeping what was in there, I don't think there is the need for numbers anymore, especially with the new script that only takes "keys" and "values".

    I'll change it.

  • Pipeline finished with Canceled
    20 days ago
    Total: 74s
    #356659
  • Pipeline finished with Success
    20 days ago
    Total: 435s
    #356660
  • ๐Ÿ‡ช๐Ÿ‡ธSpain fjgarlin

    Feedback addressed.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States chrisfromredfin Portland, Maine

    Haven't updated where the fixture files are generated. :)

  • Pipeline finished with Canceled
    18 days ago
    Total: 304s
    #358868
  • ๐Ÿ‡ช๐Ÿ‡ธSpain fjgarlin

    Done that now. Well spotted. Back to needs review.

  • Pipeline finished with Success
    18 days ago
    Total: 526s
    #358878
  • Pipeline finished with Skipped
    18 days ago
    #359189
  • Pipeline finished with Skipped
    18 days ago
    #359190
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States chrisfromredfin Portland, Maine

    There we are!

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

Production build 0.71.5 2024