From 4368778b2f4be04bec9fde03b691bffecb7cac73 Mon Sep 17 00:00:00 2001 From: cytopia Date: Thu, 22 Dec 2022 19:42:33 +0100 Subject: [PATCH] Revert tests --- .../integration-test.sh | 25 +----------- .../integration-test.sh | 32 ++-------------- .../integration-test.sh | 31 ++++----------- .../docker-compose.yml | 1 - .../integration-test.sh | 31 ++------------- .../integration-test.sh | 25 +----------- .../integration-test.sh | 38 +++---------------- .../integration-test.sh | 38 +++---------------- 8 files changed, 30 insertions(+), 191 deletions(-) diff --git a/examples/default-vhost__php-fpm/integration-test.sh b/examples/default-vhost__php-fpm/integration-test.sh index f2f4e7a..13a9bd4 100755 --- a/examples/default-vhost__php-fpm/integration-test.sh +++ b/examples/default-vhost__php-fpm/integration-test.sh @@ -4,38 +4,17 @@ set -e set -u set -o pipefail -while_retry() { - local expect="${1}" - local url="${2}" - local header="${3:-}" - local output - - count=0 - retry=60 - while ! output="$( curl --fail -sS -k -L "${url}" -H "${header}" 2>/dev/null | grep -A 10 "${expect}" )"; do - if [ "${count}" = "${retry}" ]; then - echo "[FAILED] curl --fail -sS -k -L \"${url}\" -H \"${header}\" | grep \"${expect}\"" - curl --fail -sS -k -L "${url}" -H "${header}" | grep -A 10 "${expect}" || true - return 1 - fi - count=$(( count + 1 )) - sleep 1 - done - echo "${output}" -} - docker-compose build docker-compose up -d +sleep 10 -if ! output="$( while_retry '[OK]' "http://localhost:8000" )"; then +if ! curl http://localhost:8000 | grep '[OK]'; then docker-compose logs || true docker-compose stop || true docker-compose rm -f || true - echo "${output}" exit 1 fi docker-compose logs || true docker-compose stop || true docker-compose rm -f || true -echo "${output}" diff --git a/examples/default-vhost__php-fpm__ssl/integration-test.sh b/examples/default-vhost__php-fpm__ssl/integration-test.sh index 9258859..dd41bcd 100755 --- a/examples/default-vhost__php-fpm__ssl/integration-test.sh +++ b/examples/default-vhost__php-fpm__ssl/integration-test.sh @@ -4,47 +4,23 @@ set -e set -u set -o pipefail -while_retry() { - local expect="${1}" - local url="${2}" - local header="${3:-}" - local output - - count=0 - retry=60 - while ! output="$( curl --fail -sS -k -L "${url}" -H "${header}" 2>/dev/null | grep -A 10 "${expect}" )"; do - if [ "${count}" = "${retry}" ]; then - echo "[FAILED] curl --fail -sS -k -L \"${url}\" -H \"${header}\" | grep \"${expect}\"" - curl --fail -sS -k -L "${url}" -H "${header}" | grep -A 10 "${expect}" || true - return 1 - fi - count=$(( count + 1 )) - sleep 1 - done - echo "${output}" -} - docker-compose build docker-compose up -d +sleep 10 -if ! output1="$( while_retry '[OK]' "http://localhost:8000" )"; then +if ! curl http://localhost:8000 | grep '[OK]'; then docker-compose logs || true docker-compose stop || true docker-compose rm -f || true - echo "${output1}" exit 1 fi - -if ! output2="$( while_retry '[OK]' "https://localhost:8443" )"; then +if ! curl -k https://localhost:8443 | grep '[OK]'; then docker-compose logs || true docker-compose stop || true docker-compose rm -f || true - echo "${output2}" exit 1 fi + docker-compose logs || true docker-compose stop || true docker-compose rm -f || true - -echo "${output1}" -echo "${output2}" diff --git a/examples/default-vhost__reverse-proxy__node/integration-test.sh b/examples/default-vhost__reverse-proxy__node/integration-test.sh index f2f4e7a..dd41bcd 100755 --- a/examples/default-vhost__reverse-proxy__node/integration-test.sh +++ b/examples/default-vhost__reverse-proxy__node/integration-test.sh @@ -4,38 +4,23 @@ set -e set -u set -o pipefail -while_retry() { - local expect="${1}" - local url="${2}" - local header="${3:-}" - local output - - count=0 - retry=60 - while ! output="$( curl --fail -sS -k -L "${url}" -H "${header}" 2>/dev/null | grep -A 10 "${expect}" )"; do - if [ "${count}" = "${retry}" ]; then - echo "[FAILED] curl --fail -sS -k -L \"${url}\" -H \"${header}\" | grep \"${expect}\"" - curl --fail -sS -k -L "${url}" -H "${header}" | grep -A 10 "${expect}" || true - return 1 - fi - count=$(( count + 1 )) - sleep 1 - done - echo "${output}" -} - docker-compose build docker-compose up -d +sleep 10 -if ! output="$( while_retry '[OK]' "http://localhost:8000" )"; then +if ! curl http://localhost:8000 | grep '[OK]'; then + docker-compose logs || true + docker-compose stop || true + docker-compose rm -f || true + exit 1 +fi +if ! curl -k https://localhost:8443 | grep '[OK]'; then docker-compose logs || true docker-compose stop || true docker-compose rm -f || true - echo "${output}" exit 1 fi docker-compose logs || true docker-compose stop || true docker-compose rm -f || true -echo "${output}" diff --git a/examples/default-vhost__reverse-proxy__python/docker-compose.yml b/examples/default-vhost__reverse-proxy__python/docker-compose.yml index 9eadfbb..8c359ed 100644 --- a/examples/default-vhost__reverse-proxy__python/docker-compose.yml +++ b/examples/default-vhost__reverse-proxy__python/docker-compose.yml @@ -13,7 +13,6 @@ services: environment: - MAIN_VHOST_BACKEND=conf:rproxy:http:python:3000 - MAIN_VHOST_SSL_TYPE=both - - DEBUG_ENTRYPOINT=4 ports: - "8000:80" - "8443:443" diff --git a/examples/default-vhost__reverse-proxy__python/integration-test.sh b/examples/default-vhost__reverse-proxy__python/integration-test.sh index 2b5a2e0..dd41bcd 100755 --- a/examples/default-vhost__reverse-proxy__python/integration-test.sh +++ b/examples/default-vhost__reverse-proxy__python/integration-test.sh @@ -4,46 +4,23 @@ set -e set -u set -o pipefail -while_retry() { - local expect="${1}" - local url="${2}" - local header="${3:-}" - local output - - count=0 - retry=1200 - printf "[TESTING] %s" "curl --fail -sS -k -L \"${url}\" -H \"${header}\" | grep \"${expect}\" " - while ! output="$( curl --fail -sS -k -L "${url}" -H "${header}" 2>/dev/null | grep -A 10 "${expect}" )"; do - printf "." - if [ "${count}" = "${retry}" ]; then - printf "\\n" - echo "[FAILED] curl --fail -sS -k -L \"${url}\" -H \"${header}\" | grep \"${expect}\"" - curl --fail -sS -k -L "${url}" -H "${header}" | grep -A 10 "${expect}" || true - return 1 - fi - count=$(( count + 1 )) - sleep 1 - done - printf "\\n" - echo "${output}" -} - docker-compose build docker-compose up -d +sleep 10 -if ! while_retry '[OK]' "http://localhost:8000"; then +if ! curl http://localhost:8000 | grep '[OK]'; then docker-compose logs || true docker-compose stop || true docker-compose rm -f || true exit 1 fi - -if ! while_retry '[OK]' "https://localhost:8443"; then +if ! curl -k https://localhost:8443 | grep '[OK]'; then docker-compose logs || true docker-compose stop || true docker-compose rm -f || true exit 1 fi + docker-compose logs || true docker-compose stop || true docker-compose rm -f || true diff --git a/examples/default-vhost__static-files/integration-test.sh b/examples/default-vhost__static-files/integration-test.sh index f2f4e7a..13a9bd4 100755 --- a/examples/default-vhost__static-files/integration-test.sh +++ b/examples/default-vhost__static-files/integration-test.sh @@ -4,38 +4,17 @@ set -e set -u set -o pipefail -while_retry() { - local expect="${1}" - local url="${2}" - local header="${3:-}" - local output - - count=0 - retry=60 - while ! output="$( curl --fail -sS -k -L "${url}" -H "${header}" 2>/dev/null | grep -A 10 "${expect}" )"; do - if [ "${count}" = "${retry}" ]; then - echo "[FAILED] curl --fail -sS -k -L \"${url}\" -H \"${header}\" | grep \"${expect}\"" - curl --fail -sS -k -L "${url}" -H "${header}" | grep -A 10 "${expect}" || true - return 1 - fi - count=$(( count + 1 )) - sleep 1 - done - echo "${output}" -} - docker-compose build docker-compose up -d +sleep 10 -if ! output="$( while_retry '[OK]' "http://localhost:8000" )"; then +if ! curl http://localhost:8000 | grep '[OK]'; then docker-compose logs || true docker-compose stop || true docker-compose rm -f || true - echo "${output}" exit 1 fi docker-compose logs || true docker-compose stop || true docker-compose rm -f || true -echo "${output}" diff --git a/examples/mass-vhost__php-fpm__ssl/integration-test.sh b/examples/mass-vhost__php-fpm__ssl/integration-test.sh index 0a803cb..5b098c1 100755 --- a/examples/mass-vhost__php-fpm__ssl/integration-test.sh +++ b/examples/mass-vhost__php-fpm__ssl/integration-test.sh @@ -4,64 +4,36 @@ set -e set -u set -o pipefail -while_retry() { - local expect="${1}" - local url="${2}" - local header="${3:-}" - local output - - count=0 - retry=60 - while ! output="$( curl --fail -sS -k -L "${url}" -H "${header}" 2>/dev/null | grep -A 10 "${expect}" )"; do - if [ "${count}" = "${retry}" ]; then - echo "[FAILED] curl --fail -sS -k -L \"${url}\" -H \"${header}\" | grep \"${expect}\"" - curl --fail -sS -k -L "${url}" -H "${header}" | grep -A 10 "${expect}" || true - return 1 - fi - count=$(( count + 1 )) - sleep 1 - done - echo "${output}" -} - docker-compose build docker-compose up -d +sleep 10 -if ! output1="$( while_retry '[OK]' "http://localhost:8000" "Host:sample.loc" )"; then +if ! curl http://localhost:8000 -H 'Host:sample.loc' | grep '[OK]'; then docker-compose logs || true docker-compose stop || true docker-compose rm -f || true - echo "${output1}" exit 1 fi -if ! output2="$( while_retry '[OK]' "https://localhost:8443" "Host:sample.loc" )"; then +if ! curl -k https://localhost:8443 -H 'Host:sample.loc' | grep '[OK]'; then docker-compose logs || true docker-compose stop || true docker-compose rm -f || true - echo "${output2}" exit 1 fi -if ! output3="$( while_retry '[OK]' "http://localhost:8000" "Host:test.loc" )"; then +if ! curl http://localhost:8000 -H 'Host:test.loc' | grep '[OK]'; then docker-compose logs || true docker-compose stop || true docker-compose rm -f || true - echo "${output3}" exit 1 fi -if ! output4="$( while_retry '[OK]' "https://localhost:8443" "Host:test.loc" )"; then +if ! curl -k https://localhost:8443 -H 'Host:test.loc' | grep '[OK]'; then docker-compose logs || true docker-compose stop || true docker-compose rm -f || true - echo "${output4}" exit 1 fi docker-compose logs || true docker-compose stop || true docker-compose rm -f || true - -echo "${output1}" -echo "${output2}" -echo "${output3}" -echo "${output4}" diff --git a/examples/mass-vhost__reverse-proxy__ssl/integration-test.sh b/examples/mass-vhost__reverse-proxy__ssl/integration-test.sh index 5d4c59a..634efc4 100755 --- a/examples/mass-vhost__reverse-proxy__ssl/integration-test.sh +++ b/examples/mass-vhost__reverse-proxy__ssl/integration-test.sh @@ -4,64 +4,36 @@ set -e set -u set -o pipefail -while_retry() { - local expect="${1}" - local url="${2}" - local header="${3:-}" - local output - - count=0 - retry=60 - while ! output="$( curl --fail -sS -k -L "${url}" -H "${header}" 2>/dev/null | grep -A 10 "${expect}" )"; do - if [ "${count}" = "${retry}" ]; then - echo "[FAILED] curl --fail -sS -k -L \"${url}\" -H \"${header}\" | grep \"${expect}\"" - curl --fail -sS -k -L "${url}" -H "${header}" | grep -A 10 "${expect}" || true - return 1 - fi - count=$(( count + 1 )) - sleep 1 - done - echo "${output}" -} - docker-compose build docker-compose up -d +sleep 10 -if ! output1="$( while_retry '[OK]' "http://localhost:8000" "Host:node.loc" )"; then +if ! curl http://localhost:8000 -H 'Host:node.loc' | grep '[OK]'; then docker-compose logs || true docker-compose stop || true docker-compose rm -f || true - echo "${output1}" exit 1 fi -if ! output2="$( while_retry '[OK]' "https://localhost:8443" "Host:node.loc" )"; then +if ! curl -k https://localhost:8443 -H 'Host:node.loc' | grep '[OK]'; then docker-compose logs || true docker-compose stop || true docker-compose rm -f || true - echo "${output2}" exit 1 fi -if ! output3="$( while_retry '[OK]' "http://localhost:8000" "Host:php.loc" )"; then +if ! curl http://localhost:8000 -H 'Host:php.loc' | grep '[OK]'; then docker-compose logs || true docker-compose stop || true docker-compose rm -f || true - echo "${output3}" exit 1 fi -if ! output4="$( while_retry '[OK]' "https://localhost:8443" "Host:php.loc" )"; then +if ! curl -k https://localhost:8443 -H 'Host:php.loc' | grep '[OK]'; then docker-compose logs || true docker-compose stop || true docker-compose rm -f || true - echo "${output4}" exit 1 fi docker-compose logs || true docker-compose stop || true docker-compose rm -f || true - -echo "${output1}" -echo "${output2}" -echo "${output3}" -echo "${output4}"