Commit 9851138b authored by Geoff Simmons's avatar Geoff Simmons

Automate un-/deployment & test of the Hello World example.

parent 2c889af1
# looks like -*- vcl -*-
varnishtest "cafe example (hello world for Ingress)"
client c1 -connect "${localhost} ${localport}" {
txreq -url /coffee/foo/bar -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
expect resp.body ~ "(?m)^URI: /coffee/foo/bar$"
expect resp.body ~ "(?m)^Server name: coffee-[a-z0-9]+-[a-z0-9]+$"
txreq -url /tea/baz/quux -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
expect resp.body ~ "(?m)^URI: /tea/baz/quux$"
expect resp.body ~ "(?m)^Server name: tea-[a-z0-9]+-[a-z0-9]+$"
txreq -url /coffee/foo/bar
rxresp
expect resp.status == 404
txreq -url /milk -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 404
} -run
#! /bin/bash -ex
kubectl create -f cafe.yaml
kubectl create -f cafe-ingress.yaml
#! /bin/bash -ex
kubectl delete -f cafe-ingress.yaml
kubectl delete -f 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
# Nothing special about self-sharding is verified here, just run the
# same tests as for the cafe example ("hello").
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