Mercurial > hg > nginx-tests
annotate index2.t @ 1328:a682c219af45
Tests: updated ssl_engine_keys.t test.
After merge with libp11, pkcs11 engine shared object was renamed
from "engine_pkcs11.so" to "pkcs11.so". Changed configuration
accordingly.
Additionally, changed "init" to "1" in the engine configuration. This
keeps pkcs11 engine loaded and prevents segmentation faults observed
during nginx shutdown.
While here, restored correct order of ssl_certificate and ssl_certificate_key.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 22 May 2018 17:46:59 +0300 |
parents | 200d9d091da2 |
children | 97c8280de681 |
rev | line source |
---|---|
347
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
1265
200d9d091da2
Tests: index tests for configuration token starting with variable.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
6 # Tests for index module, which is a helper for testing |
200d9d091da2
Tests: index tests for configuration token starting with variable.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
7 # configuration token that starts with a variable. |
347
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 ############################################################################### |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use warnings; |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 use strict; |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 use Test::More; |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 BEGIN { use FindBin; chdir($FindBin::Bin); } |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 use lib 'lib'; |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 use Test::Nginx; |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 ############################################################################### |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 select STDERR; $| = 1; |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 select STDOUT; $| = 1; |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
25 |
1265
200d9d091da2
Tests: index tests for configuration token starting with variable.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
26 my $t = Test::Nginx->new()->has(qw/http/) |
347
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
27 ->write_file_expand('nginx.conf', <<'EOF'); |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 %%TEST_GLOBALS%% |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 daemon off; |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 events { |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 } |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 http { |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 %%TEST_GLOBALS_HTTP%% |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
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; |
347
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 server_name localhost; |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 add_header X-URI $uri; |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 location /var/ { |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 alias %%TESTDIR%%/; |
1265
200d9d091da2
Tests: index tests for configuration token starting with variable.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
46 index ${server_name}html; |
347
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 } |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 } |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 } |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 EOF |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 |
1265
200d9d091da2
Tests: index tests for configuration token starting with variable.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
53 $t->write_file('localhosthtml', 'varbody'); |
347
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 |
1265
200d9d091da2
Tests: index tests for configuration token starting with variable.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
55 $t->try_run('unsupported token')->plan(1); |
347
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 ############################################################################### |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 |
1265
200d9d091da2
Tests: index tests for configuration token starting with variable.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
59 like(http_get('/var/'), qr/X-URI: \/var\/localhosthtml.*varbody/ms, 'var'); |
347
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 |
f6d195aa0303
Tests: added tests for index module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 ############################################################################### |