haraka / Haraka

A fast, highly extensible, and event driven SMTP server
https://haraka.github.io
MIT License
5.02k stars 662 forks source link

running rcpt_to.routes test hangs without redis running on localhost #1290

Closed chazomaticus closed 8 years ago

chazomaticus commented 8 years ago

I just pulled a fresh clone of haraka and tried to ./run_tests. I get the following error, after a timeout:

rcpt_to.routes
✔ rcpt_file - miss
✔ rcpt_file - hit
[Error: invalid STUN result]
✔ get_public_ip - normal

FAILURES: Undone tests (or their setups/teardowns): 
- rcpt_redis - miss

If I run just ./run_tests tests/plugins/rcpt_to.routes.js it just hangs after the first two tests pass.

After doing a little debugging, I'm seeing the error handler on the redis client (https://github.com/haraka/Haraka/blob/master/plugins/rcpt_to.routes.js#L166-L169) get called multiple times. The error message is Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED.

Is running a local redis server required to be able to run the tests (I'm not running one)? Is that error spurious, and I'm doing something else dumb?

Dexus commented 8 years ago

Redis is a optional dep.

If no redis is running, the test will except 0 and call test done.

If you using plugins in live mode that need redis it will not work.

Can you give some more details to your test env? Nodejs Version, OS etc?

Am 06.01.2016 um 02:33 schrieb Charles Lindsay notifications@github.com:

I just pulled a fresh clone of haraka and tried to /run_tests I get the following error, after a timeout:

rcpt_toroutes ✔ rcpt_file - miss ✔ rcpt_file - hit [Error: invalid STUN result] ✔ get_public_ip - normal

FAILURES: Undone tests (or their setups/teardowns):

  • rcpt_redis - miss If I run just /run_tests tests/plugins/rcpt_toroutesjs it just hangs after the first two tests pass

After doing a little debugging, I'm seeing the error handler on the redis client (https://githubcom/haraka/Haraka/blob/master/plugins/rcpt_toroutesjs#L166-L169) get called multiple times The error message is Redis connection to 127001:6379 failed - connect ECONNREFUSED

Is running a local redis server required to be able to run the tests (I'm not running one)? Is that error spurious, and I'm doing something else dumb?

— Reply to this email directly or view it on GitHub.

chazomaticus commented 8 years ago
$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.3 LTS"
$ uname -srvp
Linux 3.13.0-74-generic #118-Ubuntu SMP Thu Dec 17 22:52:10 UTC 2015 x86_64
$ /usr/bin/env node --version
v0.10.37
$ time ./run_tests tests/plugins/rcpt_to.routes.js 
Running tests:  [ 'tests/plugins/rcpt_to.routes.js' ]

rcpt_to.routes.js
✔ rcpt_file - miss
✔ rcpt_file - hit
^C

real    0m44.493s
user    0m0.234s
sys 0m0.013s

Running under strace shows a number of connections to 127.0.0.1:6379 being opened and quickly closed, then it'll wait a bit, then repeat. Doesn't seem to be doing anything else other than trying repeatedly to connect to redis.

msimerson commented 8 years ago

The introduction of redis to haraka's optionalDependencies section of package.json means that now, rcpt_to.routes detects that redis is installed and so consequently tries to use and test against it. I'll work on a PR to handle this better.