Skip to content

Commit

Permalink
test: add async example test
Browse files Browse the repository at this point in the history
  • Loading branch information
bavshin-f5 committed Feb 15, 2025
1 parent 9bacbcd commit 9b043ca
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion examples/config
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
56 changes: 56 additions & 0 deletions examples/t/async.t
Original file line number Diff line number Diff line change
@@ -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');

###############################################################################

0 comments on commit 9b043ca

Please sign in to comment.