Skip to content

Expose show tests endpoint

Max Orefice requested to merge mo-add-show-test-suite-endpoint into master

Part of #218723 (closed)

This feature will be behind a feature flag called build_report_summary

What does this MR do?

This MR exposes a new show endpoint to our tests API allowing us to fetch individual test suite data.

It includes the following items:

  • Refactor TestsController to inherit from Projects::Pipelines::ApplicationController
  • Adds show endpoint
  • Adds TestSuiteSerializer
  • Adds TestReportSummaryEntity
  • Adds TestSuiteSummaryEntity
  • Adds TestReportSummarySerializer

Following up !34410 (merged) where we created an abstract controller which will be used in this MR.

endpoint JSON response
projects/-/:id/pipelines/:pipeline_id/tests/suite-name.json?build_ids=1,2 image

Why are we doing this?

Today our JUnit feature is really slow for big projects containing a lot of tests and requires almost 1min on gitlab.com in order to render the data. We are working toward improving the ~performance of this feature and we decided by starting to persist our counter data which is all the data you can see on the screenshot below 👇

Pipeline___GitLab.org___GitLab___GitLab_2020-05-25_14-51-16

In this MR we are making it possible to fetch data from each row with our new endpoint.

Context

This follows the work of #211838 (closed) where we started to persist our JUnit data on the database. It's part of our effort to make our JUnit faster and remove the feature flag which has been around for over 1 year.

sequenceDiagram
    participant U as User
    participant FE as Frontend
    participant BE as Backend
    U->>FE: Click onto pipeline page
    FE->>BE: Request test report summaries (async)
    BE->>FE: Return test report summaries from DB
    FE->>U: Render badge counter on test tab
    U->>FE: Click Test Tab
    FE->>U: Render test tab from summary data (No visual change from current)
    U->>FE: Click on single test suite
    FE->>BE: Request full report for single test suite
    BE->>FE: Parse XML report and return detailed report
    FE->>U: Render report for single test suite

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Max Orefice

Merge request reports

Loading