Skip to content

Commit 0257ef8

Browse files
committed
update test case
1 parent d3a6f34 commit 0257ef8

File tree

3 files changed

+59
-57
lines changed

3 files changed

+59
-57
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
=== TEST 103: aio threads sub request with nginx link function header
2+
--- main_config eval: $::main_conf
3+
--- config
4+
aio threads=my_thread_pool;
5+
ngx_link_func_lib "NGINX_HTTP_LINK_FUNC_TEST_LIB_PATH/liblinkfuntest.so";
6+
location /backend {
7+
return 200 "Welcome ${arg_userName}";
8+
}
9+
location = /auth {
10+
internal;
11+
ngx_link_func_call "my_simple_authentication";
12+
}
13+
location = /my_simple_authentication {
14+
ngx_link_func_add_req_header userId $arg_userId;
15+
ngx_link_func_add_req_header userPass $arg_userPass;
16+
auth_request /auth;
17+
proxy_pass http://127.0.0.1:${server_port}/backend?userName=$http_userName;
18+
}
19+
--- request
20+
GET /my_simple_authentication?userId=foo&userPass=xxxx
21+
--- error_code: 200
22+
--- response_body_like eval
23+
qr/Welcome foo$/
24+
--- skip_nginx
25+
1: < 1.13.4
26+
27+
28+
29+
=== TEST 104: aio threads sub request with client header
30+
--- main_config eval: $::main_conf
31+
--- config
32+
aio threads=my_thread_pool;
33+
ngx_link_func_lib "NGINX_HTTP_LINK_FUNC_TEST_LIB_PATH/liblinkfuntest.so";
34+
location /backend {
35+
return 200 "Welcome ${arg_userName}";
36+
}
37+
location = /auth {
38+
internal;
39+
ngx_link_func_call "my_simple_authentication";
40+
}
41+
location = /my_simple_authentication {
42+
auth_request /auth;
43+
proxy_pass http://127.0.0.1:${server_port}/backend?userName=$http_userName;
44+
}
45+
--- request
46+
GET /my_simple_authentication
47+
--- more_headers
48+
userId:foo
49+
userPass:asdasds
50+
--- error_code: 200
51+
--- response_body_like eval
52+
qr/Welcome foo$/
53+
--- skip_nginx
54+
1: < 1.13.4
55+
56+

build_test_resources/sanity_test_subrequest_parse.t

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -50,60 +50,3 @@ qr/Welcome foo$/
5050
1: < 1.13.4
5151

5252

53-
54-
=== TEST 103: aio threads sub request with nginx link function header
55-
--- main_config eval: $::main_conf
56-
--- config
57-
aio threads=my_thread_pool;
58-
ngx_link_func_lib "NGINX_HTTP_LINK_FUNC_TEST_LIB_PATH/liblinkfuntest.so";
59-
location /backend {
60-
return 200 "Welcome ${arg_userName}";
61-
}
62-
location = /auth {
63-
internal;
64-
ngx_link_func_call "my_simple_authentication";
65-
}
66-
location = /my_simple_authentication {
67-
ngx_link_func_add_req_header userId $arg_userId;
68-
ngx_link_func_add_req_header userPass $arg_userPass;
69-
auth_request /auth;
70-
proxy_pass http://127.0.0.1:${server_port}/backend?userName=$http_userName;
71-
}
72-
--- request
73-
GET /my_simple_authentication?userId=foo&userPass=xxxx
74-
--- error_code: 200
75-
--- response_body_like eval
76-
qr/Welcome foo$/
77-
--- skip_nginx
78-
1: < 1.13.4
79-
80-
81-
82-
=== TEST 104: aio threads sub request with client header
83-
--- main_config eval: $::main_conf
84-
--- config
85-
aio threads=my_thread_pool;
86-
ngx_link_func_lib "NGINX_HTTP_LINK_FUNC_TEST_LIB_PATH/liblinkfuntest.so";
87-
location /backend {
88-
return 200 "Welcome ${arg_userName}";
89-
}
90-
location = /auth {
91-
internal;
92-
ngx_link_func_call "my_simple_authentication";
93-
}
94-
location = /my_simple_authentication {
95-
auth_request /auth;
96-
proxy_pass http://127.0.0.1:${server_port}/backend?userName=$http_userName;
97-
}
98-
--- request
99-
GET /my_simple_authentication
100-
--- more_headers
101-
userId:foo
102-
userPass:asdasds
103-
--- error_code: 200
104-
--- response_body_like eval
105-
qr/Welcome foo$/
106-
--- skip_nginx
107-
1: < 1.13.4
108-
109-

config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ cat $ngx_addon_dir/build_test_resources/sanity_test_aio_parse.t >> $ngx_addon_di
3939
fi
4040
if [ $HTTP_AUTH_REQUEST = YES ]; then
4141
cat $ngx_addon_dir/build_test_resources/sanity_test_subrequest_parse.t >> $ngx_addon_dir/t/sanity.t
42+
if [ $USE_THREADS = YES ]; then
43+
cat $ngx_addon_dir/build_test_resources/sanity_test_subrequest_aio_parse.t >> $ngx_addon_dir/t/sanity.t
44+
fi
4245
fi
4346
cc -shared -o $ngx_addon_dir/t/liblinkfuntest.so -fPIC $ngx_addon_dir/build_test_resources/linkfuntest.c
4447
ABSOLUTE_NGX_LINKFUNC_CURRENT_PATH="$( cd "$ngx_addon_dir" ; pwd -P )"

0 commit comments

Comments
 (0)