stable

Clone or download

Read-only

request #15093: REST endpoint /projects/:id/testmanagement_campaigns is slow

Instead of pulling all the linked artifacts of the campaign one by one to check the status, the global status of a campaign is now directly computed in the DB with a SQL query. Global permissions are verified before running the query and the query only check specific permissions of an artifact that might have been set via the 'Permissions on artifact' field. This contribution also fixes a bug: the status is now only computed from the test exec artifacts instead of any artifacts linked to the campaign with a status notrun|passed|blocked|failed. While there is still room for improvement by retrieving the execution statuses for all campaigns at once instead of each campaign individually, the optimization does not seem to be needed at this time. This contribution already yields a 98% improvement of the request execution time (8.59s → 127ms) with the scenario used as the benchmark (one campaign with 10000+ tests). Change-Id: I36511ae87b4571baf38e4badde5f40edd4c21937

Modified Files

Name
A plugins/testmanagement/include/TestManagement/Campaign/InformationNeededToRetrieveTestStatusOfACampaign.php +142 −0 Go to diff View file
A plugins/testmanagement/include/TestManagement/Campaign/TestExecutionTestStatusDAO.php +82 −0 Go to diff View file
M plugins/testmanagement/include/TestManagement/REST/v1/CampaignRepresentation.class.php +39 −17 Go to diff View file
M plugins/testmanagement/include/TestManagement/REST/v1/CampaignRepresentationBuilder.php +28 −5 Go to diff View file
M plugins/testmanagement/include/TestManagement/REST/v1/CampaignsResource.class.php +5 −1 Go to diff View file
M plugins/testmanagement/include/TestManagement/REST/v1/ProjectResource.class.php +6 −1 Go to diff View file
A plugins/testmanagement/tests/unit/TestManagement/Campaign/InformationNeededToRetrieveTestStatusOfACampaignTest.php +249 −0 Go to diff View file