TritonDataCenter / sdc-docker

Docker Engine for Triton
Mozilla Public License 2.0
183 stars 49 forks source link

DOCKER-735: queryParser handlers missing for some endpoints that require the query string to be parsed #71

Closed misterdjules closed 5 years ago

misterdjules commented 8 years ago

The following endpoints:

were missing a queryParser handler to parse the query string. As a result, none of their query string parameters were used. This problem was the result of a previous change that moved the queryParser from the before handlers to each specific endpoint that was using it.

This PR adds the queryParser handler to these three endpoints, and adds some basic tests that were missing, and that would have helped us find that the queryParser handler was missing in the first place.

In addition to these changes, this PR brings the following other notable changes:

  1. It adds a check in error classes to make sure that their constructor is called with new, preventing hard to find bugs.
  2. It adds some validation for timeout values in the containerStop and containerRestart endpoints, and for signal values in the containerKill endpoint.
  3. It adds a new test/lib/container.js module that contains the checkContainerStatus function. This function is used to check if a container transitions to a given status and allows for a certain number of retries. This was needed in the api-start-kill.js integration test to make it non-flakey, since sometimes a killed container would not transition to the stopped status before we'd check its status.

This PR needs to land _after https://github.com/joyent/sdc-vmapi/pull/22, since otherwise it would pass numeric signal such as '9' as strings, which VMAPI doesn't accept before https://github.com/joyent/sdc-vmapi/pull/22.

misterdjules commented 8 years ago

Updated this PR with a second commit that:

misterdjules commented 5 years ago

Closing as I won't be working on that and I don't think there's any interest in getting that merged.