]>
Commit | Line | Data |
---|---|---|
0e4ffb4b LA |
1 | #!/bin/sh |
2 | ||
3 | set -eu | |
93534495 | 4 | |
780daa7e C |
5 | recreateDB () { |
6 | dbname="peertube_test$1" | |
57c36b27 | 7 | |
2284f202 | 8 | dropdb --if-exists "$dbname" 2>&1 |
b36f41ca | 9 | |
57c36b27 | 10 | createdb -O peertube "$dbname" |
780daa7e C |
11 | psql -c "CREATE EXTENSION pg_trgm;" "$dbname" & |
12 | psql -c "CREATE EXTENSION unaccent;" "$dbname" & | |
13 | } | |
14 | ||
15 | removeFiles () { | |
1a12f66d | 16 | rm -rf "./test$1" "./config/local-test.json" "./config/local-test-$1.json" ~/.config/PeerTube/CLI-$1 |
780daa7e C |
17 | } |
18 | ||
19 | dropRedis () { | |
57cfff78 | 20 | port=$((9000+$1)) |
2284f202 | 21 | host="localhost" |
57cfff78 | 22 | |
2284f202 C |
23 | if [ ! -z ${GITLAB_CI+x} ]; then |
24 | host="redis" | |
25 | fi | |
26 | ||
27 | redis-cli -h "$host" KEYS "bull-localhost:$port*" | grep -v empty | xargs --no-run-if-empty redis-cli -h "$host" DEL | |
28 | redis-cli -h "$host" KEYS "redis-localhost:$port*" | grep -v empty | xargs --no-run-if-empty redis-cli -h "$host" DEL | |
29 | redis-cli -h "$host" KEYS "*redis-localhost:$port-" | grep -v empty | xargs --no-run-if-empty redis-cli -h "$host" DEL | |
780daa7e C |
30 | } |
31 | ||
210feb6c C |
32 | seq=$(seq 1 6) |
33 | ||
34 | if [ ! -z ${1+x} ]; then | |
35 | seq=$1 | |
36 | fi | |
37 | ||
38 | ||
39 | for i in $seq; do | |
780daa7e C |
40 | recreateDB "$i" & |
41 | dropRedis "$i" & | |
42 | removeFiles "$i" & | |
93534495 | 43 | done |
780daa7e C |
44 | |
45 | wait |