diff --git a/README.md b/README.md index 0477f3485..8cae42aab 100644 --- a/README.md +++ b/README.md @@ -76,8 +76,8 @@ Install NodeJS 4.2: [https://nodejs.org/en/download/package-manager/#debian-and- ### Test with 3 fresh nodes - $ scripts/clean_test.sh - $ scripts/run_servers.sh + $ bin/clean_test.sh + $ bin/run_servers.sh Then you will can access to the three nodes at `http://localhost:900{1,2,3}`. If you call "make friends" on `http://localhost:9002`, the pod 2 and 3 will become friends. Then if you call "make friends" on `http://localhost:9001` it will become friend with the pod 2 and 3 (check the configuration files). Then the pod will communicate with each others. If you add a video on the pod 3 you'll can see it on the pod 1 and 2 :) diff --git a/bin/clean_test.sh b/bin/clean_test.sh new file mode 100755 index 000000000..ef146e091 --- /dev/null +++ b/bin/clean_test.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +basePath=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) + +for i in $(seq 1 6); do + printf "use peertube-test%s;\ndb.dropDatabase();" "$i" | mongo + rm -rf "$basePath/../test$i" +done diff --git a/bin/run_servers.sh b/bin/run_servers.sh new file mode 100755 index 000000000..83768178c --- /dev/null +++ b/bin/run_servers.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +if [ ! -f server.js ]; then + echo "The script has to be executed at the root of the project." + exit -1 +fi + +NODE_ENV=test NODE_APP_INSTANCE=1 node server.js & +sleep 1 +NODE_ENV=test NODE_APP_INSTANCE=2 node server.js & +sleep 1 +NODE_ENV=test NODE_APP_INSTANCE=3 node server.js &