[PATCH 1 of 2] Tests: removed bytes sent tests on rejected connection upgrades
Maxim Dounin
mdounin at mdounin.ru
Fri Aug 8 20:20:05 UTC 2025
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1753423860 -10800
# Fri Jul 25 09:11:00 2025 +0300
# Node ID f43f8260fc6802f1193115a92c6dc1d2f23a0f7d
# Parent 0b65f4c779066132ebb782923c8f3b3a0c03904a
Tests: removed bytes sent tests on rejected connection upgrades.
In proxy_upgrade.t and ssl_proxy_upgrade.t, $body_bytes_sent was expected
to be 0 if connection upgrade was not requested by the client, yet the
upstream server tried to return 101 (Switching Protocols). This is,
however, not the only possible valid outcome. In particular, if such
a response is considered to be an error, and 502 (Bad Gateway) is generated,
$body_bytes_sent won't be 0, breaking the test. As such, these tests
were removed.
diff --git a/proxy_upgrade.t b/proxy_upgrade.t
--- a/proxy_upgrade.t
+++ b/proxy_upgrade.t
@@ -28,7 +28,7 @@ select STDERR; $| = 1;
select STDOUT; $| = 1;
my $t = Test::Nginx->new()->has(qw/http proxy ssi/)
- ->write_file_expand('nginx.conf', <<'EOF')->plan(31);
+ ->write_file_expand('nginx.conf', <<'EOF')->plan(30);
%%TEST_GLOBALS%%
@@ -149,7 +149,6 @@ open my $f, '<', "$d/cc.log" or die "Can
is($f->getline(), shift (@r) . " 540793 upgrade\n", 'log - bytes');
is($f->getline(), shift (@r) . " 22 upgrade\n", 'log - bytes pipelined');
-like($f->getline(), qr/\d+ 0 /, 'log - bytes noupgrade');
###############################################################################
diff --git a/ssl_proxy_upgrade.t b/ssl_proxy_upgrade.t
--- a/ssl_proxy_upgrade.t
+++ b/ssl_proxy_upgrade.t
@@ -31,7 +31,7 @@ select STDOUT; $| = 1;
my $t = Test::Nginx->new()->has(qw/http proxy http_ssl socket_ssl/)
->has_daemon('openssl')
- ->write_file_expand('nginx.conf', <<'EOF')->plan(30);
+ ->write_file_expand('nginx.conf', <<'EOF')->plan(29);
%%TEST_GLOBALS%%
@@ -160,7 +160,6 @@ open my $f, '<', "$d/cc.log" or die "Can
is($f->getline(), shift (@r) . " 540793\n", 'log - bytes');
is($f->getline(), shift (@r) . " 22\n", 'log - bytes pipelined');
-like($f->getline(), qr/\d+ 0\n/, 'log - bytes noupgrade');
###############################################################################
More information about the nginx-devel
mailing list