changeset 1199:08f6eacf1cfe

Tests: stream proxy next upstream with ssl_preread (ticket #1317). Ensure that next TCP upstream can be selected with pending buffers.
author Andrey Zelenkov <zelenkov@nginx.com>
date Wed, 26 Jul 2017 16:42:48 +0300
parents cd153f1bbaad
children 630c3e7a5d40
files stream_ssl_preread.t
diffstat 1 files changed, 23 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/stream_ssl_preread.t
+++ b/stream_ssl_preread.t
@@ -50,6 +50,11 @@ stream {
         server 127.0.0.1:8092;
     }
 
+    upstream next {
+        server 127.0.0.1:8094;
+        server 127.0.0.1:8080;
+    }
+
     ssl_preread  on;
 
     server {
@@ -78,6 +83,14 @@ stream {
         access_log %%TESTDIR%%/status.log status;
     }
 
+    server {
+        listen       127.0.0.1:8084;
+        proxy_pass   next;
+
+        proxy_connect_timeout  2s;
+        preread_buffer_size    8;
+    }
+
     ssl_certificate_key localhost.key;
     ssl_certificate localhost.crt;
 
@@ -109,7 +122,7 @@ eval {
 };
 plan(skip_all => 'Net::SSLeay with OpenSSL SNI support required') if $@;
 
-$t->plan(11);
+$t->plan(12);
 
 $t->write_file('openssl.conf', <<EOF);
 [ req ]
@@ -133,7 +146,7 @@ foreach my $name ('localhost') {
 
 ###############################################################################
 
-my ($p1, $p2, $p3) = (port(8091), port(8092), port(8093));
+my ($p1, $p2, $p3, $p4) = (port(8091), port(8092), port(8093), port(8084));
 
 is(get_ssl('foo', 8081), $p1, 'sni');
 is(get_ssl('foo', 8081), $p1, 'sni again');
@@ -148,6 +161,14 @@ is(get_ssl('foo', 8082), $p3, 'preread o
 is(get_ssl('foo', 8083), undef, 'preread buffer full');
 is(stream()->io('x' x 1000), "127.0.0.1:$p3", 'not a handshake');
 
+TODO: {
+local $TODO = 'not yet';
+
+is(stream("127.0.0.1:$p4")->io('x' x 16), "127.0.0.1:$p3",
+	'pending buffers on next upstream');
+
+}
+
 # no junk in variable due to short ClientHello length value
 
 is(get_short(), "127.0.0.1:$p3", 'short client hello');