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

Unit tests take a while to run #42

Closed
orangejulius opened this issue Apr 12, 2016 · 0 comments · Fixed by #47
Closed

Unit tests take a while to run #42

orangejulius opened this issue Apr 12, 2016 · 0 comments · Fixed by #47
Assignees

Comments

@orangejulius
Copy link
Member

On my machine at least, the unit tests run in about 3 seconds, but then hang for a few minutes before finally returning success. I'm running node 4, but the problem also happens for me with Node 0.12. By commenting out the lines in test/test.js, I've found that it's the tests in resolversFactoryTest.js that are the culprit.

@dianashk dianashk added this to the Testing... Testing milestone Apr 22, 2016
@orangejulius orangejulius self-assigned this May 28, 2016
orangejulius added a commit that referenced this issue Jun 2, 2016
To avoid the overhead of reinitializing HTTP connections when using an
HTTP PIP resolver, we use an HTTP agent with connection keepAlive set to
true.

However, avoiding explicitly closing these connections uses extra
resources on the server (the server will assume the connection is open
after the resolver is done with it's work). This effect is minor but we
might as well fix it.

A more important effect of this change is that it drastically speeds up
our tests! Previously, the HTTP server we created for the tests would
wait for a full 2 minutes after the tests were done before closing the
connection and shutting down. Now that the connection is explicitly
closed by the resolver, the Node process can exit immediately after the
last test is finished! 🏇

See the HTTP [agent.destroy()](https://nodejs.org/api/http.html#http_agent_destroy)
docs for more info.

Fixes #42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants