Skip to content

Continue code quality widget polling on 204 response (when pipeline is still running or results are being parsed)

What does this MR do?

For #327751 (closed), case 3️⃣

This MR fixes a bug in the code quality MR widget where "No changes to code quality" would be shown while the results of the code quality scan were still being parsed and compared (while the endpoint returned a 204 No Content status), and the real results would only be shown after a refresh of the page once the comparison had completed.

Technically, this MR:

  • replaces the axios.get that we were using with our pollUntilComplete util, which
    • polls the endpoint until it gets either a 200 response or an error
    • uses the Poll-Interval header from the 204 response to determine how frequently to poll
  • adds test cases for each scenario (mock a 204 response followed by a 200 response and expect receiveReportsSuccess, and mock a 204 response followed by a 500 response and expect receiveReportsError)

If !67370 (merged) is merged first

  • Fix merge conflicts (actions.js)

Screenshots or Screencasts (strongly suggested)

before: MR widget showing "No changes..." message after 204 response after: MR widget continuing to poll and receiving results
Screen_Shot_2021-07-30_at_16.02.03 Screen_Recording_2021-07-30_at_16.09.38

How to setup and validate locally (strongly suggested)

  1. find/make/clone a project that has the code quality scan set up (I have a few test projects if you need one: here and here)
  2. find/create a branch that improves and/or degrades code quality (the test projects have some branches that do this already) and create an MR for the branch
  3. make sure that pipelines ran for both the base commit and head commit of the branch and that they generated code quality reports
  4. observe the MR page and the code quality MR widget after those pipelines have finished, as the results of the report comparison become available (without refreshing the page)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Miranda Fluharty

Merge request reports

Loading