# HG changeset patch # User Valentin Bartenev # Date 1325172674 -10800 # Node ID f2a48c528b3b8c079c14c50719eacc9303b4f6b7 # Parent bc6ecf23cc9c714c56ee7d75825507ed4a972d61 Tests: fixed http variables test, log entries order may differ. diff --git a/http_variables.t b/http_variables.t --- 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 () { - chomp $line; - push @log, $line; +{ + open LOG, $t->testdir() . '/cc.log' + or die("Can't open nginx access log file.\n"); + local $/; + $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)'); } ###############################################################################