Mercurial > hg > nginx-tests
annotate post_action.t @ 1453:6f53ec0cf591
Tests: simplified stream_proxy_ssl_verify.t using return directive.
Due to changed connection processing, it no longer triggers "phantom event"
alerts previously seen with Solaris devpoll on connections closed by client
in test cases with failed verification of the proxied server certificate.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 25 Mar 2019 19:11:11 +0300 |
parents | 882267679006 |
children |
rev | line source |
---|---|
453 | 1 #!/usr/bin/perl |
2 | |
3 # (C) Maxim Dounin | |
4 # (C) Nginx, Inc. | |
5 | |
6 # Tests for nginx post_action directive. | |
7 | |
8 ############################################################################### | |
9 | |
10 use warnings; | |
11 use strict; | |
12 | |
13 use Test::More; | |
14 | |
15 BEGIN { use FindBin; chdir($FindBin::Bin); } | |
16 | |
17 use lib 'lib'; | |
18 use Test::Nginx; | |
19 | |
20 ############################################################################### | |
21 | |
22 select STDERR; $| = 1; | |
23 select STDOUT; $| = 1; | |
24 | |
593
6c0a5903d0ae
Tests: cleanup now duplicating tests for no alerts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
548
diff
changeset
|
25 my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(5); |
453 | 26 |
27 $t->write_file_expand('nginx.conf', <<'EOF'); | |
28 | |
29 %%TEST_GLOBALS%% | |
30 | |
31 daemon off; | |
32 | |
33 events { | |
34 } | |
35 | |
36 http { | |
37 %%TEST_GLOBALS_HTTP%% | |
38 | |
39 server { | |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
40 listen 127.0.0.1:8080; |
453 | 41 server_name localhost; |
42 | |
43 location / { | |
44 post_action /post.html; | |
45 } | |
46 | |
47 location /post.html { | |
48 # static | |
49 } | |
50 | |
51 location /remote { | |
52 post_action /post.remote; | |
53 } | |
54 | |
55 location /post.remote { | |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
56 proxy_pass http://127.0.0.1:8080/post.html; |
453 | 57 } |
58 } | |
59 } | |
60 | |
61 EOF | |
62 | |
63 $t->write_file('index.html', 'SEE-THIS'); | |
64 $t->write_file('post.html', 'HIDDEN'); | |
65 $t->write_file('remote', 'SEE-THIS'); | |
66 | |
67 $t->run(); | |
68 | |
69 ############################################################################### | |
70 | |
71 like(http_get('/'), qr/SEE-THIS/m, 'post action'); | |
72 unlike(http_get('/'), qr/HIDDEN/m, 'no additional body'); | |
73 | |
74 like(http_get('/remote'), qr/SEE-THIS/m, 'post action proxy'); | |
75 unlike(http_get('/remote'), qr/HIDDEN/m, 'no additional body proxy'); | |
76 | |
77 $t->stop(); | |
78 | |
79 like(`cat ${\($t->testdir())}/access.log`, qr/post/, 'post action in logs'); | |
80 | |
81 ############################################################################### |