changeset 192:f2a48c528b3b

Tests: fixed http variables test, log entries order may differ.
author Valentin Bartenev <ne@vbart.ru>
date Thu, 29 Dec 2011 18:31:14 +0300
parents bc6ecf23cc9c
children 50063559d85a
files http_variables.t
diffstat 1 files changed, 12 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/http_variables.t
+++ b/http_variables.t
@@ -36,7 +36,7 @@ events {
 http {
     %%TEST_GLOBALS_HTTP%%
 
-    log_format cc "CC: $sent_http_cache_control";
+    log_format cc "$uri: $sent_http_cache_control";
 
     server {
         listen       127.0.0.1:8080;
@@ -73,25 +73,24 @@ http_get('/redefine');
 
 $t->stop();
 
-my @log;
+my $log;
 
-open LOG, $t->testdir() . '/cc.log'
-	or die("Can't open nginx access log file.\n");
-
-foreach my $line (<LOG>) {
-	chomp $line;
-	push @log, $line;
+{
+	open LOG, $t->testdir() . '/cc.log'
+		or die("Can't open nginx access log file.\n");
+	local $/;
+	$log = <LOG>;
+	close LOG;
 }
 
-close LOG;
-
-is(shift @log, 'CC: -', 'no header');
-is(shift @log, 'CC: max-age=3600; private; must-revalidate', 'multi headers');
+like($log, qr!^/: -$!m, 'no header');
+like($log, qr!^/set: max-age=3600; private; must-revalidate$!m,
+	'multi headers');
 
 TODO:{
 local $TODO = 'add hash checks';
 
-is(shift @log, 'CC: no-cache', 'ignoring headers with (hash == 0)');
+like($log, qr!^/redefine: no-cache$!m, 'ignoring headers with (hash == 0)');
 }
 
 ###############################################################################