@@ -42,40 +42,49 @@ qr/.*request_id: "1234".*$/
4242
4343
4444
45- === TEST 3 : scoping: value is appended correctly to error logs
46- based on the location where the directive is defined
45+ === TEST 3 : scoping: value is appended correctly to error logs based on the location where the directive is defined
4746-- - config
48- location / append_req_id {
49- set $ req_id_a 123456 ;
50- apisix_request_id_var $ req_id_a ;
47+ location = /append_method {
48+ set $ req_id_b 654321 ;
49+ apisix_request_id_var $ req_id_b ;
50+
5151 content_by_lua_block {
5252 ngx. log (ngx. INFO, " log_msg" )
5353 ngx. exit(200 )
5454 }
5555 }
56- location / append_method {
57- set $ req_id_b 654321 ;
58- apisix_request_id_var $ req_id_b ;
59-
56+ location = /append_req_id {
57+ set $ req_id_a 123456 ;
58+ apisix_request_id_var $ req_id_a ;
6059 content_by_lua_block {
6160 ngx. log (ngx. INFO, " log_msg" )
6261 ngx. exit(200 )
6362 }
6463 }
65- -- - pipelined_requests eval
66- [" GET /append_req_id" , " GET /append_method" ]
67- -- - error_code eval
68- [200 , 200 , 200 ]
64+ -- - request
65+ GET / append_method
6966-- - error_log eval
70- [ ' request_id: "123456"' , ' request_id: "654321"' ]
67+ qr/ log_msg.* request_id: " 654321" $/
68+ -- - no_error_log
69+ [error]
70+ [crit]
71+ [alert]
72+
73+
74+
75+ === TEST 4 : Send request to different location
76+ -- - request
77+ GET / append_req_id
78+ -- - error_log eval
79+ qr/ log_msg.* request_id: " 123456" $/
7180-- - no_error_log
7281[error]
7382[crit]
7483[alert]
7584
7685
7786
78- === TEST 4 : scoping: value is NOT appended to error logs for the location where the directive is NOT defined
87+ === TEST 5 : scoping: value is NOT appended to error logs for the location where the directive is NOT defined
7988-- - config
8089 location / append {
8190 set $ req_id 123456 ;
@@ -99,7 +108,7 @@ qr/log_msg.*request_id/
99108
100109
101110
102- === TEST 5 : scoping: value is appended correctly to error logs when the directive is in the main configuration
111+ === TEST 6 : scoping: value is appended correctly to error logs when the directive is in the main configuration
103112-- - http_config
104113 apisix_request_id_var $ req_id ;
105114-- - config
@@ -122,7 +131,7 @@ qr/log_msg.*request_id: "123456"$/
122131
123132
124133
125- === TEST 6 : scoping: value is appended correctly to error logs and the local directive overrides the global one
134+ === TEST 7 : scoping: value is appended correctly to error logs and the local directive overrides the global one
126135-- - http_config
127136 apisix_request_id_var $ req_id_global ;
128137-- - config
@@ -146,7 +155,7 @@ qr/log_msg.*request_id: "global"$/
146155
147156
148157
149- === TEST 7 : Request ID variable changes are applied to the error log output
158+ === TEST 8 : Request ID variable changes are applied to the error log output
150159-- - config
151160 location = /test {
152161 set $ my_var " " ;
0 commit comments