• 
      

    Fix a unit test regression from the diff comment fragments cache change.

    Review Request #12316 — Created May 31, 2022 and submitted

    Information

    Review Board
    release-5.0.x

    Reviewers

    The unit test introduced in 5bbcc128c for altering comment diff fragment
    caching behavior on errors ended up being unstable. The Django function
    we used to generate the cache header, patch_cache_control, generates a
    dictionary of items and then turns it into a single string. This means
    that the order of items is not in a stable sort order, causing our
    checks to sometimes fail.

    To fix this, we now split the Cache-Control header value, convert to a
    set, and compare the items within. This avoids any sorting issues
    going forward.

    Unit tests pass.

    Summary ID
    Fix a unit test regression from the diff comment fragments cache change.
    The unit test introduced in 5bbcc128c for altering comment diff fragment caching behavior on errors ended up being unstable. The Django function we used to generate the cache header, `patch_cache_control`, generates a dictionary of items and then turns it into a single string. This means that the order of items is not in a stable sort order, causing our checks to sometimes fail. To fix this, we now split the `Cache-Control` header value, convert to a `set`, and compare the items within. This avoids any sorting issues going forward.
    f4caf258e3e69e6ddfc9954c80e169c586a3eafe
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-5.0.x (fbb63df)