diff --git a/src/freedombone-tests b/src/freedombone-tests index 191e5ca9..83f07c81 100755 --- a/src/freedombone-tests +++ b/src/freedombone-tests @@ -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'