]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - scripts/clean/server/test.sh
Remove unused gitlab ci env variables
[github/Chocobozzz/PeerTube.git] / scripts / clean / server / test.sh
1 #!/bin/sh
2
3 set -eu
4
5 recreateDB () {
6 dbname="peertube_test$1"
7
8 dropdb --if-exists "$dbname" 2>&1
9
10 createdb -O peertube "$dbname"
11 psql -c "CREATE EXTENSION pg_trgm;" "$dbname" &
12 psql -c "CREATE EXTENSION unaccent;" "$dbname" &
13 }
14
15 removeFiles () {
16 rm -rf "./test$1" "./config/local-test.json" "./config/local-test-$1.json" ~/.config/PeerTube/CLI-$1
17 }
18
19 dropRedis () {
20 port=$((9000+$1))
21 host="localhost"
22
23 redis-cli -h "$host" KEYS "bull-localhost:$port*" | grep -v empty | xargs --no-run-if-empty redis-cli -h "$host" DEL
24 redis-cli -h "$host" KEYS "redis-localhost:$port*" | grep -v empty | xargs --no-run-if-empty redis-cli -h "$host" DEL
25 redis-cli -h "$host" KEYS "*redis-localhost:$port-" | grep -v empty | xargs --no-run-if-empty redis-cli -h "$host" DEL
26 }
27
28 seq=$(seq 1 6)
29
30 if [ ! -z ${1+x} ]; then
31 seq=$1
32 fi
33
34
35 for i in $seq; do
36 recreateDB "$i" &
37 dropRedis "$i" &
38 removeFiles "$i" &
39 done
40
41 wait