-
Notifications
You must be signed in to change notification settings - Fork 32
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
Mock Server Isn't Closing Before The Next One #138
Comments
Possibly a race condition. I just ran the tests and didn't see the error. However, I have seen this error before. I "fixed" it by changing the hostnames and ports ;P. Might be worth looking into running a single server instance for a test suite, but I like the fact that different server instances with different configs can be created for each test in a test suite. |
The worst kind of bugs... is there a method on |
FYI should note the race condition seems to be between the tests 'server/resource: wrong CSRF token' and 'server/resource: user is not an admin', as seen below:
|
we could look into using |
This is all kinds of messed up now with |
Only way i've managed to fix tests is using this approach, by having each server running on different ports. I've seen Deno so the same in some examples but I haven't found a current file that does this (yet). Also think the problem with having a single test server instance is responses - I know in |
@crookse Isn't this 'technicallly' solved now? In the sense Drash's test don't have this error anymore due to the restructure of the tests? Just wondering if it could be closed now |
@ebebbington , that seems to be the case. Closing this. Thanks! |
Describe the bug
A test doesn't seem to close the mock server, so it fails when running the next test as the address is in use, see below for the error:
It passes the first test, and fails the second, which helps confirm the server hasn't actually closed yet
To Reproduce
Steps to reproduce the behavior:
deno test --allow-env --allow-net .\tests\unit\http\middleware_test.ts
3.. See error
Expected behavior
Tests should be able to run after one another and the mock server should be closed before running the next text (which is also creating a mock server)
Suggested Solution(s)
Couldn't say, maybe there's a race condition or
server.deno_server.close();
isn't working as expectedDesktop (please complete the following information):
Additional context
Disocvered this problem whilst developing the solution to issue #115 types for all members when I tried testing. I tested on a branch without any of my changes and the error still showed
The text was updated successfully, but these errors were encountered: