Commit afcea800 authored by Geoff Simmons's avatar Geoff Simmons

Automate un-/deployment & test of the custom VCL example.

parent ded4b7fa
# looks like -*- vcl -*-
varnishtest "cafe example, custom VCL"
client c1 -connect "${localhost} ${localport}" {
txreq -url /coffee -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
expect resp.http.Backend ~ {^vk8s_default_2f_coffee-svc_\d+_\d+_\d+_\d+$}
expect resp.http.Hello == "world"
expect resp.body ~ "(?m)^Server name: coffee-[a-z0-9]+-[a-z0-9]+$"
} -run
#! /bin/bash -ex
kubectl apply -f ../hello/cafe.yaml
kubectl apply -f ../hello/cafe-ingress.yaml
kubectl apply -f custom-vcl.yaml
#! /bin/bash -ex
kubectl delete -f custom-vcl.yaml
kubectl delete -f ../hello/cafe-ingress.yaml
kubectl delete -f ../hello/cafe.yaml
echo "Waiting until varnish-ingress Pods are not ready"
N=0
until [ $N -ge 120 ]
do
if kubectl get pods -l app=varnish-ingress | grep -q ' 1/1'; then
sleep 10
N=$(( N + 10 ))
continue
fi
exit 0
done
echo "Giving up"
exit 1
#! /bin/bash -ex
function killforward {
kill $KUBEPID
}
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=condition=Ready
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe.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