Parallel tests

Jim Meyering jim at meyering.net
Tue Oct 5 21:57:22 UTC 2010


Jeff Darcy wrote:
> I looked into this a bit after it came up on IRC.  The reason it's
> failing is that the two mongod instances are using the same port.
> They're also using the same directory, which I think is *a* problem but
> not *the* problem.  In any case, here's a diff (on top of my
> replication-test patch) which shows how to make things behave.
>
> diff --git a/t/replication b/t/replication
> index 7f311e7..5299a71 100644
> --- a/t/replication
> +++ b/t/replication
> @@ -3,11 +3,11 @@
>
>  . "${srcdir=.}/init.sh"; path_prepend_ ..
>
> -mkdir mongod fs_upstream fs_downstream || framework_failure_ mkdir failed
> +mkdir mongod2 fs_upstream fs_downstream || framework_failure_ mkdir failed

Changing this directory name is not needed, since init.sh ensures that
each test is run in a uniquely-named temporary directory.

> -mongod --pidfilepath mongod/pid --dbpath mongod > mongod.log 2>&1 &
> +mongod --port 27018 --dbpath mongod2 > mongod.log 2>&1 &

Perfect.  That solves the problem.
Please factor out that new port number, say m_port=27018
Otherwise, it's too easy to accidentally change only one or two of the 3 uses.

Thanks!

>  mongo_pid=$!
>  cleanup_() { kill $mongo_pid; sleep 3; }
>
> @@ -24,7 +24,7 @@ cat > iwhd_u.cfg << EOF
>  EOF
>
>  port=9092
> -iwhd -v -p $port -c iwhd_u.cfg &
> +iwhd -v -p $port -c iwhd_u.cfg -d localhost:27018 &
>  iwhd_pid=$!
>  wait_for .1 30 "curl http://localhost:$port" \
>         || framework_failure_ "iwhd upstream"
> @@ -37,7 +37,7 @@ cat > iwhd_d.cfg << EOF
>  EOF
>
>  d_port=9093
> -iwhd -v -p $d_port -c iwhd_d.cfg &
> +iwhd -v -p $d_port -c iwhd_d.cfg -d localhost:27018 &
>  iwhd_d_pid=$!
>  wait_for .1 30 "curl http://localhost:$d_port" \
>         || framework_failure_ "iwhd downstream"


More information about the iwhd-devel mailing list