Commit 798cba43 authored by Geoff Simmons's avatar Geoff Simmons

add function version() and some fundamental tests

parent a490ef04
......@@ -17,4 +17,3 @@ client c1 {
expect resp.status == 200
expect resp.http.foo == 1
} -run
# Somewhat oversimplified, but at least it ensures that SOMETHING works
# (The alternative would be to automakeify this test or manually update it
# every time there's a new version, which defeats the purpose somewhat).
varnishtest "vtstor-vmod: Test version string"
server s1 {
rxreq
expect req.url == "/"
txresp -status 200
} -start
varnish v1 -vcl+backend {
import vtstor from "${vmod_topbuild}/src/.libs/libvmod_vtstor.so";
sub vcl_backend_response {
set beresp.http.x-version = vtstor.version();
if (!beresp.http.x-version) {
set beresp.status = 500;
}
return(deliver);
}
} -start
client c1 {
txreq -url "/"
rxresp
expect resp.status == 200
} -run
varnishtest "vtstor-vmod: vcl.use and .discard"
server s1 {
} -start
varnish v1 -vcl+backend {
import vtstor from "${vmod_topbuild}/src/.libs/libvmod_vtstor.so";
} -start
varnish v1 -vcl+backend {
}
varnish v1 -cli "vcl.list"
varnish v1 -cli "vcl.use vcl1"
varnish v1 -cli "vcl.use vcl2"
varnish v1 -cli "vcl.use vcl1"
varnish v1 -cli "vcl.show vcl1"
varnish v1 -cli "vcl.use vcl2"
varnish v1 -cli "vcl.discard vcl1"
varnish v1 -cli "vcl.list"
......@@ -170,3 +170,10 @@ vmod_vxid(VRT_CTX, struct vmod_priv *priv)
return(priv->priv);
}
#endif
VCL_STRING __match_proto__(td_vmod_version)
vmod_version(VRT_CTX)
{
return VERSION;
}
......@@ -34,3 +34,5 @@ $Method STRING .get(HEADER)
$Method VOID .delete(HEADER)
# $Function STRING vxid(PRIV_TASK)
$Function STRING version()
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