From 2e9b584a0fec5bf512a71c97f89baf40a50890ce Mon Sep 17 00:00:00 2001 From: Mitchell Krog Date: Wed, 26 Jun 2019 11:06:41 +0200 Subject: [PATCH] IMPROVE Rate Limiting Test REF: #175 --- .dev-tools/test-blocker-whitelist.sh | 37 +++++++++++++------------ .dev-tools/test_units/ratelimittest.txt | 0 2 files changed, 19 insertions(+), 18 deletions(-) create mode 100644 .dev-tools/test_units/ratelimittest.txt diff --git a/.dev-tools/test-blocker-whitelist.sh b/.dev-tools/test-blocker-whitelist.sh index b4f9d0301..c930cb3c1 100755 --- a/.dev-tools/test-blocker-whitelist.sh +++ b/.dev-tools/test-blocker-whitelist.sh @@ -261,24 +261,25 @@ echo "${bold}${yellow}---------------------------------------------------------- printf "\n\n" sleep 10s -if -curl -A "GoogleBot" http://localhost:9000 2>&1 & -curl -A "GoogleBot" http://localhost:9000 2>&1 & -curl -A "GoogleBot" http://localhost:9000 2>&1 & -curl -A "GoogleBot" http://localhost:9000 2>&1 & -curl -A "GoogleBot" http://localhost:9000 2>&1 & -curl -A "GoogleBot" http://localhost:9000 2>&1 & -curl -A "GoogleBot" http://localhost:9000 2>&1 & -curl -A "GoogleBot" http://localhost:9000 2>&1 & -curl -A "GoogleBot" http://localhost:9000 2>&1 & -curl -A "GoogleBot" http://localhost:9000 2>&1 & -curl -A "GoogleBot" http://localhost:9000 2>&1 & -curl -A "GoogleBot" http://localhost:9000 2>&1 & -curl -A "GoogleBot" http://localhost:9000 2>&1 & -curl -A "GoogleBot" http://localhost:9000 2>&1 & -curl -A "GoogleBot" http://localhost:9000 2>&1 & -curl -A "GoogleBot" http://localhost:9000 2>&1 & -curl -A "GoogleBot" http://localhost:9000 2>&1 | grep -i 'Unavailable'; then +ratelimittestfile=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/ratelimittest.txt +truncate -s 0 ${ratelimittestfile} +curl -A "GoogleBot" http://localhost:9000 2>&1 > ${ratelimittestfile} & +curl -A "GoogleBot" http://localhost:9000 2>&1 >> ${ratelimittestfile} & +curl -A "GoogleBot" http://localhost:9000 2>&1 >> ${ratelimittestfile} & +curl -A "GoogleBot" http://localhost:9000 2>&1 >> ${ratelimittestfile} & +curl -A "GoogleBot" http://localhost:9000 2>&1 >> ${ratelimittestfile} & +curl -A "GoogleBot" http://localhost:9000 2>&1 >> ${ratelimittestfile} & +curl -A "GoogleBot" http://localhost:9000 2>&1 >> ${ratelimittestfile} & +curl -A "GoogleBot" http://localhost:9000 2>&1 >> ${ratelimittestfile} & +curl -A "GoogleBot" http://localhost:9000 2>&1 >> ${ratelimittestfile} & +curl -A "GoogleBot" http://localhost:9000 2>&1 >> ${ratelimittestfile} & +curl -A "GoogleBot" http://localhost:9000 2>&1 >> ${ratelimittestfile} & +curl -A "GoogleBot" http://localhost:9000 2>&1 >> ${ratelimittestfile} & +curl -A "GoogleBot" http://localhost:9000 2>&1 >> ${ratelimittestfile} & +curl -A "GoogleBot" http://localhost:9000 2>&1 >> ${ratelimittestfile} & +curl -A "GoogleBot" http://localhost:9000 2>&1 >> ${ratelimittestfile} + +if grep -i 'Unavailable' < ${ratelimittestfile}; then echo "${bold}${green}PASSED - ${red}GoogleBot was ${bold}${red}RATE LIMITED" else echo "${bold}${red}FAILED - ${red}GoogleBot was ${bold}${red}NOT RATE LIMITED" diff --git a/.dev-tools/test_units/ratelimittest.txt b/.dev-tools/test_units/ratelimittest.txt new file mode 100644 index 000000000..e69de29bb