Created
June 15, 2021 13:39
-
-
Save aondio/9d254478bf6558f47eccb8bb5d8eee56 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
varnishtest "Make sure we play well with other directors" | |
server s1 { | |
rxreq | |
txresp -hdr "server: 1" | |
} -start | |
server s2 { | |
rxreq | |
txresp -hdr "server: 2" | |
} -start | |
varnish v1 -vcl+backend { | |
import directors; | |
import std; | |
import udo; | |
sub vcl_init { | |
new live = directors.fallback(sticky=true); | |
live.add_backend(s1); | |
live.add_backend(s2); | |
new vod = directors.fallback(sticky=true); | |
vod.add_backend(s2); | |
vod.add_backend(s1); | |
} | |
sub vcl_recv { | |
if (req.url == "live") { | |
set req.backend_hint = live.backend(); | |
return (pass); | |
} | |
if (req.url == "vod") { | |
set req.backend_hint = vod.backend(); | |
return (pass); | |
} | |
} | |
} -start | |
varnish v1 -cliok "param.set debug +syncvsl" | |
client c1 { | |
txreq -url "live" | |
rxresp | |
expect resp.status == 200 | |
expect resp.http.server == "1" | |
txreq -url "vod" | |
rxresp | |
expect resp.status == 200 | |
expect resp.http.server == "2" | |
} -run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment