Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 107 additions & 1 deletion t/189-http2-subreq-error-wakeup.t
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,26 @@
use Test::Nginx::Socket::Lua;
use Cwd qw(abs_path realpath);
use File::Basename;
use File::Path qw(rmtree);

log_level('info');

my $nginx = $ENV{TEST_NGINX_BINARY} || 'nginx';
my $nginx_v = eval { `$nginx -V 2>&1` } // '';
our $HasHttpSlice = $nginx_v =~ /--with-http_slice_module/;

repeat_each(2);

plan tests => repeat_each() * (blocks() * 9 + 2);
plan tests => repeat_each() * 48;

#no_diff();
no_shuffle();
no_long_string();

my $slice_cache_dir = "/tmp/lua-nginx-module-slice-cache-" . server_port();
rmtree($slice_cache_dir);
add_cleanup_handler(sub { rmtree($slice_cache_dir) });

run_tests();

__DATA__
Expand Down Expand Up @@ -218,3 +229,98 @@ Fast parent completed
--- no_error_log
[alert]
[crit]
[emerg]
[error]
--- no_shutdown_error_log
[alert]
[crit]
[emerg]
[error]



=== TEST 5: warm slice cache for HTTP/2 slow client
--- skip_eval: 4: !$::HasHttpSlice
--- http_config
send_timeout 5s;
proxy_cache_path /tmp/lua-nginx-module-slice-cache-$TEST_NGINX_SERVER_PORT levels=1:2 keys_zone=SLICES:10m inactive=10m max_size=20m;

--- user_files eval
">>> origin/big.bin\n" . ("x" x (10 * 1024 * 1024))

--- config
location = /slice-big.bin {
slice 1m;
proxy_cache SLICES;
proxy_cache_key "$uri $slice_range";
proxy_set_header Range $slice_range;
proxy_cache_valid 200 206 1h;
proxy_pass http://127.0.0.1:$TEST_NGINX_SERVER_PORT/origin/big.bin;
}

location /origin/ {
root $TEST_NGINX_SERVER_ROOT/html;
}

--- http2
--- request
GET /slice-big.bin
--- ignore_response
--- no_error_log
[alert]
[crit]
[emerg]
[error]
--- no_shutdown_error_log
[alert]
[crit]
[emerg]
[error]



=== TEST 6: HTTP/2 slow client with warmed slice cache
--- skip_eval: 4: !$::HasHttpSlice
--- http_config
send_timeout 5s;
proxy_cache_path /tmp/lua-nginx-module-slice-cache-$TEST_NGINX_SERVER_PORT levels=1:2 keys_zone=SLICES:10m inactive=10m max_size=20m;

--- user_files eval
">>> origin/big.bin\n" . ("x" x (10 * 1024 * 1024)) . "\n" .
">>> curl-slow.conf\n" .
"limit-rate = \"50k\"\n" .
"max-time = 8\n" .
"output = \"/dev/null\"\n"

--- config
location = /slice-big.bin {
slice 1m;
proxy_cache SLICES;
proxy_cache_key "$uri $slice_range";
proxy_set_header Range $slice_range;
proxy_cache_valid 200 206 1h;
proxy_pass http://127.0.0.1:$TEST_NGINX_SERVER_PORT/origin/big.bin;
}

location /origin/ {
root $TEST_NGINX_SERVER_ROOT/html;
}

--- http2
--- request
GET /slice-big.bin
--- timeout: 12
--- ignore_response
--- curl_options: --config=t/servroot/html/curl-slow.conf
--- curl_error eval: qr/\((28|92)\)/
--- wait: 6
--- no_error_log
[alert]
[crit]
[emerg]
[error]
--- no_shutdown_error_log
[alert]
[crit]
[emerg]
[error]
1 change: 1 addition & 0 deletions util/build-with-dd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ time ngx-build $force $version \
--with-cc-opt="-DNGX_LUA_USE_ASSERT -I$PCRE2_INC -I$OPENSSL_INC -DDDEBUG=1" \
--with-http_v2_module \
--with-http_v3_module \
--with-http_slice_module \
--with-http_realip_module \
--with-http_ssl_module \
--add-module=$root/../ndk-nginx-module \
Expand Down
1 change: 1 addition & 0 deletions util/build-without-ssl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ time ngx-build $force $version \
--with-ipv6 \
--with-cc-opt="-DNGX_LUA_USE_ASSERT -I$PCRE2_INC" \
--with-http_v2_module \
--with-http_slice_module \
--with-http_realip_module \
--add-module=$root/../ndk-nginx-module \
--add-module=$root/../set-misc-nginx-module \
Expand Down
1 change: 1 addition & 0 deletions util/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ time ngx-build $force $version \
--with-cc-opt="-DNGX_LUA_USE_ASSERT -I$PCRE2_INC -I$OPENSSL_INC" \
--with-http_v2_module \
--with-http_v3_module \
--with-http_slice_module \
--with-http_realip_module \
--with-http_ssl_module \
--add-module=$root/../ndk-nginx-module \
Expand Down
Loading