Mercurial > hg > nginx-tests
comparison config_dump.t @ 1060:a07205e8bb76
Tests: added "nginx -T" tests for unique dumped files.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 19 Oct 2016 17:59:03 +0300 |
parents | 196d33c2bb45 |
children | 766bcbb632ee |
comparison
equal
deleted
inserted
replaced
1059:8c5ba361b416 | 1060:a07205e8bb76 |
---|---|
23 select STDERR; $| = 1; | 23 select STDERR; $| = 1; |
24 select STDOUT; $| = 1; | 24 select STDOUT; $| = 1; |
25 | 25 |
26 my $t = Test::Nginx->new()->has(qw/http map/); | 26 my $t = Test::Nginx->new()->has(qw/http map/); |
27 | 27 |
28 $t->plan(10)->write_file_expand('nginx.conf', <<'EOF'); | 28 $t->plan(13)->write_file_expand('nginx.conf', <<'EOF'); |
29 | 29 |
30 %%TEST_GLOBALS%% | 30 %%TEST_GLOBALS%% |
31 | 31 |
32 daemon off; | 32 daemon off; |
33 | 33 |
34 include %%TESTDIR%%/inc.conf; | |
34 include %%TESTDIR%%/inc.conf; | 35 include %%TESTDIR%%/inc.conf; |
35 | 36 |
36 events { | 37 events { |
37 } | 38 } |
38 | 39 |
40 %%TEST_GLOBALS_HTTP%% | 41 %%TEST_GLOBALS_HTTP%% |
41 | 42 |
42 map $args $x { | 43 map $args $x { |
43 default 0; | 44 default 0; |
44 foo bar; | 45 foo bar; |
46 include map.conf; | |
45 include map.conf; | 47 include map.conf; |
46 } | 48 } |
47 | 49 |
48 upstream u { | 50 upstream u { |
49 server 127.0.0.1:8081; | 51 server 127.0.0.1:8081; |
73 like($dump, qr!^# configuration file $d/nginx.conf:$!m, 'nginx.conf found'); | 75 like($dump, qr!^# configuration file $d/nginx.conf:$!m, 'nginx.conf found'); |
74 like($dump, qr!^# configuration file $d/inc.conf:$!m, 'inc.conf found'); | 76 like($dump, qr!^# configuration file $d/inc.conf:$!m, 'inc.conf found'); |
75 like($dump, qr!^# configuration file $d/inc2.conf:$!m, 'inc2.conf found'); | 77 like($dump, qr!^# configuration file $d/inc2.conf:$!m, 'inc2.conf found'); |
76 like($dump, qr!^# configuration file $d/map.conf:$!m, 'map.conf found'); | 78 like($dump, qr!^# configuration file $d/map.conf:$!m, 'map.conf found'); |
77 | 79 |
80 TODO: { | |
81 local $TODO = 'not yet' unless $t->has_version('1.11.6'); | |
82 | |
83 unlike($dump, qr!(# configuration file $d/inc.conf:).*\1!s, 'inc.conf uniq'); | |
84 unlike($dump, qr!(# configuration file $d/inc2.conf:).*\1!s, 'inc2.conf uniq'); | |
85 unlike($dump, qr!(# configuration file $d/map.conf:).*\1!s, 'map.conf uniq'); | |
86 | |
87 } | |
88 | |
78 is(getconf($t, $dump, 'nginx.conf'), $t->read_file('nginx.conf'), 'content'); | 89 is(getconf($t, $dump, 'nginx.conf'), $t->read_file('nginx.conf'), 'content'); |
79 is(getconf($t, $dump, 'inc.conf'), $t->read_file('inc.conf'), 'content inc'); | 90 is(getconf($t, $dump, 'inc.conf'), $t->read_file('inc.conf'), 'content inc'); |
80 is(getconf($t, $dump, 'map.conf'), $t->read_file('map.conf'), 'content inc 2'); | 91 is(getconf($t, $dump, 'map.conf'), $t->read_file('map.conf'), 'content inc 2'); |
81 | 92 |
82 unlink($t->testdir . "/inc.conf"); | 93 unlink($t->testdir . "/inc.conf"); |