Commit 11440fe1 authored by Tim Leers's avatar Tim Leers Committed by Geoff Simmons

use curl to test port-forwarding

parent c3e1e1a1
...@@ -4,6 +4,13 @@ function killforward { ...@@ -4,6 +4,13 @@ function killforward {
kill $KUBEPID kill $KUBEPID
} }
failureCode() {
local code=${2:-500}
local status=$(curl --head --location --connect-timeout 5 --write-out %{http_code} --silent --output /dev/null localhost:${LOCALPORT})
[[ $status == ${code} ]] || [[ $status == 000 ]]
}
LOCALPORT=${LOCALPORT:-8888} LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress,example!=cli-args --for=delete kubectl wait --timeout=2m pod -l app=varnish-ingress,example!=cli-args --for=delete
...@@ -15,5 +22,11 @@ kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null & ...@@ -15,5 +22,11 @@ kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$! KUBEPID=$!
trap killforward EXIT trap killforward EXIT
sleep 1 for ((n = 0; n < 20; n++)); do
if [[ failureCode ]] ; then
sleep 0.5
fi
break
done
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_cli-args.vtc varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_cli-args.vtc
#! /bin/bash -x #!/bin/bash -x
function killforward { function killforward {
kill $KUBEPID kill $KUBEPID
} }
failureCode() {
local code=${2:-500}
local status=$(curl --head --location --connect-timeout 5 --write-out %{http_code} --silent --output /dev/null localhost:${LOCALPORT})
[[ $status == ${code} ]] || [[ $status == 000 ]]
}
LOCALPORT=${LOCALPORT:-8888} LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress,example!=proxy --for=delete kubectl wait --timeout=2m pod -l app=varnish-ingress,example!=proxy --for=delete
...@@ -15,5 +21,11 @@ kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null & ...@@ -15,5 +21,11 @@ kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$! KUBEPID=$!
trap killforward EXIT trap killforward EXIT
sleep 1 for ((n = 0; n < 20; n++)); do
if [[ failureCode ]] ; then
sleep 0.5
fi
break
done
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_proxy.vtc varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_proxy.vtc
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment