Skip to content

Commit 28e8dbc

Browse files
test(opentelemetry): add test for invalid x-request-id handling
1 parent 3f93a20 commit 28e8dbc

1 file changed

Lines changed: 38 additions & 2 deletions

File tree

t/plugin/opentelemetry.t

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,43 @@ qr/.*\/specific_status.*/
437437
438438
439439
440-
=== TEST 20: invalid x-request-id should not crash
440+
=== TEST 20: recreate route for invalid x-request-id test
441+
--- config
442+
location /t {
443+
content_by_lua_block {
444+
local t = require("lib.test_admin").test
445+
local code, body = t('/apisix/admin/routes/1',
446+
ngx.HTTP_PUT,
447+
[[{
448+
"plugins": {
449+
"opentelemetry": {
450+
"sampler": {
451+
"name": "always_on"
452+
}
453+
}
454+
},
455+
"upstream": {
456+
"nodes": {
457+
"127.0.0.1:1980": 1
458+
},
459+
"type": "roundrobin"
460+
},
461+
"uri": "/opentracing"
462+
}]]
463+
)
464+
465+
if code >= 300 then
466+
ngx.status = code
467+
end
468+
ngx.say(body)
469+
}
470+
}
471+
--- request
472+
GET /t
473+
474+
475+
476+
=== TEST 21: invalid x-request-id should not crash
441477
--- request
442478
GET /opentracing
443479
--- more_headers
@@ -446,4 +482,4 @@ X-Request-Id: 550e8400-e29b-41d4-a716-446655440000
446482
--- response_body
447483
opentracing
448484
--- no_error_log
449-
[error]
485+
[error]

0 commit comments

Comments
 (0)