changeset 1535:144c6ce732e4

Tests: removed TODO and try_run() checks for legacy versions.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 02 Dec 2019 14:56:37 +0300
parents 96fb3513345b
children 0ce1c9516764
files dav.t geo_unix.t grpc.t h2_server_push.t http_listen.t limit_req_delay.t proxy.t proxy_cache_use_stale.t proxy_variables.t rewrite.t ssl_certificate.t ssl_certificate_perl.t ssl_engine_keys.t ssl_sni.t ssl_sni_reneg.t stream_geo_unix.t stream_ssl_certificate.t stream_ssl_preread_protocol.t stream_ssl_variables.t stream_udp_limit_conn.t stream_udp_limit_rate.t stream_udp_proxy_requests.t stream_udp_stream.t stream_udp_upstream.t stream_upstream_random.t upstream_keepalive.t upstream_random.t userid.t
diffstat 28 files changed, 26 insertions(+), 152 deletions(-) [+]
line wrap: on
line diff
--- a/dav.t
+++ b/dav.t
@@ -146,7 +146,6 @@ Connection: close
 EOF
 
 like($r, qr/204 No Content/, 'copy file escaped');
-
 is(-s $t->testdir() . '/file-moved escape', 10, 'file copied unescaped');
 
 $t->write_file('file.exist', join '', (1 .. 42));
@@ -160,14 +159,8 @@ Connection: close
 EOF
 
 like($r, qr/204 No Content/, 'copy file overwrite');
-
-TODO: {
-local $TODO = 'not yet' unless $t->has_version('1.15.3');
-
 is(-s $t->testdir() . '/file.exist', 10, 'target file truncated');
 
-}
-
 $r = http(<<EOF . '0123456789');
 PUT /i/alias HTTP/1.1
 Host: localhost
--- a/geo_unix.t
+++ b/geo_unix.t
@@ -93,15 +93,8 @@ EOF
 ###############################################################################
 
 my $r = http_get('/');
-
-TODO: {
-local $TODO = 'not yet' unless $t->has_version('1.15.8');
-
 like($r, qr/^X-Geo: none/m, 'geo unix');
 like($r, qr/^X-Ranges: none/m, 'geo unix ranges');
-
-}
-
 like($r, qr/^X-Addr: none/m, 'geo unix remote addr');
 like($r, qr/^X-Ranges-Addr: none/m, 'geo unix ranges remote addr');
 
--- a/grpc.t
+++ b/grpc.t
@@ -199,8 +199,6 @@ cmp_ok($frame->{sid}, '>', $sid, 'keepal
 is($frame->{headers}{'x-connection'}, $c, 'keepalive 2 - connection reuse');
 
 undef $f;
-# don't bother with a new instance until the old one is over
-select undef, undef, undef, 0.2 unless $t->has_version('1.15.4');
 $f = grpc();
 
 # various header compression formats
--- a/h2_server_push.t
+++ b/h2_server_push.t
@@ -409,9 +409,6 @@ gunzip_like($frame->{data}, qr/^PROMISED
 
 # scheme https
 
-TODO: {
-local $TODO = 'not yet' unless $t->has_version('1.15.1');
-
 $s = Test::Nginx::HTTP2->new();
 $sid = $s->new_stream({ headers => [
 	{ name => ':method', value => 'GET', mode => 0 },
@@ -423,8 +420,6 @@ local $TODO = 'not yet' unless $t->has_v
 ($frame) = grep { $_->{type} eq "PUSH_PROMISE" && $_->{sid} == $sid } @$frames;
 is($frame->{headers}->{':scheme'}, 'https', 'scheme https');
 
-}
-
 ###############################################################################
 
 sub gunzip_like {
--- a/http_listen.t
+++ b/http_listen.t
@@ -76,7 +76,7 @@ plan(skip_all => 'listen on wildcard add
 plan(skip_all => 'no requested ranges')
 	if "$p0$p1$p2$p3$p4$p5$p6$p7" ne "80808081808280838084808580868087";
 
-$t->try_run('no listen port ranges')->plan(12);
+$t->run()->plan(12);
 
 ###############################################################################
 
--- a/limit_req_delay.t
+++ b/limit_req_delay.t
@@ -22,7 +22,7 @@ use Test::Nginx qw/ :DEFAULT http_end /;
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
-my $t = Test::Nginx->new()->has(qw/http limit_req/);
+my $t = Test::Nginx->new()->has(qw/http limit_req/)->plan(4);
 
 $t->write_file_expand('nginx.conf', <<'EOF');
 
@@ -52,7 +52,7 @@ http {
 EOF
 
 $t->write_file('delay.html', 'XtestX');
-$t->try_run('no limit_req delay')->plan(4);
+$t->run();
 
 ###############################################################################
 
--- a/proxy.t
+++ b/proxy.t
@@ -21,7 +21,7 @@ use Test::Nginx;
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
-my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(30);
+my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(28);
 
 $t->write_file_expand('nginx.conf', <<'EOF');
 
@@ -137,26 +137,16 @@ close ($s);
 
 $re = qr/(\d\.\d{3}|-)/;
 ($ct, $ct2, $ht, $ht2, $rt, $rt2) = get('/pnu', many => 1);
+
 cmp_ok($ct, '<', 1, 'connect time - next');
 cmp_ok($ct2, '<', 1, 'connect time - next 2');
 
-TODO: {
-local $TODO = 'not yet' unless $t->has_version('1.15.7');
-
 is($ht, '-', 'header time - next');
-
-}
-
 cmp_ok($ht2, '<', 1, 'header time - next 2');
+
 cmp_ok($rt, '>=', 1, 'response time - next');
-
-TODO: {
-local $TODO = 'not yet' unless $t->has_version('1.15.7');
-
 is($rt2, '-', 'response time - next 2');
 
-}
-
 $t->stop();
 
 ($ct, $ht, $rt, $ct2, $ht2, $rt2, $ct3, $ht3, $rt3)
@@ -164,15 +154,6 @@ is($rt2, '-', 'response time - next 2');
 
 cmp_ok($ct, '<', 1, 'connect time log - slow response header');
 cmp_ok($ct2, '<', 1, 'connect time log - slow response body');
-
-TODO: {
-local $TODO = 'not yet' unless $t->has_version('1.15.7');
-
-isnt($ct3, '-', 'connect time log - client close set');
-
-}
-
-$ct3 = 0 if $ct3 eq '-';
 cmp_ok($ct3, '<', 1, 'connect time log - client close');
 
 cmp_ok($ht, '>=', 1, 'header time log - slow response header');
@@ -181,16 +162,8 @@ is($ht3, '-', 'header time log - client 
 
 cmp_ok($rt, '>=', 1, 'response time log - slow response header');
 cmp_ok($rt2, '>=', 1, 'response time log - slow response body');
-
-TODO: {
-local $TODO = 'not yet' unless $t->has_version('1.15.7');
-
-isnt($rt3, '-', 'response time log - client close set');
-$rt3 = 0 if $rt3 eq '-';
 cmp_ok($rt3, '>', $ct3, 'response time log - client close');
 
-}
-
 ###############################################################################
 
 sub get {
--- a/proxy_cache_use_stale.t
+++ b/proxy_cache_use_stale.t
@@ -197,14 +197,8 @@ like(http_get('/t5.html'), qr/REVALIDATE
 # proxy_pass to regular expression with named and positional captures
 
 like(http_get('/regexp.html'), qr/STALE/, 's-w-r - regexp background update');
-
-TODO: {
-local $TODO = 'not yet' unless $t->has_version('1.15.8');
-
 like(http_get('/regexp.html'), qr/HIT/, 's-w-r - regexp revalidated');
 
-}
-
 # UPDATING while s-w-r
 
 $t->write_file('t6.html', 'SEE-THAT');
--- a/proxy_variables.t
+++ b/proxy_variables.t
@@ -22,7 +22,7 @@ use Test::Nginx;
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
-my $t = Test::Nginx->new()->has(qw/http proxy/)
+my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(4)
 	->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
@@ -52,7 +52,7 @@ http {
 EOF
 
 $t->run_daemon(\&http_daemon, port(8081));
-$t->try_run('upstream_bytes_sent')->plan(4);
+$t->run();
 
 $t->waitforsocket('127.0.0.1:' . port(8081));
 
--- a/rewrite.t
+++ b/rewrite.t
@@ -161,13 +161,8 @@ like(http_get('/return405'), qr!HTTP/1.1
 # this used to result in 404, but was changed in 1.15.4
 # to respond with 405 instead, much like a real error would do
 
-TODO: {
-local $TODO = 'not yet' unless $t->has_version('1.15.4');
-
 like(http_get('/error404return405'), qr!HTTP/1.1 405!, 'error 404 return 405');
 
-}
-
 # status code should be 405, and entity body is expected (vs. normal 204
 # replies which doesn't expect to have body); use HTTP/1.1 for test
 # to make problem clear
--- a/ssl_certificate.t
+++ b/ssl_certificate.t
@@ -163,7 +163,7 @@ foreach my $name ('pass') {
 $t->write_file('password_file', 'pass');
 $t->write_file('index.html', '');
 
-$t->try_run('no ssl_certificate variables')->plan(11);
+$t->run()->plan(11);
 
 ###############################################################################
 
--- a/ssl_certificate_perl.t
+++ b/ssl_certificate_perl.t
@@ -97,7 +97,7 @@ foreach my $name ('one', 'two') {
 		or die "Can't create certificate for $name: $!\n";
 }
 
-$t->try_run('no ssl_certificate variables')->plan(2);
+$t->run()->plan(2);
 
 ###############################################################################
 
--- a/ssl_engine_keys.t
+++ b/ssl_engine_keys.t
@@ -28,7 +28,7 @@ plan(skip_all => 'may not work, leaves c
 	unless $ENV{TEST_NGINX_UNSAFE};
 
 my $t = Test::Nginx->new()->has(qw/http proxy http_ssl/)->has_daemon('openssl')
-	->has_daemon('softhsm')->has_daemon('pkcs11-tool');
+	->has_daemon('softhsm')->has_daemon('pkcs11-tool')->plan(2);
 
 $t->write_file_expand('nginx.conf', <<'EOF');
 
@@ -137,7 +137,7 @@ foreach my $name ('localhost') {
 		or die "Can't create certificate for $name: $!\n";
 }
 
-$t->try_run('no ssl_certificate variables')->plan(2);
+$t->run();
 
 $t->write_file('index.html', '');
 
--- a/ssl_sni.t
+++ b/ssl_sni.t
@@ -152,17 +152,11 @@ SKIP: {
 skip 'no TLS 1.3 sessions', 1 if get('/protocol', 'localhost') =~ /TLSv1.3/
 	&& ($Net::SSLeay::VERSION < 1.88 || $IO::Socket::SSL::VERSION < 2.061);
 
-TODO: {
-local $TODO = 'not yet' if $t->has_module('OpenSSL (1.1.1|3)')
-	&& !$t->has_version('1.15.10');
-
 like(get('/', 'localhost', 8081, $ctx), qr/^r:localhost$/m,
 	'ssl server name - reused');
 
 }
 
-}
-
 ###############################################################################
 
 sub get_ssl_socket {
--- a/ssl_sni_reneg.t
+++ b/ssl_sni_reneg.t
@@ -104,8 +104,6 @@ foreach my $name ('localhost') {
 
 ###############################################################################
 
-my ($ossl) = $t->{_configure_args} =~ /OpenSSL ([\d\.]+)/;
-
 my ($s, $ssl) = get_ssl_socket(8080);
 ok($s, 'connection');
 
@@ -121,18 +119,11 @@ ok(Net::SSLeay::set_tlsext_host_name($ss
 
 Net::SSLeay::write($ssl, 'Host: localhost' . CRLF . CRLF);
 
-TODO: {
-local $TODO = 'not yet' if $ossl ge '1.1.1' and $^O eq 'linux'
-	and !$t->has_version('1.15.2');
-
 ok(!Net::SSLeay::read($ssl), 'response');
 
 }
 
-}
-
 # virtual servers
-# in [1.15.4..1.15.5) SSL_OP_NO_RENEGOTIATION is cleared in servername callback
 
 ($s, $ssl) = get_ssl_socket(8081);
 ok($s, 'connection 2');
@@ -149,16 +140,10 @@ ok(Net::SSLeay::set_tlsext_host_name($ss
 
 Net::SSLeay::write($ssl, 'Host: localhost' . CRLF . CRLF);
 
-TODO: {
-local $TODO = 'not yet' if $ossl ge '1.1.1' and $^O eq 'linux'
-	and !$t->has_version('1.15.2');
-
 ok(!Net::SSLeay::read($ssl), 'virtual servers');
 
 }
 
-}
-
 ###############################################################################
 
 sub get_ssl_socket {
--- a/stream_geo_unix.t
+++ b/stream_geo_unix.t
@@ -77,15 +77,8 @@ EOF
 ###############################################################################
 
 my %data = stream('127.0.0.1:' . port(8080))->read() =~ /(\w+):(\w+)/g;
-
-TODO: {
-local $TODO = 'not yet' unless $t->has_version('1.15.8');
-
 is($data{geo}, 'none', 'geo unix');
 is($data{geor}, 'none', 'geo unix ranges');
-
-}
-
 is($data{geora}, 'none', 'geo unix remote addr');
 is($data{georra}, 'none', 'geo unix ranges remote addr');
 
--- a/stream_ssl_certificate.t
+++ b/stream_ssl_certificate.t
@@ -146,7 +146,7 @@ foreach my $name ('pass') {
 $t->write_file('password_file', 'pass');
 $t->write_file('index.html', '');
 
-$t->try_run('no ssl_certificate variables')->plan(7);
+$t->run()->plan(7);
 
 ###############################################################################
 
--- a/stream_ssl_preread_protocol.t
+++ b/stream_ssl_preread_protocol.t
@@ -23,7 +23,7 @@ select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
 my $t = Test::Nginx->new()->has(qw/stream stream_ssl_preread stream_return/)
-	->write_file_expand('nginx.conf', <<'EOF');
+	->write_file_expand('nginx.conf', <<'EOF')->plan(7)->run();
 
 %%TEST_GLOBALS%%
 
@@ -42,8 +42,6 @@ stream {
 
 EOF
 
-$t->try_run('no ssl_preread_protocol')->plan(7);
-
 ###############################################################################
 
 is(get('SSLv3'), 'SSLv3', 'client hello SSLv3');
--- a/stream_ssl_variables.t
+++ b/stream_ssl_variables.t
@@ -112,16 +112,10 @@ skip 'no sni', 3 unless $t->has_module('
 ($s, $ssl) = get_ssl_socket(port(8082), undef, 'example.com');
 is(Net::SSLeay::ssl_read_all($ssl), 'example.com', 'ssl server name');
 
-TODO: {
-local $TODO = 'not yet' if $t->has_module('OpenSSL (1.1.1|3)')
-	&& !$t->has_version('1.15.10');
-
 my $ses = Net::SSLeay::get_session($ssl);
 ($s, $ssl) = get_ssl_socket(port(8082), $ses, 'example.com');
 is(Net::SSLeay::ssl_read_all($ssl), 'example.com', 'ssl server name - reused');
 
-}
-
 ($s, $ssl) = get_ssl_socket(port(8082));
 is(Net::SSLeay::ssl_read_all($ssl), '', 'ssl server name empty');
 
--- a/stream_udp_limit_conn.t
+++ b/stream_udp_limit_conn.t
@@ -90,13 +90,8 @@ is($s->io('1'), '1', 'passed');
 # regardless of incomplete responses, new requests in the same
 # socket will be treated as requests in existing session
 
-TODO: {
-local $TODO = 'not yet' unless $t->has_version('1.15.0');
-
 is($s->io('1', read_timeout => 0.4), '1', 'passed new request');
 
-}
-
 is(dgram('127.0.0.1:' . port(8981))->io('1', read_timeout => 0.1), '',
 	'rejected new session');
 is(dgram('127.0.0.1:' . port(8982))->io('1'), '1', 'passed different zone');
--- a/stream_udp_limit_rate.t
+++ b/stream_udp_limit_rate.t
@@ -23,7 +23,7 @@ use Test::Nginx::Stream qw/ dgram /;
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
-my $t = Test::Nginx->new()->has(qw/stream udp/)
+my $t = Test::Nginx->new()->has(qw/stream udp/)->plan(8)
 	->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
@@ -59,7 +59,7 @@ stream {
 EOF
 
 $t->run_daemon(\&udp_daemon, port(8980), $t);
-$t->try_run('no proxy_requests')->plan(8);
+$t->run();
 
 $t->waitforfile($t->testdir . '/' . port(8980));
 
@@ -75,23 +75,14 @@ is($s->io($str), $str, 'unlimited 2');
 
 # datagram doesn't get split
 
-my $t1;
-
-TODO: {
-local $TODO = 'split datagram' unless $t->has_version('1.15.9');
-
 $s = dgram('127.0.0.1:' . port(8983));
 is($s->io($str), $str, 'download');
-$t1 = time();
+my $t1 = time();
 is($s->io($str), $str, 'download 2');
-
-}
-
 my $t2 = time();
 cmp_ok($t1, '<', $t2, 'download 2 delayed');
 
-TODO: {
-todo_skip 'infinite event report', 3 unless $t->has_version('1.15.9');
+# infinite event report before 1.15.9
 
 $s = dgram('127.0.0.1:' . port(8984));
 is($s->io($str), $str, 'upload');
@@ -100,8 +91,6 @@ is($s->io($str, read_timeout => 0.5), ''
 select undef, undef, undef, 1.6;
 is($s->io($str), $str, 'upload passed');
 
-}
-
 ###############################################################################
 
 sub udp_daemon {
--- a/stream_udp_proxy_requests.t
+++ b/stream_udp_proxy_requests.t
@@ -23,7 +23,7 @@ use Test::Nginx::Stream qw/ dgram /;
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
-my $t = Test::Nginx->new()->has(qw/stream udp/)
+my $t = Test::Nginx->new()->has(qw/stream udp/)->plan(26)
 	->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
@@ -87,7 +87,7 @@ EOF
 
 $t->run_daemon(\&udp_daemon, $t, port(8990));
 $t->run_daemon(\&udp_daemon, $t, port(8991));
-$t->try_run('no proxy_requests')->plan(26);
+$t->run();
 
 $t->waitforfile($t->testdir . '/' . port(8990));
 $t->waitforfile($t->testdir . '/' . port(8991));
--- a/stream_udp_stream.t
+++ b/stream_udp_stream.t
@@ -62,17 +62,12 @@ isnt($data2, '', 'udp_stream response 2'
 
 isnt($data, $data2, 'udp_stream two sessions');
 
-TODO: {
-local $TODO = 'not yet' unless $t->has_version('1.15.0');
-
 is($s->io('1'), $data, 'udp_stream session 1');
 is($s->io('1'), $data, 'udp_stream session 2');
 
 is($s2->io('1'), $data2, 'udp_stream another session 1');
 is($s2->io('1'), $data2, 'udp_stream another session 2');
 
-}
-
 select undef, undef, undef, 1.1;
 
 isnt($s->io('1'), $data, 'udp_stream new session');
--- a/stream_udp_upstream.t
+++ b/stream_udp_upstream.t
@@ -95,14 +95,9 @@ my @ports = my ($port4, $port5) = (port(
 
 is(many(10, port(8980)), "$port4: 5, $port5: 5", 'balanced');
 
-TODO: {
-local $TODO = 'not yet' unless $t->has_version('1.15.0');
-
 is(dgram('127.0.0.1:' . port(8981))->io('.', read_timeout => 0.5), '',
 	'no next upstream for dgram');
 
-}
-
 is(many(10, port(8981)), "$port4: 5, $port5: 5", 'failures');
 
 is(many(9, port(8982)), "$port4: 3, $port5: 6", 'weight');
--- a/stream_upstream_random.t
+++ b/stream_upstream_random.t
@@ -23,7 +23,7 @@ select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
 my $t = Test::Nginx->new()
-	->has(qw/stream stream_upstream_zone stream_upstream_random/)
+	->has(qw/stream stream_upstream_zone stream_upstream_random/)->plan(12)
 	->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
@@ -170,7 +170,7 @@ EOF
 
 $t->run_daemon(\&http_daemon, port(8081));
 $t->run_daemon(\&http_daemon, port(8082));
-$t->try_run('no upstream random')->plan(12);
+$t->run();
 
 $t->waitforsocket('127.0.0.1:' . port(8081));
 $t->waitforsocket('127.0.0.1:' . port(8082));
--- a/upstream_keepalive.t
+++ b/upstream_keepalive.t
@@ -22,7 +22,7 @@ use Test::Nginx;
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
-my $t = Test::Nginx->new()->has(qw/http proxy upstream_keepalive/)
+my $t = Test::Nginx->new()->has(qw/http proxy upstream_keepalive/)->plan(7)
 	->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
@@ -67,7 +67,7 @@ http {
 EOF
 
 $t->write_file('index.html', 'SEE-THIS');
-$t->try_run('no keepalive_requests')->plan(7);
+$t->run();
 
 ###############################################################################
 
--- a/upstream_random.t
+++ b/upstream_random.t
@@ -23,7 +23,7 @@ select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
 my $t = Test::Nginx->new()->has(qw/http proxy upstream_zone upstream_random/)
-	->write_file_expand('nginx.conf', <<'EOF');
+	->plan(12)->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
 
@@ -140,7 +140,7 @@ EOF
 
 $t->run_daemon(\&http_daemon, port(8081));
 $t->run_daemon(\&http_daemon, port(8082));
-$t->try_run('no upstream random')->plan(12);
+$t->run();
 
 $t->waitforsocket('127.0.0.1:' . port(8081));
 $t->waitforsocket('127.0.0.1:' . port(8082));
--- a/userid.t
+++ b/userid.t
@@ -227,13 +227,8 @@ is(substr(uid_set(http_get('/service')),
 $addr = $bigendian ? "00000001" : "01000000";
 is(substr(uid_set(http_get('/ip6')), 0, 8), $addr, 'service ipv6');
 
-TODO: {
-local $TODO = 'not yet' unless $t->has_version('1.15.8');
-
 is(substr(uid_set(http_get('/unix')), 0, 8), "00000000", 'service unix');
 
-}
-
 # reset log
 
 send_uid('/?log', cookie($r, 'uid'));