Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Health endpoints response schema and status code conformance #1501

Open
2 tasks done
kukkok3 opened this issue Jan 10, 2025 · 0 comments
Open
2 tasks done

[Bug]: Health endpoints response schema and status code conformance #1501

kukkok3 opened this issue Jan 10, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@kukkok3
Copy link
Contributor

kukkok3 commented Jan 10, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The endpoints:

/api/v1/health/started
/api/v1/health/ready
/api/v1/health/live

show all the same issues:

  • the status code 400 is not documented
  • The response on a GET is null but the schema says it should be a string
  • Authorization is required

The issues can be replicated by cloning this branch from catalyst-voices repo test/schemathesis-for-health-endpoints and running earthly -P ./catalyst-gateway/tests/schemathesis_tests+test-fuzzer-api --seed='hypothesis-seed=55522817394591431937140819430305039089'
The issues can be replicate also by starting catalyst gateway on local host on port 3030, setting the API KEY to 123 and calling curl -X GET -H 'X-API-Key: 123' http://0.0.0.0:3030/api/v1/health/started
The branch will not be merged in main until the issue is fixed to avoid breaking the ci

Expected Behavior

No response

Project

Backend

What operating system are you seeing the problem on?

Linux

What browsers are you seeing the problem on?

Not Applicable

Relevant log output

=================================== FAILURES ===================================
  ./c/t/schemathesis_tests+test-fuzzer-api | __________________________ GET /api/v1/health/started __________________________
  ./c/t/schemathesis_tests+test-fuzzer-api | 1. Test Case ID: xKxtUD
  ./c/t/schemathesis_tests+test-fuzzer-api | 
  ./c/t/schemathesis_tests+test-fuzzer-api | - Undocumented HTTP status code
  ./c/t/schemathesis_tests+test-fuzzer-api | 
  ./c/t/schemathesis_tests+test-fuzzer-api |     Received: 400
  ./c/t/schemathesis_tests+test-fuzzer-api |     Documented: 503, 204, 401, 429, 403, 422, 500
  
  ./c/t/schemathesis_tests+test-fuzzer-api | [400] Bad Request:
  
  ./c/t/schemathesis_tests+test-fuzzer-api | Reproduce with: 
  
  ./c/t/schemathesis_tests+test-fuzzer-api |     curl -X GET -H 'X-API-Key: [Filtered]' http://0.0.0.0:3030/api/v1/health/started
  ./c/t/schemathesis_tests+test-fuzzer-api | 
  ./c/t/schemathesis_tests+test-fuzzer-api | 2. Test Case ID: Zo8gXU
  ./c/t/schemathesis_tests+test-fuzzer-api | 
  ./c/t/schemathesis_tests+test-fuzzer-api | - Response violates schema
  ./c/t/schemathesis_tests+test-fuzzer-api | 
  ./c/t/schemathesis_tests+test-fuzzer-api |     None is not of type 'string'
  
  ./c/t/schemathesis_tests+test-fuzzer-api |     Schema at /properties/detail/items/properties/type:
  
  ./c/t/schemathesis_tests+test-fuzzer-api |         {
  ./c/t/schemathesis_tests+test-fuzzer-api |             "type": "string",
  ./c/t/schemathesis_tests+test-fuzzer-api |             "format": "error",
  ./c/t/schemathesis_tests+test-fuzzer-api |             "title": "Error Message",
  ./c/t/schemathesis_tests+test-fuzzer-api |             "description": "The type of error",
  ./c/t/schemathesis_tests+test-fuzzer-api |             "example": "An error has occurred, the details of the error are ...",
  ./c/t/schemathesis_tests+test-fuzzer-api |             "maxLength": 1000,
  ./c/t/schemathesis_tests+test-fuzzer-api |             "minLength": 1,
  ./c/t/schemathesis_tests+test-fuzzer-api |             "pattern": "^[0-9a-zA-Z].*$"
  ./c/t/schemathesis_tests+test-fuzzer-api |         }
  
  ./c/t/schemathesis_tests+test-fuzzer-api |     Value:
  
  ./c/t/schemathesis_tests+test-fuzzer-api |         null
  
  ./c/t/schemathesis_tests+test-fuzzer-api | [422] Unprocessable Entity:
  
  ./c/t/schemathesis_tests+test-fuzzer-api |     `{"detail":[{"loc":null,"msg":"authorization error","type":null}]}`
  
  ./c/t/schemathesis_tests+test-fuzzer-api | Reproduce with: 
  
  ./c/t/schemathesis_tests+test-fuzzer-api |     curl -X GET -H 'X-API-Key: [Filtered]' http://0.0.0.0:3030/api/v1/health/started
  ./c/t/schemathesis_tests+test-fuzzer-api | 
  ./c/t/schemathesis_tests+test-fuzzer-api | ___________________________ GET /api/v1/health/ready ___________________________
  ./c/t/schemathesis_tests+test-fuzzer-api | 1. Test Case ID: A8VBBO
  ./c/t/schemathesis_tests+test-fuzzer-api | 
  ./c/t/schemathesis_tests+test-fuzzer-api | - Undocumented HTTP status code
  ./c/t/schemathesis_tests+test-fuzzer-api | 
  ./c/t/schemathesis_tests+test-fuzzer-api |     Received: 400
  ./c/t/schemathesis_tests+test-fuzzer-api |     Documented: 204, 500, 422, 401, 429, 403, 503
  
  ./c/t/schemathesis_tests+test-fuzzer-api | [400] Bad Request:
  
  ./c/t/schemathesis_tests+test-fuzzer-api | Reproduce with: 
  
  ./c/t/schemathesis_tests+test-fuzzer-api |     curl -X GET -H 'X-API-Key: [Filtered]' http://0.0.0.0:3030/api/v1/health/ready
  ./c/t/schemathesis_tests+test-fuzzer-api | 
  ./c/t/schemathesis_tests+test-fuzzer-api | 2. Test Case ID: TpHN2z
  ./c/t/schemathesis_tests+test-fuzzer-api | 
  ./c/t/schemathesis_tests+test-fuzzer-api | - Response violates schema
  ./c/t/schemathesis_tests+test-fuzzer-api | 
  ./c/t/schemathesis_tests+test-fuzzer-api |     None is not of type 'string'
  
  ./c/t/schemathesis_tests+test-fuzzer-api |     Schema at /properties/detail/items/properties/type:
  
  ./c/t/schemathesis_tests+test-fuzzer-api |         {
  ./c/t/schemathesis_tests+test-fuzzer-api |             "type": "string",
  ./c/t/schemathesis_tests+test-fuzzer-api |             "format": "error",
  ./c/t/schemathesis_tests+test-fuzzer-api |             "title": "Error Message",
  ./c/t/schemathesis_tests+test-fuzzer-api |             "description": "The type of error",
  ./c/t/schemathesis_tests+test-fuzzer-api |             "example": "An error has occurred, the details of the error are ...",
  ./c/t/schemathesis_tests+test-fuzzer-api |             "maxLength": 1000,
  ./c/t/schemathesis_tests+test-fuzzer-api |             "minLength": 1,
  ./c/t/schemathesis_tests+test-fuzzer-api |             "pattern": "^[0-9a-zA-Z].*$"
  ./c/t/schemathesis_tests+test-fuzzer-api |         }
  
  ./c/t/schemathesis_tests+test-fuzzer-api |     Value:
  
  ./c/t/schemathesis_tests+test-fuzzer-api |         null
  
  ./c/t/schemathesis_tests+test-fuzzer-api | [422] Unprocessable Entity:
  
  ./c/t/schemathesis_tests+test-fuzzer-api |     `{"detail":[{"loc":null,"msg":"authorization error","type":null}]}`
  
  ./c/t/schemathesis_tests+test-fuzzer-api | Reproduce with: 
  
  ./c/t/schemathesis_tests+test-fuzzer-api |     curl -X GET -H 'X-API-Key: [Filtered]' http://0.0.0.0:3030/api/v1/health/ready
  ./c/t/schemathesis_tests+test-fuzzer-api | 
  ./c/t/schemathesis_tests+test-fuzzer-api | ___________________________ GET /api/v1/health/live ____________________________
  ./c/t/schemathesis_tests+test-fuzzer-api | 1. Test Case ID: mRAw7c
  ./c/t/schemathesis_tests+test-fuzzer-api | 
  ./c/t/schemathesis_tests+test-fuzzer-api | - Undocumented HTTP status code
  ./c/t/schemathesis_tests+test-fuzzer-api | 
  ./c/t/schemathesis_tests+test-fuzzer-api |     Received: 400
  ./c/t/schemathesis_tests+test-fuzzer-api |     Documented: 422, 403, 429, 401, 503, 204, 500
  
  ./c/t/schemathesis_tests+test-fuzzer-api | [400] Bad Request:
  
  ./c/t/schemathesis_tests+test-fuzzer-api | Reproduce with: 
  
  ./c/t/schemathesis_tests+test-fuzzer-api |     curl -X GET -H 'X-API-Key: [Filtered]' http://0.0.0.0:3030/api/v1/health/live
  ./c/t/schemathesis_tests+test-fuzzer-api | 
  ./c/t/schemathesis_tests+test-fuzzer-api | 2. Test Case ID: FWwXEp
  ./c/t/schemathesis_tests+test-fuzzer-api | 
  ./c/t/schemathesis_tests+test-fuzzer-api | - Response violates schema
  ./c/t/schemathesis_tests+test-fuzzer-api | 
  ./c/t/schemathesis_tests+test-fuzzer-api |     None is not of type 'string'
  
  ./c/t/schemathesis_tests+test-fuzzer-api |     Schema at /properties/detail/items/properties/type:
  
  ./c/t/schemathesis_tests+test-fuzzer-api |         {
  ./c/t/schemathesis_tests+test-fuzzer-api |             "type": "string",
  ./c/t/schemathesis_tests+test-fuzzer-api |             "format": "error",
  ./c/t/schemathesis_tests+test-fuzzer-api |             "title": "Error Message",
  ./c/t/schemathesis_tests+test-fuzzer-api |             "description": "The type of error",
  ./c/t/schemathesis_tests+test-fuzzer-api |             "example": "An error has occurred, the details of the error are ...",
  ./c/t/schemathesis_tests+test-fuzzer-api |             "maxLength": 1000,
  ./c/t/schemathesis_tests+test-fuzzer-api |             "minLength": 1,
  ./c/t/schemathesis_tests+test-fuzzer-api |             "pattern": "^[0-9a-zA-Z].*$"
  ./c/t/schemathesis_tests+test-fuzzer-api |         }
  
  ./c/t/schemathesis_tests+test-fuzzer-api |     Value:
  
  ./c/t/schemathesis_tests+test-fuzzer-api |         null
  
  ./c/t/schemathesis_tests+test-fuzzer-api | [422] Unprocessable Entity:
  
  ./c/t/schemathesis_tests+test-fuzzer-api |     `{"detail":[{"loc":null,"msg":"authorization error","type":null}]}`
  
  ./c/t/schemathesis_tests+test-fuzzer-api | Reproduce with: 
  
  ./c/t/schemathesis_tests+test-fuzzer-api |     curl -X GET -H 'X-API-Key: [Filtered]' http://0.0.0.0:3030/api/v1/health/live

Anything else?

full logs at https://cloud.earthly.dev/builds/4f5e0821-084e-4268-9235-6f00771e79ef

Code of Conduct

  • I agree to follow this project's Code of Conduct
@kukkok3 kukkok3 added the bug Something isn't working label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: New
Development

No branches or pull requests

1 participant