Mailing List Archive

r1841 - trunk/varnish-tools/regress/lib/Varnish/Test
Author: des
Date: 2007-08-13 20:36:15 +0200 (Mon, 13 Aug 2007)
New Revision: 1841

Modified:
trunk/varnish-tools/regress/lib/Varnish/Test/Case.pm
Log:
Fix assert_xid() and add assert_no_xid() (useful for piped requests)


Modified: trunk/varnish-tools/regress/lib/Varnish/Test/Case.pm
===================================================================
--- trunk/varnish-tools/regress/lib/Varnish/Test/Case.pm 2007-08-13 18:31:39 UTC (rev 1840)
+++ trunk/varnish-tools/regress/lib/Varnish/Test/Case.pm 2007-08-13 18:36:15 UTC (rev 1841)
@@ -313,11 +313,21 @@
unless defined($resp);

die "No X-Varnish header\n"
- unless (!$resp->header('X-Varnish'));
+ unless (defined($resp->header('X-Varnish')));
die "Invalid X-Varnish header\n"
unless ($resp->header('X-Varnish') =~ m/^\d+(?: \d+)?$/);
}

+sub assert_no_xid($;$) {
+ my ($self, $resp) = @_;
+
+ $resp = $self->{'cached_response'}
+ unless defined($resp);
+
+ die "X-Varnish header present where none expected\n"
+ if (defined($resp->header('X-Varnish')));
+}
+
sub assert_cached($;$) {
my ($self, $resp) = @_;