mirror of
https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker.git
synced 2025-09-13 16:49:50 +00:00
Improve Formatting & Commenting Tests 1-2
This commit is contained in:
parent
908bdd99f3
commit
a7e94b6023
4 changed files with 24 additions and 49 deletions
|
@ -64,15 +64,15 @@ resetNginx () {
|
|||
echo "${bold}${green}------------------------------------------------"
|
||||
echo "${bold}${green}Disable any User Whitelisting and set to Default"
|
||||
echo "${bold}${green}------------------------------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
sudo cp ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/blacklist-user-agents-none.conf /usr/local/nginx/bots.d/blacklist-user-agents.conf
|
||||
}
|
||||
|
||||
reloadNginX () {
|
||||
printf "\n"
|
||||
echo "${bold}${green}---------------"
|
||||
echo "${bold}${green}Reloading Nginx"
|
||||
echo "${bold}${green}---------------"
|
||||
printf "\n\n"
|
||||
sudo nginx -t && sudo nginx -s reload
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ waitforReload () {
|
|||
echo "${bold}${yellow}-----------------------------------------------------------------------"
|
||||
echo "${bold}${yellow}Sleeping for 10 seconds to allow Nginx to Properly Reload inside Travis"
|
||||
echo "${bold}${yellow}-----------------------------------------------------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
sleep 10s
|
||||
}
|
||||
|
||||
|
@ -224,11 +224,10 @@ shuf -n 10 ${TRAVIS_BUILD_DIR}/_generator_lists/bad-user-agents.list > ${TRAVIS_
|
|||
sed 's/\\//g' ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-test-quick.tmp > ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-test-quick.list
|
||||
sudo rm ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-test-quick.tmp
|
||||
sort -u ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-test-quick.list -o ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-test-quick.list
|
||||
printf "\n\n"
|
||||
echo "${bold}${magenta}---------------------------"
|
||||
echo "${bold}${magenta}Testing 10 Random Bad Bots"
|
||||
echo "${bold}${magenta}---------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
IFS=$'\n'
|
||||
file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-test-quick.list
|
||||
lines=$(cat ${file})
|
||||
|
@ -245,11 +244,10 @@ IFS=""
|
|||
|
||||
testGoodUserAgents () {
|
||||
sed 's/\\//g' ${TRAVIS_BUILD_DIR}/_generator_lists/good-user-agents.list > ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/good-bots-for-test.list
|
||||
printf "\n\n"
|
||||
echo "${bold}${magenta}---------------------"
|
||||
echo "${bold}${magenta}Testing All Good Bots"
|
||||
echo "${bold}${magenta}---------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
IFS=$'\n'
|
||||
file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/good-bots-for-test.list
|
||||
lines=$(cat ${file})
|
||||
|
@ -266,11 +264,10 @@ IFS=""
|
|||
|
||||
testAllowedUserAgents () {
|
||||
sed 's/\\//g' ${TRAVIS_BUILD_DIR}/_generator_lists/allowed-user-agents.list > ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/allowed-bots-for-test.list
|
||||
printf "\n\n"
|
||||
echo "${bold}${magenta}------------------------"
|
||||
echo "${bold}${magenta}Testing All Allowed Bots"
|
||||
echo "${bold}${magenta}------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
IFS=$'\n'
|
||||
file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/allowed-bots-for-test.list
|
||||
lines=$(cat ${file})
|
||||
|
@ -287,11 +284,10 @@ IFS=""
|
|||
|
||||
testLimitedUserAgents () {
|
||||
sed 's/\\//g' ${TRAVIS_BUILD_DIR}/_generator_lists/limited-user-agents.list > ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/limited-bots-for-test.list
|
||||
printf "\n\n"
|
||||
echo "${bold}${magenta}------------------------"
|
||||
echo "${bold}${magenta}Testing All Limited Bots"
|
||||
echo "${bold}${magenta}------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
IFS=$'\n'
|
||||
file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/limited-bots-for-test.list
|
||||
lines=$(cat ${file})
|
||||
|
@ -309,11 +305,10 @@ IFS=""
|
|||
testRandomReferrers () {
|
||||
shuf -n 10 ${TRAVIS_BUILD_DIR}/_generator_lists/bad-referrers.list > ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-referrers-for-test-quick.list
|
||||
sort -u ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-referrers-for-test-quick.list -o ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-referrers-for-test-quick.list
|
||||
printf "\n\n"
|
||||
echo "${bold}${magenta}---------------------------------"
|
||||
echo "${bold}${magenta}Testing 10 Random Bad Referrers"
|
||||
echo "${bold}${magenta}---------------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
IFS=$'\n'
|
||||
file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-referrers-for-test-quick.list
|
||||
lines=$(cat ${file})
|
||||
|
@ -329,11 +324,10 @@ IFS=""
|
|||
}
|
||||
|
||||
testGoodReferrers () {
|
||||
printf "\n\n"
|
||||
echo "${bold}${magenta}----------------------"
|
||||
echo "${bold}${magenta}Testing Good Referrers"
|
||||
echo "${bold}${magenta}----------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
IFS=$'\n'
|
||||
file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/good-referrers-for-test.list
|
||||
lines=$(cat ${file})
|
||||
|
@ -355,7 +349,7 @@ IFS=""
|
|||
echo "${bold}${green}--------------"
|
||||
echo "${bold}${green}Tests Starting"
|
||||
echo "${bold}${green}--------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
|
||||
resetNginx
|
||||
reloadNginX
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue