diff http_keepalive.t @ 1509:1603f2bad385

Tests: $sent_http_connection tests.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 16 Sep 2019 19:13:18 +0300
parents 1a409a166420
children bf69dcabb856
line wrap: on
line diff
--- a/http_keepalive.t
+++ b/http_keepalive.t
@@ -24,7 +24,7 @@ use Test::Nginx;
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
-my $t = Test::Nginx->new()->has(qw/http/)->plan(13)
+my $t = Test::Nginx->new()->has(qw/http/)->plan(14)
 	->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
@@ -37,6 +37,9 @@ events {
 http {
     %%TEST_GLOBALS_HTTP%%
 
+    log_format test $sent_http_connection;
+    access_log %%TESTDIR%%/test.log test if=$arg_l;
+
     server {
         listen       127.0.0.1:8080;
         server_name  localhost;
@@ -77,7 +80,7 @@ EOF
 # keepalive_requests
 
 like(http_keepalive('/'), qr/Connection: keep-alive/, 'keepalive request');
-is(count_keepalive(http_keepalive('/', req => 2)), 1, 'keepalive limit');
+is(count_keepalive(http_keepalive('/?l=ok', req => 2)), 1, 'keepalive limit');
 is(count_keepalive(http_keepalive('/r', req => 3)), 3, 'keepalive merge');
 is(count_keepalive(http_keepalive('/r', req => 5)), 3, 'keepalive merge limit');
 
@@ -104,6 +107,15 @@ like($r, qr/Keep-Alive: timeout=9/, 'kee
 
 like(http_keepalive('/zero'), qr/Connection: close/, 'keepalive timeout 0');
 
+$t->stop();
+
+TODO: {
+local $TODO = 'not yet';
+
+is($t->read_file('test.log'), "keep-alive\nclose\n", 'sent_http_connection');
+
+}
+
 ###############################################################################
 
 sub http_keepalive {