HTTP server hangs when mocking time

I’ve run into a particularly fun issue where the Meteor HTTP server seems to stop working if I mock time in a previous test.

I’m relatively certain that the clock was uninstalled correctly but there must be something hanging out.

I have verified that the clock is running by setting up a setInterval that shows time passing on the clock.

But for some reason HTTP.call(‘http://localhost:3000/’) always hangs after the clock was mocked previously.

Any ideas what I might be missing here?

My fallback is to bypass the HTTP server directly and call the Router handler function directly.

I went down quite the rabbit hole checking this one out.

Apparently Meteor has some issues with HTTP requests hanging if you mock time.

I managed to reduce this down to a simple reproduction and filed an issue here: https://github.com/meteor/meteor/issues/8975

In the meantime I am going to separate my server and client tests so that server-side time mocking doesn’t mess up the client side test runs.

1 Like