Mercurial > hg > nginx-tests
comparison proxy_variables.t @ 1401:2b461d4af65f
Tests: adjusted upstream response time tests for upcoming changes.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 21 Nov 2018 13:37:01 +0300 |
parents | 3bc5df417f62 |
children | db77d757ded4 |
comparison
equal
deleted
inserted
replaced
1400:94bcad5611af | 1401:2b461d4af65f |
---|---|
20 ############################################################################### | 20 ############################################################################### |
21 | 21 |
22 select STDERR; $| = 1; | 22 select STDERR; $| = 1; |
23 select STDOUT; $| = 1; | 23 select STDOUT; $| = 1; |
24 | 24 |
25 my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(18) | 25 my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(19) |
26 ->write_file_expand('nginx.conf', <<'EOF'); | 26 ->write_file_expand('nginx.conf', <<'EOF'); |
27 | 27 |
28 %%TEST_GLOBALS%% | 28 %%TEST_GLOBALS%% |
29 | 29 |
30 daemon off; | 30 daemon off; |
97 | 97 |
98 ($ct, $ht) = get('/body'); | 98 ($ct, $ht) = get('/body'); |
99 cmp_ok($ct, '<', 1, 'connect time - slow response body'); | 99 cmp_ok($ct, '<', 1, 'connect time - slow response body'); |
100 cmp_ok($ht, '<', 1, 'header time - slow response body'); | 100 cmp_ok($ht, '<', 1, 'header time - slow response body'); |
101 | 101 |
102 ($ct, $ct2, $ht, $ht2, $rt) = get('/pnu', many => 1); | 102 # expect no header time in 1st (bad) upstream, no (yet) response time in 2nd |
103 | |
104 $re = qr/(\d\.\d{3}|-)/; | |
105 ($ct, $ct2, $ht, $ht2, $rt, $rt2) = get('/pnu', many => 1); | |
103 cmp_ok($ct, '<', 1, 'connect time - next'); | 106 cmp_ok($ct, '<', 1, 'connect time - next'); |
104 cmp_ok($ct2, '<', 1, 'connect time - next 2'); | 107 cmp_ok($ct2, '<', 1, 'connect time - next 2'); |
105 cmp_ok($ht, '>=', 1, 'header time - next'); | 108 |
109 TODO: { | |
110 local $TODO = 'not yet'; | |
111 | |
112 is($ht, '-', 'header time - next'); | |
113 | |
114 } | |
115 | |
106 cmp_ok($ht2, '<', 1, 'header time - next 2'); | 116 cmp_ok($ht2, '<', 1, 'header time - next 2'); |
107 is($ht, $rt, 'header time - bad response'); | 117 cmp_ok($rt, '>=', 1, 'response time - next'); |
118 | |
119 TODO: { | |
120 local $TODO = 'not yet'; | |
121 | |
122 is($rt2, '-', 'response time - next 2'); | |
123 | |
124 } | |
108 | 125 |
109 $t->stop(); | 126 $t->stop(); |
110 | 127 |
128 $re = qr/(\d\.\d{3})/; | |
111 ($ct, $ht, $rt, $ct2, $ht2, $rt2) | 129 ($ct, $ht, $rt, $ct2, $ht2, $rt2) |
112 = $t->read_file('time.log') =~ /^$re:$re:$re\n$re:$re:$re$/; | 130 = $t->read_file('time.log') =~ /^$re:$re:$re\n$re:$re:$re$/; |
113 | 131 |
114 cmp_ok($ct, '<', 1, 'connect time log - slow response header'); | 132 cmp_ok($ct, '<', 1, 'connect time log - slow response header'); |
115 cmp_ok($ct2, '<', 1, 'connect time log - slow response body'); | 133 cmp_ok($ct2, '<', 1, 'connect time log - slow response body'); |