Add web API resources for tool executions and executables.

Review Request #6139 — Created July 23, 2014 and submitted — Latest diff uploaded

Information

ReviewBot
master
167d7f0...

Reviewers

This adds the two new resources tool_executions and tool_executables, and also
brings back the old review_bot_review resource (left unmodified).

At a high level, this API now supports multiple profiles/configurations per
tool, allows us to manually execute tools, and allows us to log and track the
status of tool executions.

A tool execution contains information on a tool profile that is currently
being executed or has been executed on some diff of a review request. This
resource supports getting a specified tool execution, getting a list of tool
executions for a review request ID and diff revision (with the optional
parameters status and get-latest, the latter of which will be very useful
for the manual execution UI), creating a new tool execution and adding an
execution request to the message queue, and updating a tool execution's status
and result (used by the workers).

The tool executables resource provides a list of tool profiles that the user is
allowed to manually execute, for some review request ID and diff revision.

Did GET, POST, PUT requests on tool-executions with all possible request
parameters, and GET requests on tool-executables.

Went through multiple manual execution scenarios (using the change in /r/6192).
- Got a list of executable tool profiles.
- Removed all manual permissions on a profile, and saw that it was no longer
on the list of executables.
- Tried to create an execution, specifying a profile not on the list.
- Created an execution, specifying a profile on the list this time.
- Got the list of executions for the review request/diff, and saw the 'queued'
status for the above execution.
- Saw that the execution request was received by a worker. The worker updated
the tool execution with the 'succeeded' status and JSON review, and
published a review on the review request. The last-updated time was also
automatically updated.
- Checked the list of executable tool profiles, and saw that the just-executed
profile was no longer on the list.
- Tried to execute the just-executed profile, and failed.

  • Tried passing invalid review request IDs, diff revisions, and profile IDs,
    and verified that the requests all failed.
  • Tried passing a profile ID for which the user did not have permission to
    manually execute, and verified that that the profile was not listed as an
    executable and a PERMISSION_DENIED error for the POST.
  • Tried to update the status of an execution (not logged in as the Review Bot
    user) and was denied permission.