Mercurial > hg > nginx-tests
annotate addition_buffered.t @ 1282:fd281e3a3df5
Tests: better test names in h2_server_push.t.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 12 Feb 2018 14:46:40 +0300 |
parents | 766bcbb632ee |
children |
rev | line source |
---|---|
1056
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Tests for addition module with buffered data from other filters. |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 # In particular, sub filter may have a partial match buffered. |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 ############################################################################### |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 use warnings; |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use strict; |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 use Test::More; |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 BEGIN { use FindBin; chdir($FindBin::Bin); } |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 use lib 'lib'; |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 use Test::Nginx; |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 ############################################################################### |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 select STDERR; $| = 1; |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
25 select STDOUT; $| = 1; |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
26 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
27 my $t = Test::Nginx->new()->has(qw/http proxy sub addition/)->plan(1); |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 $t->write_file_expand('nginx.conf', <<'EOF'); |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 %%TEST_GLOBALS%% |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 daemon off; |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 events { |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 } |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 http { |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 %%TEST_GLOBALS_HTTP%% |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 server { |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 listen 127.0.0.1:8080; |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 server_name localhost; |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 location / { } |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 location /proxy/ { |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 sub_filter foo bar; |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 add_after_body /after.html; |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 proxy_pass http://127.0.0.1:8080/; |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 } |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 } |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 } |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 EOF |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 $t->write_file('after.html', 'after'); |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 $t->write_file('body.html', 'XXXXX'); |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
59 $t->run(); |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 ############################################################################### |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
62 |
1059 | 63 # if data is buffered, there should be no interleaved data in output |
1056
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
65 like(http_get('/proxy/body.html'), qr/^XXXXXafter$/m, 'request'); |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
66 |
1e41a0de0772
Tests: various last_buf tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
67 ############################################################################### |