]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - scripts/clean/server/test.sh
Bumped to version v5.2.1
[github/Chocobozzz/PeerTube.git] / scripts / clean / server / test.sh
... / ...
CommitLineData
1#!/bin/sh
2
3set -eu
4
5recreateDB () {
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
15removeFiles () {
16 rm -rf "./test$1" "./config/local-test.json" "./config/local-test-$1.json" ~/.config/PeerTube/CLI-$1
17}
18
19dropRedis () {
20 port=$((9000+$1))
21 host="127.0.0.1"
22
23 redis-cli -h "$host" KEYS "bull-127.0.0.1:$port*" | grep -v empty | xargs -r redis-cli -h "$host" DEL
24 redis-cli -h "$host" KEYS "redis-127.0.0.1:$port*" | grep -v empty | xargs -r redis-cli -h "$host" DEL
25 redis-cli -h "$host" KEYS "*redis-127.0.0.1:$port-" | grep -v empty | xargs -r redis-cli -h "$host" DEL
26}
27
28seq=$(seq 1 6)
29
30if [ ! -z ${1+x} ]; then
31 seq=$1
32fi
33
34
35for i in $seq; do
36 recreateDB "$i" &
37 dropRedis "$i" &
38 removeFiles "$i" &
39done
40
41wait