Closed gshif closed 5 years ago
Test Cases:
Status Code / Message Tests:
1) Send valid line protocol to /write endpoint (use one liner from cmd line) -> ensure 204 http status code -> ensure message: "write data is correctly formatted and accepted for writing to the bucket."
2) Send invalid line protocol to the /write endpoint (use one liner from cmd line) -> ensure 400 http status code -> ensure message: "line protocol poorly formed and no points were written. Response can be used to determine the first malformed line in the body line-protocol. All data in body was rejected and not written."
3) Send valid line protocol to /write endpoint from a file -> ensure 204 http status code -> ensure message: "write data is correctly formatted and accepted for writing to the bucket."
4) Send invalid line protocol to the /write endpoint from a file -> ensure 400 http status code -> ensure message: "line protocol poorly formed and no points were written. Response can be used to determine the first malformed line in the body line-protocol. All data in body was rejected and not written."
5) Send valid line protocol to /write endpoint (use one liner from cmd line) with no token. -> ensure 403 http status code -> ensure message: "no token was sent and they are required"
6) Send valid line protocol to /write endpoint from a file with no token. -> ensure 403 http status code, token is required.
7) Send valid line protocol to /write endpoint (use one liner from cmd line) with a token that does not have sufficient permissions. -> ensure 401 status code. 8) Send valid line protocol to /write endpoint from a file with a token that does not have sufficient permissions. -> ensure 401 status code. 9) Send valid line protocol to /write endpoint from a file that is larger than the max supported size for a request -> ensure 413 status code. (to do: determine max supported size for a request) 10) Send valid line protocol to the /write endpoint from a token in a way that triggers the token rate limit -> ensure 429 status code. Message should be: "token is temporarily over quota. The Retry-After header describes when to try the write again" (to do: determine exactly what it take to determine token rate limit) 11) Send valid line protocol to the /write endpoint when the server is unavailable -> ensure 503 response code.
Precision Tests:
1) Send valid line protocol to /write endpoint (use one liner from cmd line) without specifying precision -> ensure points written with nano second precision (nano second is default)
2) Send valid line protocol to /write endpoint from a file without specifying precision -> ensure points written with nano second precision (nano second is default)
3) Send valid line protocol to /write endpoint (use one liner from cmd line) specifying ms
precision -> ensure points written with ms
precision.
4) Send valid line protocol to /write endpoint from a file specifying ms
precision -> ensure points written with ms
precision.
5) Send valid line protocol to /write endpoint (use one liner from cmd line) specifying us
precision -> ensure points written with us
precision.
6) Send valid line protocol to /write endpoint from a file specifying us
precision -> ensure points written with us
precision.
7) Send valid line protocol to /write endpoint (use one liner from cmd line) specifying s
precision -> ensure points written with s
precision.
8) Send valid line protocol to /write endpoint from a file specifying s
precision -> ensure points written with s
precision.
Required Params tests:
1) Send valid line protocol to /write endpoint (use one liner from cmd line) passing a bucket but no organization -> ensure this doesn't succeed as organization is required, response code likely 400 or 401.
2) Send valid line protocol to /write endpoint (use one liner from cmd line) passing an organization but no bucket -> ensure this doesn't succeed as bucket is required, response code likely 400 or 401.
@kevinhogan111 , would you please update the status of the ticket. Thanks
This PR Adds tests for http status codes 204, 400, 401, 403, based on swagger doc.
xFails added for: influxdata/influxdb#11621 and influxdata/influxdb#11622
Will need to revisit the /write in a future PR to add tests around specific Precisions. .
Need to add automated tests for writing
write
endpoint. The reference doc could be found here : go/src/github.com/influxdata/platform/http/swagger.yml