Commit ea964eb0 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp Committed by Tollef Fog Heen

This test is much to brittle due to dependence on random timing.

Tighten it up with use of semaphores and collapse s1/s2/s3 using
"accept" keyword.
parent 3558ace0
...@@ -4,12 +4,46 @@ server s1 { ...@@ -4,12 +4,46 @@ server s1 {
rxreq rxreq
expect req.url == "/" expect req.url == "/"
txresp -body "slash" txresp -body "slash"
accept
sema r1 sync 3
rxreq
expect req.url == "/"
txresp -body "slash"
accept
rxreq
expect req.url == "/"
txresp -body "slash"
sema r3 sync 2
accept
rxreq
expect req.url == "/foo"
txresp -hdr "Foo: 1" -body "foobar"
} -start } -start
server s2 { server s2 {
rxreq rxreq
expect req.url == "/" expect req.url == "/"
txresp -body "slash" txresp -body "slash"
accept
sema r1 sync 3
rxreq
expect req.url == "/"
txresp -body "slash"
sema r2 sync 2
accept
rxreq
expect req.url == "/foo"
txresp -hdr "Foo: 2" -body "foobar"
} -start } -start
server s3 { server s3 {
...@@ -65,66 +99,23 @@ varnish v1 -vcl { ...@@ -65,66 +99,23 @@ varnish v1 -vcl {
} }
} -start } -start
# s1 & s2 have both had 1 probe, so both are unhealthy
client c1 { client c1 {
# s1 & s2 are both sick, expect response from s3
txreq -url "/foo" txreq -url "/foo"
rxresp rxresp
expect resp.http.foo == "3" expect resp.http.foo == "3"
} -run
# setup for probe #2
server s1 {
rxreq
expect req.url == "/"
txresp -body "slash"
} -start
server s2 {
rxreq
expect req.url == "/"
txresp -body "slash"
} -start
# if we muck with a running server, the test will wait until it's done, sema r1 sync 3
# which will be after probe #2 completes. b2 will then be healthy.
server s2 { # wait for s2 to become healthy
rxreq sema r2 sync 2
expect req.url == "/foo"
txresp -hdr "Foo: 2" -body "foobar"
} -start
client c1 {
txreq -url "/foo" txreq -url "/foo"
rxresp rxresp
expect resp.http.foo == "2" expect resp.http.foo == "2"
} -run
# setup for probe #3 # wait for s1 to become healthy
sema r3 sync 2
server s1 {
rxreq
expect req.url == "/"
txresp -body "slash"
} -start
server s2 {
rxreq
expect req.url == "/"
txresp -body "slash"
} -start
# after probe #3 b1 should be healthy.
server s1 {
rxreq
expect req.url == "/foo"
txresp -hdr "Foo: 1" -body "foobar"
} -start
client c1 {
txreq -url "/foo" txreq -url "/foo"
rxresp rxresp
expect resp.http.foo == "1" expect resp.http.foo == "1"
......
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