changeset 1010:4f739c15069e

Tests: stream $protocol tests.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 26 Aug 2016 16:28:22 +0300
parents 9f576b8bb4c8
children 9b87810c75ca
files stream_variables.t
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/stream_variables.t
+++ b/stream_variables.t
@@ -16,7 +16,7 @@ BEGIN { use FindBin; chdir($FindBin::Bin
 
 use lib 'lib';
 use Test::Nginx;
-use Test::Nginx::Stream qw/ stream /;
+use Test::Nginx::Stream qw/ stream dgram /;
 
 ###############################################################################
 
@@ -66,11 +66,17 @@ stream {
         listen  127.0.0.1:8085;
         return  $msec!$time_local!$time_iso8601;
     }
+
+    server {
+        listen  127.0.0.1:8086;
+        listen  127.0.0.1:%%PORT_8087_UDP%% udp;
+        return  $protocol;
+    }
 }
 
 EOF
 
-$t->try_run('no stream return')->plan(6);
+$t->try_run('no stream return')->plan(8);
 
 ###############################################################################
 
@@ -94,4 +100,7 @@ is(unpack("H*", $data), '0' x 31 . '1', 
 $data = stream('127.0.0.1:' . port(8085))->read();
 like($data, qr#^\d+.\d+![-+\w/: ]+![-+\dT:]+$#, 'time');
 
+is(stream('127.0.0.1:' . port(8086))->read(), 'TCP', 'protocol TCP');
+is(dgram('127.0.0.1:' . port(8087))->io('.'), 'UDP', 'protocol UDP');
+
 ###############################################################################