From c953bad4230f7210b12c1daff83010e4f3915c6c Mon Sep 17 00:00:00 2001 From: Mitchell Krog Date: Wed, 28 Jun 2017 15:03:35 +0200 Subject: [PATCH] Test new Travis CI curl testing script --- .travis.yml | 1 + travisCI/install-nginx.sh | 1 + travisCI/run-curl-tests.sh | 17 +++++++++++++++++ 3 files changed, 19 insertions(+) create mode 100755 travisCI/run-curl-tests.sh diff --git a/.travis.yml b/.travis.yml index 00b73d9a8..237320c6a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,6 +41,7 @@ script: - STATUSCODE=$(curl -A "masscan" http://localhost:9000/index.php &> /dev/stderr --write-out "%{http_code}") | if test $STATUSCODE 52; then exit 0; fi - STATUSCODE=$(curl -I http://localhost:9000/index.php -e http://100dollars-seo.com &> /dev/stderr --write-out "%{http_code}") | if test $STATUSCODE 52; then exit 0; fi - STATUSCODE=$(curl -I http://localhost:9000/index.php -e http://zx6.ru &> /dev/stderr --write-out "%{http_code}") | if test $STATUSCODE 52; then exit 0; fi + - travisCI/run-curl-tests.sh - travisCI/modify-files-and-commit.sh before_deploy: diff --git a/travisCI/install-nginx.sh b/travisCI/install-nginx.sh index 6be6b1727..1cd69141f 100755 --- a/travisCI/install-nginx.sh +++ b/travisCI/install-nginx.sh @@ -115,6 +115,7 @@ sudo chmod +x $TRAVIS_BUILD_DIR/travisCI/generate-google-disavow.sh sudo chmod +x $TRAVIS_BUILD_DIR/travisCI/generate-google-exclude.php sudo chmod +x $TRAVIS_BUILD_DIR/travisCI/modify-config-readme-files.sh sudo chmod +x $TRAVIS_BUILD_DIR/travisCI/modify-files-and-commit.sh +sudo chmod +x $TRAVIS_BUILD_DIR/travisCI/run-curl-tests.sh # ***************************************************************************************** # Travis now moves into running the rest of the tests in the script: section of .travis.yml diff --git a/travisCI/run-curl-tests.sh b/travisCI/run-curl-tests.sh new file mode 100755 index 000000000..06663378a --- /dev/null +++ b/travisCI/run-curl-tests.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Curl Testing Script for Nginx Ultimate Bad Bot Blocker + +STATUSCODE1=$(curl -A "80legs" http://localhost:9000/index.php &> /dev/stderr --write-out "%{http_code}") | if test $STATUSCODE1 52; then echo "BAD BOT TEST PASSED"; exit 0; else echo "BAD BOT TEST FAILED"; exit 1; fi + +STATUSCODE2=$(curl -A "masscan" http://localhost:9000/index.php &> /dev/stderr --write-out "%{http_code}") | if test $STATUSCODE2 52; then echo "BAD BOT TEST PASSED"; exit 0; else echo "BAD BOT TEST FAILED"; exit 1; fi + +STATUSCODE3=$(curl -I http://localhost:9000/index.php -e http://100dollars-seo.com &> /dev/stderr --write-out "%{http_code}") | if test $STATUSCODE3 52; then echo "BAD BOT TEST PASSED"; exit 0; else echo "BAD BOT TEST FAILED"; exit 1; fi + +STATUSCODE4=$(curl -I http://localhost:9000/index.php -e http://zx6.ru &> /dev/stderr --write-out "%{http_code}") | if test $STATUSCODE4 52; then echo "BAD BOT TEST PASSED"; exit 0; else echo "BAD BOT TEST FAILED"; exit 1; fi + +STATUSCODE5=$(curl -A "GoogleBot" http://localhost:9000/index.php &> /dev/stderr --write-out "%{http_code}") | if test $STATUSCODE5 200; then echo "GOOD BOT TEST PASSED"; exit 0; else echo "GOOD BOT TEST FAILED"; exit 1; fi + +STATUSCODE6=$(curl -A "BingBot" http://localhost:9000/index.php &> /dev/stderr --write-out "%{http_code}") | if test $STATUSCODE6 200; then echo "GOOD BOT TEST PASSED"; exit 0; else echo "GOOD BOT TEST FAILED"; exit 1; fi + +exit 0 +done