Mercurial > hg > nginx-tests
annotate proxy_cache_min_free.t @ 1829:a78c32419f02
Tests: separate SSL session reuse tests.
Instead of being mixed with generic SSL tests, session reuse variants
are now tested in a separate file.
In the generic SSL tests only basic session reuse is now tested,
notably with session tickets enabled and a shared SSL session cache.
This should make it possible to reuse sessions in all cases (except
when it's not supported, such as with LibreSSL with TLSv1.3).
Note that session reuse with tickets implies that $ssl_session_id
is selected by the client and therefore is not available on the
initial connection. Relevant test is modified to handle this.
Further, BoringSSL does not use legacy session ID with TLSv1.3 even
if it is sent by the client. In contrast, OpenSSL always generates
an unique legacy session id, so it is available with TLSv1.3 even if
session resumption does not work (such as with old Net::SSLeay and
IO::Socket::SSL modules).
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 23 Mar 2023 19:49:47 +0300 |
parents | 5ac6efbe5552 |
children |
rev | line source |
---|---|
1576
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Tests for http proxy cache, min_free parameter. |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 use lib 'lib'; |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 use Test::Nginx; |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 ############################################################################### |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 select STDERR; $| = 1; |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 select STDOUT; $| = 1; |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
25 my $t = Test::Nginx->new()->has(qw/http proxy cache/) |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
26 ->write_file_expand('nginx.conf', <<'EOF'); |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
27 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 %%TEST_GLOBALS%% |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 daemon off; |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 events { |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 } |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 http { |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 %%TEST_GLOBALS_HTTP%% |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 proxy_cache_path %%TESTDIR%%/cache levels=1:2 min_free=4k |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 keys_zone=NAME:1m; |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 server { |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 listen 127.0.0.1:8080; |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 server_name localhost; |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 location / { |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 proxy_pass http://127.0.0.1:8081; |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 proxy_cache NAME; |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 proxy_cache_valid any 1m; |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 add_header X-Cache-Status $upstream_cache_status; |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 } |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 } |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 server { |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 listen 127.0.0.1:8081; |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 server_name localhost; |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
59 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 location / { } |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 } |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
62 } |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
63 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 EOF |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
65 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
66 $t->write_file('t.html', 'SEE-THIS'); |
1693
5ac6efbe5552
Tests: removed TODO and try_run() checks for legacy versions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1576
diff
changeset
|
67 $t->run()->plan(2); |
1576
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
68 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
69 ############################################################################### |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
70 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
71 like(http_get('/t.html'), qr/SEE-THIS/, 'proxy request'); |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
72 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
73 $t->write_file('t.html', 'NOOP'); |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
74 like(http_get('/t.html'), qr/SEE-THIS/, 'proxy request cached'); |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
75 |
8177323823d6
Tests: proxy_cache_path with min_free parameter.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
76 ############################################################################### |