annotate proxy_cache_lock.t @ 1021:ebdf239722b9

Tests: relaxed proxy_cache_lock.t nolock tests to fix on Solaris. Assumed that the order of responses being arrived in nolock case may be ignored. An important part of such case is that the only last response should be cached.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 02 Sep 2016 12:17:35 +0300
parents 196d33c2bb45
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
1 #!/usr/bin/perl
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
2
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
3 # (C) Maxim Dounin
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
4
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
5 # Tests for http proxy cache lock.
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
6
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
7 ###############################################################################
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
8
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
9 use warnings;
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
10 use strict;
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
11
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
12 use Test::More;
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
13
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
14 BEGIN { use FindBin; chdir($FindBin::Bin); }
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
15
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
16 use lib 'lib';
438
60888e2c3f5a Tests: new http_start() and http_end() functions.
Sergey Kandaurov <pluknet@nginx.com>
parents: 397
diff changeset
17 use Test::Nginx qw/ :DEFAULT http_end /;
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
18
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
19 ###############################################################################
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
20
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
21 select STDERR; $| = 1;
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
22 select STDOUT; $| = 1;
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
23
1020
196d33c2bb45 Tests: removed TODO and try_run() checks for legacy versions.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 974
diff changeset
24 my $t = Test::Nginx->new()->has(qw/http proxy cache/)->plan(17)
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
25 ->write_file_expand('nginx.conf', <<'EOF');
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
26
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
27 %%TEST_GLOBALS%%
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
28
249
6a0d934950bc Tests: remove extra spaces in "daemon off".
Maxim Dounin <mdounin@mdounin.ru>
parents: 233
diff changeset
29 daemon off;
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
30
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
31 events {
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
32 }
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
33
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
34 http {
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
35 %%TEST_GLOBALS_HTTP%%
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
36
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
37 proxy_cache_path %%TESTDIR%%/cache levels=1:2
503
071e8941e3bf Tests: reduce shared memory zone sizes.
Maxim Dounin <mdounin@mdounin.ru>
parents: 499
diff changeset
38 keys_zone=NAME:1m;
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
39
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
40 server {
974
882267679006 Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 952
diff changeset
41 listen 127.0.0.1:8080;
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
42 server_name localhost;
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
43
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
44 location / {
974
882267679006 Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 952
diff changeset
45 proxy_pass http://127.0.0.1:8081;
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
46 proxy_cache NAME;
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
47
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
48 proxy_cache_lock on;
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
49 }
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
50
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
51 location /timeout {
974
882267679006 Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 952
diff changeset
52 proxy_pass http://127.0.0.1:8081;
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
53 proxy_cache NAME;
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
54
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
55 proxy_cache_lock on;
233
1a5574d84917 Tests: tweak various timeouts and replace sleep() with select().
Maxim Dounin <mdounin@mdounin.ru>
parents: 223
diff changeset
56 proxy_cache_lock_timeout 200ms;
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
57 }
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
58
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
59 location /nolock {
974
882267679006 Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 952
diff changeset
60 proxy_pass http://127.0.0.1:8081;
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
61 proxy_cache NAME;
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
62 }
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
63 }
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
64 }
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
65
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
66 EOF
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
67
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
68 $t->run_daemon(\&http_fake_daemon);
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
69
568
907e89fba9c3 Tests: removed TODO and try_run() checks for legacy versions.
Sergey Kandaurov <pluknet@nginx.com>
parents: 551
diff changeset
70 $t->run();
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
71
974
882267679006 Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 952
diff changeset
72 $t->waitforsocket('127.0.0.1:' . port(8081));
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
73
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
74 ###############################################################################
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
75
595
6cdfd177319b Tests: fixed typos and misspellings.
Sergey Kandaurov <pluknet@nginx.com>
parents: 574
diff changeset
76 # sequential requests
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
77
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
78 for my $i (1 .. 5) {
595
6cdfd177319b Tests: fixed typos and misspellings.
Sergey Kandaurov <pluknet@nginx.com>
parents: 574
diff changeset
79 like(http_get('/seq'), qr/request 1/, 'sequential request ' . $i);
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
80 }
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
81
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
82 # parallel requests
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
83
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
84 my @sockets;
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
85
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
86 for my $i (1 .. 5) {
438
60888e2c3f5a Tests: new http_start() and http_end() functions.
Sergey Kandaurov <pluknet@nginx.com>
parents: 397
diff changeset
87 $sockets[$i] = http_get('/par1', start => 1);
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
88 }
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
89
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
90 for my $i (1 .. 5) {
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
91 like(http_end($sockets[$i]), qr/request 1/, 'parallel request ' . $i);
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
92 }
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
93
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
94 like(http_get('/par1'), qr/request 1/, 'first request cached');
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
95
498
420fbf3555dd Tests: cache lock timeout behavior changed in 1.7.8.
Sergey Kandaurov <pluknet@nginx.com>
parents: 474
diff changeset
96 # since 1.7.8, parallel requests with cache lock timeout expired are not cached
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
97
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
98 for my $i (1 .. 3) {
438
60888e2c3f5a Tests: new http_start() and http_end() functions.
Sergey Kandaurov <pluknet@nginx.com>
parents: 397
diff changeset
99 $sockets[$i] = http_get('/timeout', start => 1);
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
100 }
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
101
551
28a8248740ca Tests: proxy cache lock tests adjusted.
Sergey Kandaurov <pluknet@nginx.com>
parents: 503
diff changeset
102 like(http_end($sockets[1]), qr/request 1/, 'lock timeout - first');
28a8248740ca Tests: proxy cache lock tests adjusted.
Sergey Kandaurov <pluknet@nginx.com>
parents: 503
diff changeset
103
28a8248740ca Tests: proxy cache lock tests adjusted.
Sergey Kandaurov <pluknet@nginx.com>
parents: 503
diff changeset
104 my $rest = http_end($sockets[2]);
28a8248740ca Tests: proxy cache lock tests adjusted.
Sergey Kandaurov <pluknet@nginx.com>
parents: 503
diff changeset
105 $rest .= http_end($sockets[3]);
28a8248740ca Tests: proxy cache lock tests adjusted.
Sergey Kandaurov <pluknet@nginx.com>
parents: 503
diff changeset
106
28a8248740ca Tests: proxy cache lock tests adjusted.
Sergey Kandaurov <pluknet@nginx.com>
parents: 503
diff changeset
107 like($rest, qr/request (2.*request 3|3.*request 2)/s, 'lock timeout - rest');
498
420fbf3555dd Tests: cache lock timeout behavior changed in 1.7.8.
Sergey Kandaurov <pluknet@nginx.com>
parents: 474
diff changeset
108 like(http_get('/timeout'), qr/request 1/, 'lock timeout - first only cached');
420fbf3555dd Tests: cache lock timeout behavior changed in 1.7.8.
Sergey Kandaurov <pluknet@nginx.com>
parents: 474
diff changeset
109
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
110 # no lock
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
111
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
112 for my $i (1 .. 3) {
438
60888e2c3f5a Tests: new http_start() and http_end() functions.
Sergey Kandaurov <pluknet@nginx.com>
parents: 397
diff changeset
113 $sockets[$i] = http_get('/nolock', start => 1);
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
114 }
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
115
1021
ebdf239722b9 Tests: relaxed proxy_cache_lock.t nolock tests to fix on Solaris.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1020
diff changeset
116 $rest = join '', map { http_end($sockets[$_]) } (1 .. 3);
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
117
1021
ebdf239722b9 Tests: relaxed proxy_cache_lock.t nolock tests to fix on Solaris.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1020
diff changeset
118 like($rest, qr/request 1/, 'nolock - first');
ebdf239722b9 Tests: relaxed proxy_cache_lock.t nolock tests to fix on Solaris.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1020
diff changeset
119 like($rest, qr/request 3/, 'nolock - last');
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
120 like(http_get('/nolock'), qr/request 3/, 'nolock - last cached');
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
121
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
122 ###############################################################################
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
123
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
124 sub http_fake_daemon {
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
125 my $server = IO::Socket::INET->new(
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
126 Proto => 'tcp',
974
882267679006 Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 952
diff changeset
127 LocalAddr => '127.0.0.1:' . port(8081),
191
bc6ecf23cc9c Tests: enlarge listen queue for cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 184
diff changeset
128 Listen => 5,
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
129 Reuse => 1
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
130 )
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
131 or die "Can't create listening socket: $!\n";
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
132
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
133 my $num = 0;
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
134 my $uri = '';
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
135
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
136 while (my $client = $server->accept()) {
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
137 $client->autoflush(1);
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
138
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
139 while (<$client>) {
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
140 if (/GET (.*) HTTP/ && $1 ne $uri) {
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
141 $uri = $1;
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
142 $num = 0;
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
143 }
212
a7cc4371f4ad Tests: whitespace fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents: 191
diff changeset
144
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
145 $uri = $1 if /GET (.*) HTTP/;
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
146 last if /^\x0d?\x0a?$/;
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
147 }
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
148
213
4ac0807cc3cf Tests: eliminate race in proxy_cache_lock.t startup.
Maxim Dounin <mdounin@mdounin.ru>
parents: 212
diff changeset
149 next unless $uri;
4ac0807cc3cf Tests: eliminate race in proxy_cache_lock.t startup.
Maxim Dounin <mdounin@mdounin.ru>
parents: 212
diff changeset
150
793
ee7e07d826b8 Tests: adjusted proxy_cache_lock.t test timeout for slow hosts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 607
diff changeset
151 select(undef, undef, undef, 1.1);
184
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
152
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
153 $num++;
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
154 print $client <<"EOF";
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
155 HTTP/1.1 200 OK
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
156 Cache-Control: max-age=300
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
157 Connection: close
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
158
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
159 request $num
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
160 EOF
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
161 }
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
162 }
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
163
f432f11a3b12 Tests: proxy cache lock tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
164 ###############################################################################