test polish suggested by Dridi, thank you

parent 9598face
...@@ -22,33 +22,36 @@ varnish v1 -vcl+backend { ...@@ -22,33 +22,36 @@ varnish v1 -vcl+backend {
std.log("-- invalid replicas"); std.log("-- invalid replicas");
if (!vd.reconfigure(replicas=0)) { if (!vd.reconfigure(replicas=0)) {
# continue intentionally
std.log("reconfigure failed"); std.log("reconfigure failed");
} }
std.log("-- no changes - no debug output"); std.log("-- no changes - no debug output");
if (!vd.reconfigure(replicas=25)) { if (!vd.reconfigure(replicas=25)) {
# continue intentionally
std.log("reconfigure failed"); std.log("reconfigure failed");
} }
std.log("-- no backends"); std.log("-- no backends");
if (!vd.clear()) { if (!vd.clear()) {
std.log("clear failed"); return(fail("clear failed"));
} }
if (!vd.reconfigure(replicas=25)) { if (!vd.reconfigure(replicas=25)) {
# continue intentionally
std.log("reconfigure failed"); std.log("reconfigure failed");
} }
std.log("-- one backend"); std.log("-- one backend");
if (!vd.add_backend(s1)) { if (!vd.add_backend(s1)) {
std.log("add s1 failed"); return(fail("add s1 failed"));
} }
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
std.log("-- no change - no output"); std.log("-- no change - no output");
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
std.log("-- change, clear, no backends"); std.log("-- change, clear, no backends");
...@@ -60,6 +63,7 @@ varnish v1 -vcl+backend { ...@@ -60,6 +63,7 @@ varnish v1 -vcl+backend {
vd.add_backend(s2); vd.add_backend(s2);
vd.clear(); vd.clear();
if (!vd.reconfigure()) { if (!vd.reconfigure()) {
# continue intentionally
std.log("reconfigure failed"); std.log("reconfigure failed");
} }
...@@ -69,7 +73,7 @@ varnish v1 -vcl+backend { ...@@ -69,7 +73,7 @@ varnish v1 -vcl+backend {
vd.add_backend(s2); vd.add_backend(s2);
vd.add_backend(s1); vd.add_backend(s1);
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
std.log("-- duplicate add with idents"); std.log("-- duplicate add with idents");
...@@ -82,19 +86,19 @@ varnish v1 -vcl+backend { ...@@ -82,19 +86,19 @@ varnish v1 -vcl+backend {
vd.add_backend(s2, ident="s1_1"); vd.add_backend(s2, ident="s1_1");
vd.add_backend(s2, ident="s1_2"); vd.add_backend(s2, ident="s1_2");
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
std.log("-- remove s1_2 specifically"); std.log("-- remove s1_2 specifically");
vd.remove_backend(ident="s1_2"); vd.remove_backend(ident="s1_2");
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
std.log("-- remove all instances of s1"); std.log("-- remove all instances of s1");
vd.remove_backend(s1); vd.remove_backend(s1);
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
std.log("-- re-add some - no 2nd director"); std.log("-- re-add some - no 2nd director");
...@@ -110,19 +114,19 @@ varnish v1 -vcl+backend { ...@@ -110,19 +114,19 @@ varnish v1 -vcl+backend {
vd.add_backend(s3, "8"); vd.add_backend(s3, "8");
vd.add_backend(s3, "9"); vd.add_backend(s3, "9");
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
std.log("-- remove second-last"); std.log("-- remove second-last");
vd.remove_backend(ident="8"); vd.remove_backend(ident="8");
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
std.log("-- remove last"); std.log("-- remove last");
vd.remove_backend(ident="9"); vd.remove_backend(ident="9");
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
std.log("-- END"); std.log("-- END");
...@@ -146,7 +150,7 @@ varnish v1 -vcl+backend { ...@@ -146,7 +150,7 @@ varnish v1 -vcl+backend {
vd.add_backend(s1, "0x0e"); vd.add_backend(s1, "0x0e");
vd.add_backend(s1, "0x0f"); vd.add_backend(s1, "0x0f");
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
vd.remove_backend(s1, "0x00"); vd.remove_backend(s1, "0x00");
vd.remove_backend(s1, "0x01"); vd.remove_backend(s1, "0x01");
...@@ -165,7 +169,7 @@ varnish v1 -vcl+backend { ...@@ -165,7 +169,7 @@ varnish v1 -vcl+backend {
vd.remove_backend(s1, "0x0e"); vd.remove_backend(s1, "0x0e");
vd.remove_backend(s1, "0x0f"); vd.remove_backend(s1, "0x0f");
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
vd.set_warmup(0.5); vd.set_warmup(0.5);
...@@ -180,7 +184,7 @@ varnish v1 -vcl+backend { ...@@ -180,7 +184,7 @@ varnish v1 -vcl+backend {
vd.add_backend(s3, "4"); vd.add_backend(s3, "4");
vd.add_backend(s3, "5"); vd.add_backend(s3, "5");
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
vd.set_warmup(0); vd.set_warmup(0);
} }
......
...@@ -22,35 +22,39 @@ varnish v1 -vcl+backend { ...@@ -22,35 +22,39 @@ varnish v1 -vcl+backend {
} }
sub vcl_recv { sub vcl_recv {
std.log("-- invalid replicas"); std.log("-- invalid replicas");
if (!vd.reconfigure(replicas=0)) { if (!vd.reconfigure(replicas=0)) {
# continue intentionally
std.log("reconfigure failed"); std.log("reconfigure failed");
} }
std.log("-- no changes - no debug output"); std.log("-- no changes - no debug output");
if (!vd.reconfigure(replicas=25)) { if (!vd.reconfigure(replicas=25)) {
# continue intentionally
std.log("reconfigure failed"); std.log("reconfigure failed");
} }
std.log("-- no backends"); std.log("-- no backends");
if (!vd.clear()) { if (!vd.clear()) {
std.log("clear failed"); return(fail("clear failed"));
} }
if (!vd.reconfigure(replicas=25)) { if (!vd.reconfigure(replicas=25)) {
# continue intentionally
std.log("reconfigure failed"); std.log("reconfigure failed");
} }
std.log("-- one backend"); std.log("-- one backend");
if (!vd.add_backend(s1)) { if (!vd.add_backend(s1)) {
std.log("add s1 failed"); return(fail("add s1 failed"));
} }
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
std.log("-- no change - no output"); std.log("-- no change - no output");
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
std.log("-- change, clear, no backends"); std.log("-- change, clear, no backends");
...@@ -62,6 +66,7 @@ varnish v1 -vcl+backend { ...@@ -62,6 +66,7 @@ varnish v1 -vcl+backend {
vd.add_backend(s2); vd.add_backend(s2);
vd.clear(); vd.clear();
if (!vd.reconfigure()) { if (!vd.reconfigure()) {
# continue intentionally
std.log("reconfigure failed"); std.log("reconfigure failed");
} }
...@@ -71,7 +76,7 @@ varnish v1 -vcl+backend { ...@@ -71,7 +76,7 @@ varnish v1 -vcl+backend {
vd.add_backend(s2); vd.add_backend(s2);
vd.add_backend(s1); vd.add_backend(s1);
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
std.log("-- duplicate add with idents"); std.log("-- duplicate add with idents");
...@@ -84,19 +89,19 @@ varnish v1 -vcl+backend { ...@@ -84,19 +89,19 @@ varnish v1 -vcl+backend {
vd.add_backend(s2, ident="s1_1"); vd.add_backend(s2, ident="s1_1");
vd.add_backend(s2, ident="s1_2"); vd.add_backend(s2, ident="s1_2");
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
std.log("-- remove s1_2 specifically"); std.log("-- remove s1_2 specifically");
vd.remove_backend(ident="s1_2"); vd.remove_backend(ident="s1_2");
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
std.log("-- remove all instances of s1"); std.log("-- remove all instances of s1");
vd.remove_backend(s1); vd.remove_backend(s1);
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
std.log("-- re-add some - no 2nd director"); std.log("-- re-add some - no 2nd director");
...@@ -112,23 +117,22 @@ varnish v1 -vcl+backend { ...@@ -112,23 +117,22 @@ varnish v1 -vcl+backend {
vd.add_backend(s3, "8"); vd.add_backend(s3, "8");
vd.add_backend(s3, "9"); vd.add_backend(s3, "9");
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
std.log("-- remove second-last"); std.log("-- remove second-last");
vd.remove_backend(ident="8"); vd.remove_backend(ident="8");
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
std.log("-- remove last"); std.log("-- remove last");
vd.remove_backend(ident="9"); vd.remove_backend(ident="9");
if (!vd.reconfigure(replicas=1)) { if (!vd.reconfigure(replicas=1)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
std.log("-- END"); std.log("-- END");
set req.backend_hint = vd.backend(); set req.backend_hint = vd.backend();
return(pass); return(pass);
} }
......
...@@ -31,16 +31,16 @@ varnish v1 -vcl+backend { ...@@ -31,16 +31,16 @@ varnish v1 -vcl+backend {
new vd = directors.shard(); new vd = directors.shard();
vd.debug(3); vd.debug(3);
if (!vd.add_backend(s1)) { if (!vd.add_backend(s1)) {
std.log("add s1 failed"); return(fail("add s1 failed"));
} }
if (!vd.add_backend(s2)) { if (!vd.add_backend(s2)) {
std.log("add s2 failed"); return(fail("add s2 failed"));
} }
if (!vd.add_backend(s3)) { if (!vd.add_backend(s3)) {
std.log("add s3 failed"); return(fail("add s3 failed"));
} }
if (!vd.reconfigure(replicas=25)) { if (!vd.reconfigure(replicas=25)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
} }
......
...@@ -22,16 +22,16 @@ varnish v1 -vcl+backend { ...@@ -22,16 +22,16 @@ varnish v1 -vcl+backend {
sub vcl_init { sub vcl_init {
new vd = directors.shard(); new vd = directors.shard();
if (!vd.add_backend(s1)) { if (!vd.add_backend(s1)) {
std.log("add s1 failed"); return(fail("add s1 failed"));
} }
if (!vd.add_backend(s2)) { if (!vd.add_backend(s2)) {
std.log("add s2 failed"); return(fail("add s2 failed"));
} }
if (!vd.add_backend(s3)) { if (!vd.add_backend(s3)) {
std.log("add s3 failed"); return(fail("add s3 failed"));
} }
if (!vd.reconfigure(replicas=25)) { if (!vd.reconfigure(replicas=25)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
} }
......
...@@ -22,32 +22,32 @@ varnish v1 -vcl+backend { ...@@ -22,32 +22,32 @@ varnish v1 -vcl+backend {
sub vcl_init { sub vcl_init {
new vd = directors.shard(); new vd = directors.shard();
if (!vd.add_backend(s1)) { if (!vd.add_backend(s1)) {
std.log("add s1 failed"); return(fail("add s1 failed"));
} }
if (!vd.add_backend(s2)) { if (!vd.add_backend(s2)) {
std.log("add s2 failed"); return(fail("add s2 failed"));
} }
if (!vd.add_backend(s3)) { if (!vd.add_backend(s3)) {
std.log("add s3 failed"); return(fail("add s3 failed"));
} }
if (!vd.reconfigure(replicas=25)) { if (!vd.reconfigure(replicas=25)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
new l = directors.shard(); new l = directors.shard();
new lp = directors.shard_param(); new lp = directors.shard_param();
l.associate(lp.use()); l.associate(lp.use());
if (!l.add_backend(s1)) { if (!l.add_backend(s1)) {
std.log("add s1 failed"); return(fail("add s1 failed"));
} }
if (!l.add_backend(s2)) { if (!l.add_backend(s2)) {
std.log("add s2 failed"); return(fail("add s2 failed"));
} }
if (!l.add_backend(s3)) { if (!l.add_backend(s3)) {
std.log("add s3 failed"); return(fail("add s3 failed"));
} }
if (!l.reconfigure(replicas=25)) { if (!l.reconfigure(replicas=25)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
new ll = directors.round_robin(); new ll = directors.round_robin();
ll.add_backend(l.backend()); ll.add_backend(l.backend());
......
...@@ -22,16 +22,16 @@ varnish v1 -vcl+backend { ...@@ -22,16 +22,16 @@ varnish v1 -vcl+backend {
sub vcl_init { sub vcl_init {
new vd = directors.shard(); new vd = directors.shard();
if (!vd.add_backend(s1)) { if (!vd.add_backend(s1)) {
std.log("add s1 failed"); return(fail("add s1 failed"));
} }
if (!vd.add_backend(s2)) { if (!vd.add_backend(s2)) {
std.log("add s2 failed"); return(fail("add s2 failed"));
} }
if (!vd.add_backend(s3)) { if (!vd.add_backend(s3)) {
std.log("add s3 failed"); return(fail("add s3 failed"));
} }
if (!vd.reconfigure(replicas=25)) { if (!vd.reconfigure(replicas=25)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
vd.debug(1); vd.debug(1);
......
...@@ -24,16 +24,16 @@ varnish v1 -vcl+backend { ...@@ -24,16 +24,16 @@ varnish v1 -vcl+backend {
new vd = directors.shard(); new vd = directors.shard();
vd.debug(3); vd.debug(3);
if (!vd.add_backend(s1)) { if (!vd.add_backend(s1)) {
std.log("add s1 failed"); return(fail("add s1 failed"));
} }
if (!vd.add_backend(s2, weight=2)) { if (!vd.add_backend(s2, weight=2)) {
std.log("add s2 failed"); return(fail("add s2 failed"));
} }
if (!vd.add_backend(s3, weight=3)) { if (!vd.add_backend(s3, weight=3)) {
std.log("add s3 failed"); return(fail("add s3 failed"));
} }
if (!vd.reconfigure(replicas=25)) { if (!vd.reconfigure(replicas=25)) {
std.log("reconfigure failed"); return(fail("reconfigure failed"));
} }
} }
......
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