Commit 20f4ac89 authored by Geoff Simmons's avatar Geoff Simmons

Automate un-/deployment & test of the Varnish Pod template examples.

parent 1629bac2
../hello/cafe.vtc
\ No newline at end of file
# looks like -*- vcl -*-
varnishtest "cafe example using PROXY"
client c1 -connect "${localhost} ${localport}" -proxy1 "1.2.3.4:1234 5.6.7.8:5678" {
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
client c1 -connect "${localhost} ${localport}" -proxy2 "1.2.3.4:1234 5.6.7.8:5678" {
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
......@@ -11,6 +11,7 @@ spec:
metadata:
labels:
app: varnish-ingress
example: cli-args
spec:
containers:
- image: varnish-ingress/varnish
......
#! /bin/bash -ex
kubectl apply -f ../hello/cafe.yaml
kubectl apply -f ../hello/cafe-ingress.yaml
kubectl apply -f cli-args.yaml
#! /bin/bash -ex
kubectl apply -f ../hello/cafe.yaml
kubectl apply -f ../hello/cafe-ingress.yaml
kubectl apply -f env.yaml
#! /bin/bash -ex
kubectl apply -f ../hello/cafe.yaml
kubectl apply -f ../hello/cafe-ingress.yaml
kubectl apply -f proxy.yaml
......@@ -11,6 +11,7 @@ spec:
metadata:
labels:
app: varnish-ingress
example: env
spec:
containers:
- image: varnish-ingress/varnish
......
......@@ -11,6 +11,7 @@ spec:
metadata:
labels:
app: varnish-ingress
example: proxy
spec:
containers:
- image: varnish-ingress/varnish
......
#! /bin/bash -ex
kubectl delete svc varnish-ingress
kubectl delete deploy varnish
echo Waiting until example varnish-ingress Pods are deleted
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=delete
kubectl delete -f ../hello/cafe-ingress.yaml
kubectl delete -f ../hello/cafe.yaml
kubectl apply -f ../../deploy/varnish.yaml
kubectl apply -f ../../deploy/nodeport.yaml
echo Waiting until varnish-ingress Pods are running
kubectl wait --timeout=2m pod -l app=varnish-ingress --for=condition=Initialized
#! /bin/bash -x
function killforward {
kill $KUBEPID
}
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress,example!=cli-args --for=delete
set -e
kubectl wait --timeout=2m pod -l example=cli-args --for=condition=Ready
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_cli-args.vtc
#! /bin/bash -x
function killforward {
kill $KUBEPID
}
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress,example!=env --for=delete
set -e
kubectl wait --timeout=2m pod -l example=env --for=condition=Ready
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:81 >/dev/null &
KUBEPID=$!
trap killforward EXIT
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_proxy.vtc
#! /bin/bash -x
function killforward {
kill $KUBEPID
}
LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress,example!=proxy --for=delete
set -e
kubectl wait --timeout=2m pod -l example=proxy --for=condition=Ready
kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$!
trap killforward EXIT
sleep 1
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