Skip to content

Commit 93203d1

Browse files
committed
apply suggestion
1 parent e86af48 commit 93203d1

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

t/request-id-err-log.t

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ run_tests;
44

55
__DATA__
66

7-
=== TEST 1: request_id in error log set
7+
=== TEST 1: apisix_request_id in error log set
88
--- config
99
location /t {
10-
set $request_id_new 1234;
11-
lua_error_log_request_id $request_id_new;
10+
set $apisix_request_id 1234;
11+
lua_error_log_request_id $apisix_request_id;
1212
content_by_lua_block {
1313
ngx.log(ngx.INFO, "log_msg")
1414
ngx.exit(200)
@@ -25,11 +25,11 @@ qr/log_msg.*request_id: "1234"$/
2525

2626

2727

28-
=== TEST 2: request_id in error log set when a runtime error occurs
28+
=== TEST 2: apisix_request_id in error log set when a runtime error occurs
2929
--- config
3030
location /t {
31-
set $request_id_new 1234;
32-
lua_error_log_request_id $request_id_new;
31+
set $apisix_request_id 1234;
32+
lua_error_log_request_id $apisix_request_id;
3333
content_by_lua_block {
3434
error("error_message")
3535
}
@@ -45,16 +45,16 @@ qr/.*request_id: "1234".*$/
4545
=== TEST 3: scoping: value is appended correctly to error logs based on the location where the directive is defined
4646
--- config
4747
location = /append_method {
48-
set $req_id_b 654321;
49-
lua_error_log_request_id $req_id_b;
48+
set $apisix_request_id_b 654321;
49+
lua_error_log_request_id $apisix_request_id_b;
5050
content_by_lua_block {
5151
ngx.log(ngx.INFO, "log_msg")
5252
ngx.exit(200)
5353
}
5454
}
5555
location = /append_req_id {
56-
set $req_id_a 123456;
57-
lua_error_log_request_id $req_id_a;
56+
set $apisix_request_id_a 123456;
57+
lua_error_log_request_id $apisix_request_id_a;
5858
content_by_lua_block {
5959
ngx.log(ngx.INFO, "log_msg")
6060
ngx.exit(200)
@@ -86,8 +86,8 @@ qr/log_msg.*request_id: "123456"$/
8686
=== TEST 5: scoping: value is NOT appended to error logs for the location where the directive is NOT defined
8787
--- config
8888
location /append {
89-
set $req_id 123456;
90-
lua_error_log_request_id $req_id;
89+
set $apisix_request_id 123456;
90+
lua_error_log_request_id $apisix_request_id;
9191
content_by_lua_block {
9292
ngx.log(ngx.ERR, "log_msg")
9393
ngx.exit(200)
@@ -109,9 +109,9 @@ qr/log_msg.*request_id/
109109

110110
=== TEST 6: scoping: value is appended correctly to error logs when the directive is in the main configuration
111111
--- http_config
112-
lua_error_log_request_id $req_id;
112+
lua_error_log_request_id $apisix_request_id;
113113
--- config
114-
set $req_id 123456;
114+
set $apisix_request_id 123456;
115115
location = /test {
116116
content_by_lua_block {
117117
ngx.log(ngx.INFO, "log_msg")
@@ -132,13 +132,13 @@ qr/log_msg.*request_id: "123456"$/
132132

133133
=== TEST 7: scoping: value is appended correctly to error logs and the local directive overrides the global one
134134
--- http_config
135-
lua_error_log_request_id $req_id_global;
135+
lua_error_log_request_id $apisix_request_id_global;
136136
--- config
137-
set $req_id_global global;
138-
set $req_id_local local;
137+
set $apisix_request_id_global global;
138+
set $apisix_request_id_local local;
139139

140140
location = /test {
141-
lua_error_log_request_id $req_id_local;
141+
lua_error_log_request_id $apisix_request_id_local;
142142
content_by_lua_block {
143143
ngx.log(ngx.INFO, "log_msg")
144144
ngx.exit(200)

0 commit comments

Comments
 (0)