Mercurial > hg > nginx-tests
annotate proxy_cache_path.t @ 1912:f61d1b4ac638
Tests: unbreak quic_ciphers.t with AEAD_AES_128_CCM enabled.
Although CCM ciphers are disabled in a stock OpenSSL as rarely used,
"to reduce ClientHello bloat", AEAD_AES_128_CCM is apparently turned
back in certain distributions such as RHEL. Previously, this caused
testing connections to fail as the CCM cipher being negotiated isn't
supported yet in nginx. Now the test is skipped instead on failure.
While here, fixed nearby style.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 14 Jun 2023 16:57:01 +0400 |
parents | 196d33c2bb45 |
children |
rev | line source |
---|---|
521
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Tests for http proxy cache with use_temp_path parameter. |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 use lib 'lib'; |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 use Test::Nginx; |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 ############################################################################### |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 select STDERR; $| = 1; |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 select STDOUT; $| = 1; |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 |
1020
196d33c2bb45
Tests: removed TODO and try_run() checks for legacy versions.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
974
diff
changeset
|
25 my $t = Test::Nginx->new()->has(qw/http proxy cache/)->plan(6) |
521
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
26 ->write_file_expand('nginx.conf', <<'EOF'); |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
27 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 %%TEST_GLOBALS%% |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 daemon off; |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 events { |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 } |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 http { |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 %%TEST_GLOBALS_HTTP%% |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 proxy_cache_path %%TESTDIR%%/cache1 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 keys_zone=ON:1m use_temp_path=on; |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 proxy_cache_path %%TESTDIR%%/cache2 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 keys_zone=OFF:1m use_temp_path=off; |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 proxy_cache_path %%TESTDIR%%/cache4 levels=1:2 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 keys_zone=LEVELS:1m use_temp_path=off; |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
46 listen 127.0.0.1:8080; |
521
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 server_name localhost; |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 location / { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
50 proxy_pass http://127.0.0.1:8081; |
521
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 proxy_cache $arg_c; |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 proxy_cache_valid any 1m; |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 add_header X-Cache-Status $upstream_cache_status; |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 } |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 } |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
59 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
61 listen 127.0.0.1:8081; |
521
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
62 server_name localhost; |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
63 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 location / { |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
65 } |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
66 } |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
67 } |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
68 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
69 EOF |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
70 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
71 $t->write_file('t', 'SEE-THIS'); |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
72 |
568
907e89fba9c3
Tests: removed TODO and try_run() checks for legacy versions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
522
diff
changeset
|
73 $t->run(); |
521
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
74 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
75 ############################################################################### |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
76 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
77 like(http_get('/t?c=ON'), qr/MISS.*SEE-THIS/ms, 'temp path'); |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
78 like(http_get('/t?c=OFF'), qr/MISS.*SEE-THIS/ms, 'temp path off'); |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
79 like(http_get('/t?c=LEVELS'), qr/MISS.*SEE-THIS/ms, 'temp path levels'); |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
80 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
81 $t->write_file('t', 'SEE-THAT'); |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
82 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
83 like(http_get('/t?c=ON'), qr/HIT.*SEE-THIS/ms, 'temp path cached'); |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
84 like(http_get('/t?c=OFF'), qr/HIT.*SEE-THIS/ms, 'temp path cached off'); |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
85 like(http_get('/t?c=LEVELS'), qr/HIT.*SEE-THIS/ms, 'temp path cached levels'); |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
86 |
6b9bfe18fdc8
Tests: proxy_cache_path with use_temp_path parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
87 ############################################################################### |