• 
      

    Fix regressions in the rbintegrations test suites.

    Review Request #11198 — Created Sept. 24, 2020 and submitted

    Information

    rbintegrations
    release-1.0.x

    Reviewers

    Some recent changes broke a few of the rbintegrations tests. These
    affected CircleCI, Travis CI, Slack, and Mattermost.

    The CircleCI and Travis CI tests attempt an authorization on GitHub, but
    the changes to move to token-based authentication resulted in some
    changes to the HTTP methods performed to the GitHub API. The unit tests
    weren't spying on the new methods, causing our tests to hit the API and
    fail. Now, we spy on both methods, allowing compatibility with a larger
    range of Review Board versions.

    They've also been updated to provide two versions of the HTTP headers,
    in order to fix address case normalization issues.

    Travis CI got some fixes for reloading models. Newer unit tests added
    calls to refresh_from_db(), which isn't available for Review Board 3.0.

    Slack and Mattermost were both creating a review request, changing the
    ID, and then saving, which wasn't particularly safe, and led to some
    issues with RelationCounterField in a test. We now set the ID when
    creating the review requests.

    Unit tests pass for Review Board 3.0. Some work is still required for
    4.0, which will be fixed separately.

    Summary ID
    Fix regressions in the rbintegrations test suites.
    Some recent changes broke a few of the rbintegrations tests. These affected CircleCI, Travis CI, Slack, and Mattermost. The CircleCI and Travis CI tests attempt an authorization on GitHub, but the changes to move to token-based authentication resulted in some changes to the HTTP methods performed to the GitHub API. The unit tests weren't spying on the new methods, causing our tests to hit the API and fail. Now, we spy on both methods, allowing compatibility with a larger range of Review Board versions. They've also been updated to provide two versions of the HTTP headers, in order to fix address case normalization issues. Travis CI got some fixes for reloading models. Newer unit tests added calls to `refresh_from_db()`, which isn't available for Review Board 3.0. Slack and Mattermost were both creating a review request, changing the ID, and then saving, which wasn't particularly safe, and led to some issues with `RelationCounterField` in a test. We now set the ID when creating the review requests.
    a418db3badf5d4b086574c1de3d43b2dfe99f869
    Description From Last Updated

    See my comment on Hailan's change--the capitalization seems to be dependent on Python version, not Review Board version.

    daviddavid
    MarcusBoay
    1. 
        
    2. rbintegrations/slack/tests.py (Diff revision 1)
       
       

      I'm curious what this does

      1. To help manage our extensive test suite, we have a number of helper functions in the past TestCase (defined in reviewboard/testing/testcase.py) to create common objects, such as review requests (create_review_request()). This provides defaults for fields and a lot of default behavior (e.g., making it easy to create an associated repository). One of the things it allows us to do is to explicitly provide an ID (seen as an id or pk field) for the database (this patch's review request's id would be 11198, for example).

        The older code was creating a review request in the database, then changing the ID and creating a new one. This led to two entries, which wasn't correct, and broke some internal state management that some fields have. So this particular change is just fixing the code to set the correct ID on creation.

    3. 
        
    david
    1. 
        
    2. rbintegrations/circleci/tests.py (Diff revision 1)
       
       
       
       
       
       
      Show all issues

      See my comment on Hailan's change--the capitalization seems to be dependent on Python version, not Review Board version.

      1. I'm about to post a change fixing this in a more reliable way in Review Board. I'll be undoing this part after that's in.

    3. 
        
    chipx86
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-1.0.x (7bc3fdf)