Skip to content

Commit

Permalink
[compute_ctl] User correct HTTP code in the /configure errors (#6017)
Browse files Browse the repository at this point in the history
It was using `PRECONDITION_FAILED` for errors during `ComputeSpec` to
`ParsedSpec` conversion, but this disobeys the OpenAPI spec [1] and
correct code should be `BAD_REQUEST` for any spec processing errors.

While on it, I also noticed that `compute_ctl` OpenAPI spec has an
invalid format and fixed it.

[1] https://github.com/neondatabase/neon/blob/fd81945a60dff25fea65a50f2c8cd6e4c955fba4/compute_tools/src/http/openapi_spec.yaml#L119-L120
  • Loading branch information
ololobus authored Dec 1, 2023
1 parent 711425c commit c1295bf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion compute_tools/src/http/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ async fn handle_configure_request(

let parsed_spec = match ParsedSpec::try_from(spec) {
Ok(ps) => ps,
Err(msg) => return Err((msg, StatusCode::PRECONDITION_FAILED)),
Err(msg) => return Err((msg, StatusCode::BAD_REQUEST)),
};

// XXX: wrap state update under lock in code blocks. Otherwise,
Expand Down
20 changes: 10 additions & 10 deletions compute_tools/src/http/openapi_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,17 @@ paths:
description: Error text or 'OK' if download succeeded.
example: "OK"
400:
description: Request is invalid.
content:
application/json:
schema:
$ref: "#/components/schemas/GenericError"
description: Request is invalid.
content:
application/json:
schema:
$ref: "#/components/schemas/GenericError"
500:
description: Extension download request failed.
content:
application/json:
schema:
$ref: "#/components/schemas/GenericError"
description: Extension download request failed.
content:
application/json:
schema:
$ref: "#/components/schemas/GenericError"

components:
securitySchemes:
Expand Down

1 comment on commit c1295bf

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2498 tests run: 2393 passed, 2 failed, 103 skipped (full report)


Failures on Postgres 16

  • test_ondemand_download_timetravel[real_s3]: debug

Failures on Postgres 14

  • test_pgbench_intensive_init_workload[neon_off-1000]: release
# Run all failed tests locally:
scripts/pytest -vv -n $(nproc) -k "test_pgbench_intensive_init_workload[neon_off-1000] or test_ondemand_download_timetravel[debug-pg16-real_s3]"
Flaky tests (3)

Postgres 16

  • test_ondemand_download_timetravel[local_fs]: debug
  • test_ondemand_download_timetravel[mock_s3]: debug

Postgres 14

  • test_branching_with_pgbench[cascade-1-10]: debug

Test coverage report is not available

The comment gets automatically updated with the latest test results
c1295bf at 2023-12-01T18:03:31.939Z :recycle:

Please sign in to comment.