- vanilla nginx + Rust 动态模块(取代 OpenResty+Lua),共享内存为运行期真源 - 三域名分流 18098 ssl:mdm 管理台 / lm LLM 代理 / *.dm 企业转发,共用 *.mayishangshu.cn 通配符证书(证书不入库) - LLM 统一出口:同 Key 鉴权、上游 Key 替换、白名单、限流配额、SSE - 回归夹具 tests/(网关 55 + LLM 34 = 89 断言,夹具 cp 覆盖重置) - 文档:readme(16 章)+ CLAUDE.md + conf/tls/README(acme.sh 证书管理、hairpin 环回链路)
80 lines
1.4 KiB
Perl
80 lines
1.4 KiB
Perl
#!/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 proxy/)->plan(2)
|
|
->write_file_expand('nginx.conf', <<"EOF");
|
|
|
|
%%TEST_GLOBALS%%
|
|
|
|
daemon off;
|
|
|
|
events {
|
|
}
|
|
|
|
http {
|
|
%%TEST_GLOBALS_HTTP%%
|
|
|
|
upstream u {
|
|
server 127.0.0.1:8081;
|
|
custom 32;
|
|
}
|
|
|
|
server {
|
|
listen 127.0.0.1:8080;
|
|
server_name localhost;
|
|
|
|
error_log %%TESTDIR%%/e_debug.log debug;
|
|
|
|
location / {
|
|
proxy_pass http://u;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 127.0.0.1:8081;
|
|
server_name localhost;
|
|
|
|
location / { }
|
|
}
|
|
}
|
|
|
|
EOF
|
|
|
|
$t->write_file('index.html', '');
|
|
$t->run();
|
|
|
|
###############################################################################
|
|
|
|
like(http_get('/'), qr/200 OK/, 'custom upstream');
|
|
|
|
$t->stop();
|
|
|
|
SKIP: {
|
|
skip "no --with-debug", 1 unless $t->has_module('--with-debug');
|
|
|
|
like($t->read_file('e_debug.log'), qr/CUSTOM UPSTREAM request/,
|
|
'log - custom upstream');
|
|
}
|
|
|
|
###############################################################################
|