Make the duplicate filter colverage test explicit

Implicitly testing from all loads of vmod_debug caused confusing
error messages and prevented explicitly testing for the error message.
parent e51197f1
......@@ -140,6 +140,14 @@ varnish v1 -errvcl {Symbol not found: 'obj'} {
}
}
varnish v1 -errvcl {rot13: VFP already registered (per-vcl)} {
import debug;
backend none none;
sub vcl_init {
debug.rot104();
}
}
varnish v1 -errvcl {Failed initialization} {
import debug;
import directors;
......@@ -281,7 +289,7 @@ varnish v1 -cliok "vcl.list"
varnish v1 -expect vmods == 3
varnish v1 -cliok "vcl.discard vcl[1-8]"
varnish v1 -cliok "vcl.discard vcl[1-9]"
varnish v1 -cliok "vcl.list"
varnish v1 -cliok "debug.vmod"
......
......@@ -334,6 +334,15 @@ xyzzy_test_priv_vcl(VRT_CTX, struct vmod_priv *priv)
assert(!strcmp(priv_vcl->foo, "FOO"));
}
VCL_VOID v_matchproto_(td_debug_rot104)
xyzzy_rot104(VRT_CTX)
{
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
// This should fail
AN(VRT_AddFilter(ctx, &xyzzy_vfp_rot13, &xyzzy_vdp_rot13));
}
VCL_VOID v_matchproto_(td_debug_rot52)
xyzzy_rot52(VRT_CTX, VCL_HTTP hp)
{
......@@ -456,15 +465,6 @@ event_load(VRT_CTX, struct vmod_priv *priv)
priv->methods = priv_vcl_methods;
AZ(VRT_AddFilter(ctx, &xyzzy_vfp_rot13, &xyzzy_vdp_rot13));
// This should fail
AN(VRT_AddFilter(ctx, &xyzzy_vfp_rot13, &xyzzy_vdp_rot13));
// Reset the error, we know what we're doing.
ctx->vpi->handling = 0;
VRT_RemoveFilter(ctx, &xyzzy_vfp_rot13, &xyzzy_vdp_rot13);
AZ(VRT_AddFilter(ctx, &xyzzy_vfp_rot13, &xyzzy_vdp_rot13));
AZ(VRT_AddFilter(ctx, NULL, &xyzzy_vdp_pedantic));
return (0);
}
......
......@@ -121,6 +121,11 @@ $Method STRING .test_priv_top(STRING s="")
Test per-object priv_top via VRT_priv_top()
$Function VOID rot104()
Try to register the rot52 filter again. This should always fail
the vcl.
$Function VOID rot52(HTTP hdr)
Encrypt the HTTP header with quad-ROT13 encryption,
......
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