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

Allow Deno to clean up leaked test resources #65

Open
spawnia opened this issue Mar 22, 2023 · 1 comment
Open

Allow Deno to clean up leaked test resources #65

spawnia opened this issue Mar 22, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@spawnia
Copy link
Member

spawnia commented Mar 22, 2023

Screenshot

SHOULD use 4xx or 5xx status codes on document validation failure when accepting application/graphql-response+json => ./test.ts:9:8
error: AssertionError: Test case is leaking 1 resource:

 - A fetch response body (rid 380) was created during the test, but not consumed during the test. Consume or close the response body `ReadableStream`, e.g `await resp.text()` or `await resp.body.cancel()`.

    at assert (ext:deno_web/00_infra.js:353:11)
    at resourceSanitizer (ext:cli/40_testing.js:417:5)
    at async Object.exitSanitizer [as fn] (ext:cli/40_testing.js:435:7)
    at async runTest (ext:cli/40_testing.js:840:5)
    at async runTests (ext:cli/40_testing.js:1098:20)

Expected Behaviour

It should be possible to use the server audits in Deno.test() in a way that does not leak resources.

Actual Behaviour

As discussed in #63 (comment), the tests leak resources.
I am not sure why, but the fix I added to the PR now does not work (fully) in my project.

Debug Information

The following run shows what happens without any cleanup: https://github.com/nuwave/lighthouse/actions/runs/4488866245/jobs/7893989167.

With a cleanup step, some portion of the tests is fixed (I think the failing ones), but others still leak: https://github.com/nuwave/lighthouse/actions/runs/4488817464/jobs/7893880714.

Further Information

Here is the link to the PR where I try to run the audit in my project: nuwave/lighthouse#2359.

@spawnia
Copy link
Member Author

spawnia commented Mar 22, 2023

I think this could be fixed by returning the response for both AuditOk and AuditFail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants