]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - scripts/clean/server/test.sh
Redirect to local route when getting peertube account
[github/Chocobozzz/PeerTube.git] / scripts / clean / server / test.sh
CommitLineData
0e4ffb4b
LA
1#!/bin/sh
2
3set -eu
93534495 4
780daa7e
C
5recreateDB () {
6 dbname="peertube_test$1"
57c36b27
C
7
8 dropdb --if-exists "$dbname"
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
15removeFiles () {
d3e56c0c 16 rm -rf "./test$1" "./config/local-test.json" "./config/local-test-$1.json"
780daa7e
C
17}
18
19dropRedis () {
57cfff78
C
20 port=$((9000+$1))
21
22 redis-cli KEYS "bull-localhost:$port*" | grep -v empty | xargs --no-run-if-empty redis-cli DEL
23 redis-cli KEYS "redis-localhost:$port*" | grep -v empty | xargs --no-run-if-empty redis-cli DEL
24 redis-cli KEYS "*redis-localhost:$port-" | grep -v empty | xargs --no-run-if-empty redis-cli DEL
780daa7e
C
25}
26
210feb6c
C
27seq=$(seq 1 6)
28
29if [ ! -z ${1+x} ]; then
30 seq=$1
31fi
32
33
34for i in $seq; do
780daa7e
C
35 recreateDB "$i" &
36 dropRedis "$i" &
37 removeFiles "$i" &
93534495 38done
780daa7e
C
39
40wait