Test that onion ports are unique

This commit is contained in:
Bob Mottram 2016-11-18 11:21:50 +00:00
parent 4324e2d6a5
commit 1f5173d13d
1 changed files with 13 additions and 0 deletions

View File

@ -74,6 +74,18 @@ function test_app_functions {
done
}
function test_unique_onion_ports {
# test that some services are not assigned the same onion port
FILES=src/${PROJECT_NAME}-app-*
ports=$(grep -r "_ONION_PORT=" $FILES | awk -F ':' '{print $2}' | uniq | awk -F '=' '{print $2}')
unique_ports=$(grep -r "_ONION_PORT=" $FILES | awk -F ':' '{print $2}' | uniq | awk -F '=' '{print $2}' | uniq)
if [[ "$ports" != "$unique_ports" ]]; then
echo $'Some onion ports are clashing'
grep -r "_ONION_PORT=" $FILES | awk -F ':' '{print $2}' | uniq
exit 637252
fi
}
while [[ $# > 1 ]]
do
key="$1"
@ -92,6 +104,7 @@ done
echo $'Running tests'
test_app_functions
test_unique_onion_ports
echo $'All tests passed'