Consolidate methods in jsonapi FileUploadTest

Created on 26 September 2023, 9 months ago
Updated 28 September 2023, 9 months ago

Problem/Motivation

FileUploadTest includes the basic suite of jsonapi resource tests, then a number of similar tests for various file upload conditions. It is one of the slowest function tests due to running 21 test methods.

Steps to reproduce

Proposed resolution

Consolidate the file upload variations by having a single method call protected methods instead.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Fixed

Version

11.0 🔥

Component
JSON API  →

Last updated 2 days ago

Created by

🇬🇧United Kingdom catch

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

Comments & Activities

  • Issue created by @catch
  • 🇬🇧United Kingdom catch

    This one is tricky.

    The methods assume a clean slate of file uploads (which is fair enough) but break when run one-after-the-other on the same install because they don't get a clean slate.

    Another way to handle this would be to split to test in two, but ResourceTestBase contains a lot of setup steps which these methods rely on, in addition to actual test methods, so we would probably need to split the setup steps out into a trait that both ResourceTestBase and the new class can use, maybe that would be OK though.

  • 🇬🇧United Kingdom catch
  • 🇬🇧United Kingdom catch

    Trait doesn't help that much because you can't directly override properties between traits and a lot of what we'd want to share is properties. Can probably do a partial trait then redeclare various things in the class but it's not going to be ideal.

    Another idea is to do the @requires not_relevant_to_this_test trick for literally every method in the base class for a split, maybe I'll try that to get something going.

  • Status changed to Needs review 9 months ago
  • 🇬🇧United Kingdom catch

    Figured it out I think - consolidating the tests that don't actually result in a file upload since those don't need a state reset. And combining two extremely similar test methods where one of them becomes and extra 3-4 lines on the other.

  • last update 9 months ago
    30,359 pass
  • @catch opened merge request.
  • Status changed to RTBC 9 months ago
  • 🇺🇸United States smustgrave

    From what I can tell consolidate is good and still covering what was there before.

  • Status changed to Fixed 9 months ago
  • 🇫🇮Finland lauriii Finland

    Committed fec7c65 and pushed to 11.x. Thanks!

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

Production build 0.69.0 2024