Skip to content

Commit

Permalink
Revert tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cytopia committed Dec 22, 2022
1 parent 3ced4fc commit 4368778
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 191 deletions.
25 changes: 2 additions & 23 deletions examples/default-vhost__php-fpm/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
32 changes: 4 additions & 28 deletions examples/default-vhost__php-fpm__ssl/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
31 changes: 8 additions & 23 deletions examples/default-vhost__reverse-proxy__node/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
31 changes: 4 additions & 27 deletions examples/default-vhost__reverse-proxy__python/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
25 changes: 2 additions & 23 deletions examples/default-vhost__static-files/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
38 changes: 5 additions & 33 deletions examples/mass-vhost__php-fpm__ssl/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
38 changes: 5 additions & 33 deletions examples/mass-vhost__reverse-proxy__ssl/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

0 comments on commit 4368778

Please sign in to comment.