diff --git a/.github/workflows/nginx.yaml b/.github/workflows/nginx.yaml index fbcbda7..c1d184d 100644 --- a/.github/workflows/nginx.yaml +++ b/.github/workflows/nginx.yaml @@ -75,6 +75,7 @@ jobs: working-directory: nginx env: TEST_NGINX_GLOBALS: >- + load_module ${{ github.workspace }}/nginx/objs/ngx_http_async_module.so; load_module ${{ github.workspace }}/nginx/objs/ngx_http_awssigv4_module.so; load_module ${{ github.workspace }}/nginx/objs/ngx_http_curl_module.so; load_module ${{ github.workspace }}/nginx/objs/ngx_http_upstream_custom_module.so; diff --git a/examples/config b/examples/config index 744825c..5f1ce60 100644 --- a/examples/config +++ b/examples/config @@ -15,7 +15,7 @@ if [ $HTTP = YES ]; then ngx_rust_target_type=EXAMPLE ngx_rust_target_features= - if [ "$ngx_module_link" = DYNAMIC ]; then + if :; then ngx_module_name=ngx_http_async_module ngx_module_libs="-lm" ngx_rust_target_name=async diff --git a/examples/t/async.t b/examples/t/async.t new file mode 100644 index 0000000..98505fd --- /dev/null +++ b/examples/t/async.t @@ -0,0 +1,56 @@ +#!/usr/bin/perl + +# (C) Nginx, Inc + +# Tests for ngx-rust example modules. + +############################################################################### + +use warnings; +use strict; + +use Test::More; + +BEGIN { use FindBin; chdir($FindBin::Bin); } + +use lib 'lib'; +use Test::Nginx; + +############################################################################### + +select STDERR; $| = 1; +select STDOUT; $| = 1; + +my $t = Test::Nginx->new()->has(qw/http/)->plan(1) + ->write_file_expand('nginx.conf', <<'EOF'); + +%%TEST_GLOBALS%% + +daemon off; + +events { +} + +http { + %%TEST_GLOBALS_HTTP%% + + server { + listen 127.0.0.1:8080; + server_name localhost; + + location / { + async on; + } + } +} + +EOF + +$t->write_file('index.html', ''); +$t->run(); + +############################################################################### + +like(http_get('/index.html'), qr/X-Async-Time:/, 'async handler'); + +###############################################################################