summaryrefslogtreecommitdiff
path: root/setup-redis-env.sh
blob: fe068da7d272b66ad1e2b0acfc875a852ff7c3a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
set -x -e

function clean_exit(){
    local error_code="$?"
    local spawned=$(jobs -p)
    if [ -n "$spawned" ]; then
        kill $(jobs -p)
    fi
    return $error_code
}

trap "clean_exit" EXIT

redis_bin=$(which redis-server || true)
if [ -n "$redis_bin" ]; then
    $redis_bin --port 6380 &
fi

export TOOZ_TEST_REDIS_URL="redis://localhost:6380?timeout=5"
# Yield execution to venv command
$*