molnarg / node-http2

An HTTP/2 client and server implementation for node.js
MIT License
1.79k stars 187 forks source link

Cross talk between tests #162

Open akc42 opened 8 years ago

akc42 commented 8 years ago

I have put together a fix for the issue raised in #161 and am now trying to build some tests.

What I have discovered is, is there is cross talk between the tests. When the server is created on local host port 1234, the simple server.close() call is not actually fully destroying the server, so if the timing is off, the test that follows fails.

I think the reason is open connections, but I am not entirely sure. I have tried using the server-destroy module but it isn't solving the problem - then the test that follows times out - indicating that response.on('data' ...) is not firing.

akc42 commented 8 years ago

I have skirted this issue in the tests I created to fix #161 by using a different port number. I think it must be the use of a global agent, but I don't understand it enough to suggest any change. I originally changed by test to use port 1235 but then the server.push test was failing because the response to the original get request in that test was the response I had posted in my test way earlier in the cycle. In the end I just moved to another port (1236) but that seems a fragile approach.