Skip to content

Add non negative validation to update time estimate rest api endpoint

What does this MR do and why?

For #390579 (closed)

Fix time estimate REST API to validate estimate is not negative

Screenshots or screen recordings

Invalid Negative Zero Valid
MR mr-invalid mr-negative mr-zero mr-valid
Issue issue-invalid issue-negative issue-zero issue-valid

How to set up and validate locally

  1. Run your gdk server locally and login
  2. Download/open your favorite api testing service to verify the new time_estimate update validations work properly. I used Postman in these examples.
  3. On your gdk server, click your profile picture > Preferences > Access Tokens and create a new token with the api scope
  4. Copy the token then navigate back to Postman and paste it as a bearer token under the 'Authorization' tab of a new request Screenshot_2023-07-23_at_6.10.58_PM
  5. Find an issue and merge request in your gdk instance and make note of the project id and issue/MR ids. Use those to construct your endpoint as shown in the examples below.
  6. Test updating the time_estimate to a negative number, zero, a valid number, and invalid entry, for the issue and MR you selected:
http://127.0.0.1:3000/api/v4/projects/7/merge_requests/5/time_estimate?duration=-2
http://127.0.0.1:3000/api/v4/projects/7/merge_requests/5/time_estimate?duration=0
http://127.0.0.1:3000/api/v4/projects/7/merge_requests/5/time_estimate?duration=1h
http://127.0.0.1:3000/api/v4/projects/7/merge_requests/5/time_estimate?duration=abc
  1. Ensure the error message shows where appropriate. The responses should be as shown in the screenshots of the previous section.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Missy Davies

Merge request reports