comparison ssi-waited.t @ 124:6edd29865109

Tests: ssi waited subrequests test.
author Maxim Dounin <mdounin@mdounin.ru>
date Sun, 03 Jan 2010 07:14:03 +0300
parents
children 0d11b58d63bc
comparison
equal deleted inserted replaced
123:8aa0dd396a83 124:6edd29865109
1 #!/usr/bin/perl
2
3 # (C) Maxim Dounin
4
5 # Tests for nginx ssi module, waited subrequests.
6
7 ###############################################################################
8
9 use warnings;
10 use strict;
11
12 use Test::More;
13
14 BEGIN { use FindBin; chdir($FindBin::Bin); }
15
16 use lib 'lib';
17 use Test::Nginx;
18
19 ###############################################################################
20
21 select STDERR; $| = 1;
22 select STDOUT; $| = 1;
23
24 my $t = Test::Nginx->new()->has(qw/http ssi/)->plan(2);
25
26 $t->write_file_expand('nginx.conf', <<'EOF');
27
28 %%TEST_GLOBALS%%
29
30 master_process off;
31 daemon off;
32
33 events {
34 }
35
36 http {
37 %%TEST_GLOBALS_HTTP%%
38
39 server {
40 listen 127.0.0.1:8080;
41 server_name localhost;
42 location / {
43 ssi on;
44 }
45 }
46 }
47
48 EOF
49
50 $t->write_file('index.html', 'x<!--#include virtual="/first.html" -->' .
51 'x<!--#include virtual="/second.html" -->x');
52 $t->write_file('first.html', 'FIRST');
53 $t->write_file('second.html',
54 '<!--#include virtual="/waited.html" wait="yes"-->xSECOND');
55 $t->write_file('waited.html', 'WAITED');
56
57 $t->run();
58
59 ###############################################################################
60
61 {
62 local $TODO = 'broken in 0.7.25, patch under review';
63
64 like(http_get('/'), qr/^xFIRSTxWAITEDxSECONDx$/m, 'waited non-active');
65
66 }
67
68 like(`grep -F '[alert]' ${\($t->testdir())}/error.log`, qr/^$/s, 'no alerts');
69
70 ###############################################################################