-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix(test): close open connections #1911
Conversation
@robertsLando the last test we need to fix to run all test as success all the time is this
Does it necessary to prioritize the order in this |
I also see many times that a test_store folder remains created and empty after failed tests and it could be because of that... my feel is that for some reasons maybe the store folder is the same as the test are spawned in parallel and this creates the error? Maybe adding a more random test folder name could mitigate the issue? Also I think the third publish should be put inside the payload2 publish callback to be 100% sure that the two are sent consecutively |
Creating unique test folder's names for parallel processes will mitigate the issues related of using resource shared, example: in case of a folder was removed before finishing a test that was using the same folder or file. But the test is using I trust more in the correlational issues:
Right now the Also, I don't know if the test needs to work in this way publish3 and publish2 separated, and not publish3 inside publish2. Can I move it without affect the logic? |
I didn't know about that, are you 100% sure of this? I dunno if this should be considered a bug or not on nodejs test suite, I would expext
I didn't wrote that test so sincerly I'm not 100% sure about what was the reason to write it (expecially because I think it should be placed in mqtt-leveldb store package and not here) anyway I would say that it would be more correct and deterministic to put the publish 3 inside publish 2 callback, maybe that's the only missing piece here |
Yes, but with a trick that I could find. The
I think the same, but if there are more tests with a similar logic in their execution like this test we take the risk of if one test fail we will have a correlational issue. |
I think it could be worth try to open an issue on NodeJS repo. cc @mcollina is this something expected?
I know but I don't see so many alternatives right now. I think our best bet is to fix one by one as we see errors like what you are doing now |
This might be a bug in mocha. I don't have much time to investigate minus saying... don't mix promises and callbacks ;). |
@MaximoLiberata Is it just an impression or tests are failing more frequently now then before? |
I moved publish3 into publish2, now the tests always pass and the tests that I modified in this PR will not generate correlational issues if one of them fail. The rest tests might generate correlational issues. |
@robertsLando Could you give more detail about that? they should not fail |
I didn't clean the references of the objects |
Now I pass the references of the objects But I have a question, those reference can't be used before instance Can |
@MaximoLiberata you found a legit bug in the Node test runner - nodejs/node#54151. |
I'm not sure I understood what you mean here, what attribute would you like to watch of |
Thanks @cjihrig, and thanks to @mcollina as I think he has asked you to look at this :) |
@MaximoLiberata I'm doing some changes, hold a bit |
@MaximoLiberata Done, check them out then I think we can merge this :) |
@robertsLando I just adjust the class' documentation and thank for checking and improve the code. Also, Thank @mcollina and @cjihrig for reporting the bug and make a PR to fix it. |
I think some opened connection never close (waiting for the callback) because the test runs very fast and we are call |
Yeah I know, seems now it get stucks on keeepalive tests. Anyway for sure now it's better then before, would you like me to merge this or do you want to try something else? |
I can try to cover the functions
Also, I was trying to execute
|
This change will modify the logic of the initial PR a little bit, so I don't know if adding it in this PR or another. |
@MaximoLiberata Let's merge this IMO and do the changes on another 👍🏼 |
Improve the logic of close open connections when you instance a
serverBuilder
class or open a new connection usingclient
. Call methodassert
interrupts the test and the methodafter
will never called generating that the connections haven't closed yet will still open and other unit test will throw a error likeError: listen EADDRINUSE: address already in use
.This PR also remove the temp folders and files generated by this
test
when failed.