Skip to content

Instantly share code, notes, and snippets.

test "Test restarts in vcl_hit"
server s {
rxreq
expect req.url == "/foo"
txresp -status 200
} -start
varnish v -vcl+backend {
sub vcl_hit {
test "Test restarts in vcl_hit"
server s {
rxreq
expect req.url == "/foo"
txresp -status 200
rxreq
expect req.url == "/foo"
txresp -status 200
} -start
9 RxRequest c GET
9 RxURL c /statuses/user_timeline.xml
9 RxProtocol c HTTP/1.1
9 RxHeader c Authorization: Basic amFjazoxMjM0
9 RxHeader c User-Agent: curl/7.18.1 (i386-apple-darwin9.2.2) libcurl/7.18.1 zlib/1.2.3
9 RxHeader c Host: localhost
9 RxHeader c Accept: */*
9 VCL_call c recv
9 VCL_return c lookup
9 VCL_call c hash
C{
#include <dlfcn.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
typedef int twitter_is_fresh_t(char *, char *);
static twitter_is_fresh_t *twitter_is_fresh_ptr = NULL;
test "Authorization tokens are cached"
server s {
rxreq
expect req.url == "/"
expect req.http.Authorization == "foo"
txresp -status 200
} -start
varnish v -vcl+backend {
test "Authorization tokens are cached"
server s {
rxreq
expect req.url == "/"
expect req.http.Authorization == "Basic foo"
txresp -status 200
rxreq
expect req.url == "/"
[pivotal@Toemang vcl (master)]$ varnishtest get_is_cached.vtc
# top TEST get_is_cached.vtc starting
# TEST GET is cached
## s Starting server
### s listen on 127.0.0.1:9080 (fd 3)
## v Launch
### v CMD: cd ../varnishd && ./varnishd -d -d -n /tmp/__v -a '127.0.0.1:9081' -T 127.0.0.1:9001 -P /tmp/__v/varnishd.pid
### v opening CLI connection
## s Started on 127.0.0.1:9080
connect(): Connection refused
test "Stale objects are expired, but served from cache for a grace period"
shell "/Users/pivotal/workspace/freshyfresh/bin/memset version:test 2"
server s {
rxreq
expect req.url == "/"
txresp -status 200 -hdr "ETag: 1" -hdr "X-Generation-Key: version:test"
} -start
test "Stale objects are expired, but served from cache for a grace period"
shell "/Users/pivotal/workspace/freshyfresh/target/memset version:test 2"
server s {
rxreq
expect req.url == "/"
txresp -status 200 -hdr "ETag: 1" -hdr "X-Generation-Key: version:test"
} -start
test "Stale objects are expired, but served from cache for a grace period"
shell "/Users/pivotal/workspace/freshyfresh/target/memset version:test 2"
server s {
rxreq
expect req.url == "/"
txresp -status 200 -hdr "ETag: 1" -hdr "X-Generation-Key: version:test"
} -start