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] TypeError #2219

Closed
3 tasks done
obscurebyron opened this issue May 29, 2024 · 4 comments · Fixed by #2223
Closed
3 tasks done

[BUG] TypeError #2219

obscurebyron opened this issue May 29, 2024 · 4 comments · Fixed by #2223
Assignees
Labels
Priority: Medium Planned for regular releases Type: Bug Errors or unexpected behavior

Comments

@obscurebyron
Copy link

obscurebyron commented May 29, 2024

Checklist

  • I checked the FAQ section of the documentation
  • I looked for similar issues in the issue tracker
  • I am using the latest version of Schemathesis

Describe the bug

Occasionally, while running against our API, we'll see an internal error reported, which follows.

To Reproduce

🚨 Mandatory 🚨: Steps to reproduce the behavior:

  1. Our code is private, I am disallowed to provide detailed steps. But this is the command we run:
st run --checks all https://turkey.spicedchai.com/woowoo/openapi.json \
--experimental=openapi-3.1 \
-H 'jwt: .JWT_CONTENT_HERE.' \
-H "foo: BAR" \
--show-trace  \
--base-url=https://turkey.spicedchai.com/woowoo  \
-M GET \
--request-timeout 100

Expected behavior

Ordinary run, with negative cases reported

Actual behavior

Schemathesis crashes with a stack trace

Environment

- OS: Apple M1 Pro 
- Python version: 3.11
- Schemathesis version: 3.28.1
- Spec version: [e.g. Open API 3.1]

Additional context

Schema location: https://turkey.spicedchai.com/woowoo/openapi.json
Base URL: https://turkey.spicedchai.com/woowoo
Specification version: Open API 3.1.0
Random seed: 312018194680697670799599384726727557321
Workers: 1
Collected API operations: 33
Collected API links: 0
API probing: SUCCESS
Schema analysis: SKIP

GET /woowoo/api/user F                                                                                                                                                                                                                                                                                                                                                  [  3%]
GET /woowoo/api/user/profile F                                                                                                                                                                                                                                                                                                                                          [  6%]
GET /woowoo/api/user/me .                                                                                                                                                                                                                                                                                                                                               [  9%]
GET /woowoo/api/user/banana/count .                                                                                                                                                                                                                                                                                                                               [ 12%]
GET /woowoo/api/user/profile/{identifier} F                                                                                                                                                                                                                                                                                                                             [ 15%]
GET /woowoo/api/user/{identifier} F                                                                                                                                                                                                                                                                                                                                     [ 18%]
GET /woowoo/api/file/metadata .                                                                                                                                                                                                                                                                                                                                         [ 21%]
GET /woowoo/api/file/metadata/{identifier} Test Execution Error

An internal error occurred during the test run

    Traceback (most recent call last):
      File "/Users/foobar/dev/work/yippee/chunkymonkey/my-application/.venv/lib/python3.11/site-packages/schemathesis/cli/__init__.py", line 1110, in into_event_stream
        yield from runner.from_schema(
      File "/Users/foobar/dev/work/yippee/chunkymonkey/my-application/.venv/lib/python3.11/site-packages/schemathesis/runner/impl/core.py", line 194, in _generate_events
        yield from self._execute(results, stop_event)
      File "/Users/foobar/dev/work/yippee/chunkymonkey/my-application/.venv/lib/python3.11/site-packages/schemathesis/runner/impl/solo.py", line 24, in _execute
        for event in self._execute_impl(results):
      File "/Users/foobar/dev/work/yippee/chunkymonkey/my-application/.venv/lib/python3.11/site-packages/schemathesis/runner/impl/solo.py", line 32, in _execute_impl
        yield from self._run_tests(
      File "/Users/foobar/dev/work/yippee/chunkymonkey/my-application/.venv/lib/python3.11/site-packages/schemathesis/runner/impl/core.py", line 255, in _run_tests
        for event in run_test(
      File "/Users/foobar/dev/work/yippee/chunkymonkey/my-application/.venv/lib/python3.11/site-packages/schemathesis/runner/impl/core.py", line 560, in run_test
        yield events.AfterExecution.from_result(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/foobar/dev/work/yippee/chunkymonkey/my-application/.venv/lib/python3.11/site-packages/schemathesis/runner/events.py", line 198, in from_result
        result=SerializedTestResult.from_test_result(result),
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/foobar/dev/work/yippee/chunkymonkey/my-application/.venv/lib/python3.11/site-packages/schemathesis/runner/serialization.py", line 436, in from_test_result
        errors=[SerializedError.from_exception(error) for error in result.errors],
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/foobar/dev/work/yippee/chunkymonkey/my-application/.venv/lib/python3.11/site-packages/schemathesis/runner/serialization.py", line 436, in <listcomp>
        errors=[SerializedError.from_exception(error) for error in result.errors],
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/foobar/dev/work/yippee/chunkymonkey/my-application/.venv/lib/python3.11/site-packages/schemathesis/runner/serialization.py", line 250, in from_exception
        message, extras = extract_requests_exception_details(exception)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/foobar/dev/work/yippee/chunkymonkey/my-application/.venv/lib/python3.11/site-packages/schemathesis/exceptions.py", line 555, in extract_requests_exception_details
        if ":" not in inner.reason.args[0]:
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    TypeError: argument of type 'HTTPConnection' is not iterable

Here is the portion of the openapi.json relating to the endpoint that failed:

 "/api/file/metadata/{identifier}": {
      "get": {
        "tags": [
          "file"
        ],
        "summary": "Retrieve File",
        "description": "(U) Get file metadata.",
        "operationId": "retrieve_file_api_file_metadata__identifier__get",
        "parameters": [
          {
            "name": "identifier",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Identifier"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileResponseModel"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
@obscurebyron obscurebyron added Status: Needs Triage Requires initial assessment to categorize and prioritize Type: Bug Errors or unexpected behavior labels May 29, 2024
@Stranger6667
Copy link
Member

Thank you for reporting,

It is indeed an issue. I don't have the time right now (as I am working on #2207 right now) but I will take a look at it as soon as possible.

@Stranger6667 Stranger6667 added Priority: Medium Planned for regular releases and removed Status: Needs Triage Requires initial assessment to categorize and prioritize labels May 30, 2024
Stranger6667 added a commit that referenced this issue May 30, 2024
…elated issues

Ref: #2219

Signed-off-by: Dmitry Dygalo <dmitry@dygalo.dev>
Stranger6667 added a commit that referenced this issue May 30, 2024
…elated issues

Ref: #2219

Signed-off-by: Dmitry Dygalo <dmitry@dygalo.dev>
@Stranger6667
Copy link
Member

The fix is released in 3.29.0 🎉

@obscurebyron
Copy link
Author

Great news! Much appreciated!

@Stranger6667
Copy link
Member

Cool! Let me know if there is anything else I can help with :) Btw, there was a small patch release - 3.29.1 (missed a performance in stateful tests)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Medium Planned for regular releases Type: Bug Errors or unexpected behavior
Projects
None yet
2 participants