forked from varnishcache/varnish-cache
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement socket barriers (shared between processes)
When varnishtest creates a socket barrier, it will bind a socket and listen to incoming connections. Once the number of expected connections is open, connections are closed. Barrier users only need to connect to the socket, read "nothing" and block until the connection is closed. It allows virtually any process to sync with varnishtest. The barrier will provide macros with its socket information.
- Loading branch information
Showing
2 changed files
with
237 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
varnishtest "Barrier operations" | ||
|
||
# same as a00008.vtc, with socket barriers instead | ||
|
||
# bs -> server, bc -> client, bb -> both | ||
barrier bs sock 4 | ||
barrier bc sock 4 | ||
barrier bb sock 4 -cyclic | ||
|
||
server s1 { | ||
rxreq | ||
barrier bs sync | ||
barrier bb sync | ||
delay .9 | ||
txresp | ||
} -start | ||
|
||
server s2 { | ||
rxreq | ||
barrier bs sync | ||
barrier bb sync | ||
delay .6 | ||
txresp | ||
} -start | ||
|
||
server s3 { | ||
rxreq | ||
barrier bs sync | ||
barrier bb sync | ||
delay .2 | ||
txresp | ||
} -start | ||
|
||
client c1 -connect ${s1_sock} { | ||
delay .2 | ||
txreq | ||
rxresp | ||
barrier bc sync | ||
barrier bb sync | ||
} -start | ||
|
||
client c2 -connect ${s2_sock} { | ||
delay .6 | ||
txreq | ||
rxresp | ||
barrier bc sync | ||
barrier bb sync | ||
} -start | ||
|
||
client c3 -connect ${s3_sock} { | ||
delay .9 | ||
txreq | ||
rxresp | ||
barrier bc sync | ||
barrier bb sync | ||
} -start | ||
|
||
# Wait for all servers to have received requests | ||
barrier bs sync | ||
barrier bb sync | ||
|
||
# Wait for all clients to have received responses | ||
barrier bc sync | ||
barrier bb sync |
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